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
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
4,934
bool block_job_is_paused(BlockJob *job) { return job->paused; }
false
qemu
751ebd76e654bd1e65da08ecf694325282b4cfcc
bool block_job_is_paused(BlockJob *job) { return job->paused; }
{ "code": [], "line_no": [] }
bool FUNC_0(BlockJob *job) { return job->paused; }
[ "bool FUNC_0(BlockJob *job)\n{", "return job->paused;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,935
int qemu_register_machine(QEMUMachine *m) { char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL); TypeInfo ti = { .name = name, .parent = TYPE_MACHINE, .class_init = machine_class_init, .class_data = (void *)m, }; type_register(&ti); g_free(name); return 0; }
false
qemu
076b35b5a56bca57c4aa41044ed304fe9c45d6c5
int qemu_register_machine(QEMUMachine *m) { char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL); TypeInfo ti = { .name = name, .parent = TYPE_MACHINE, .class_init = machine_class_init, .class_data = (void *)m, }; type_register(&ti); g_free(name); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(QEMUMachine *VAR_0) { char *VAR_1 = g_strconcat(VAR_0->VAR_1, TYPE_MACHINE_SUFFIX, NULL); TypeInfo ti = { .VAR_1 = VAR_1, .parent = TYPE_MACHINE, .class_init = machine_class_init, .class_data = (void *)VAR_0, }; type_register(&ti); g_free(VAR_1); return 0; }
[ "int FUNC_0(QEMUMachine *VAR_0)\n{", "char *VAR_1 = g_strconcat(VAR_0->VAR_1, TYPE_MACHINE_SUFFIX, NULL);", "TypeInfo ti = {", ".VAR_1 = VAR_1,\n.parent = TYPE_MACHINE,\n.class_init = machine_class_init,\n.class_data = (void *)VAR_0,\n};", "type_register(&ti);", "g_free(VAR_1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13, 15, 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
4,936
static int tosa_dac_event(I2CSlave *i2c, enum i2c_event event) { TosaDACState *s = TOSA_DAC(i2c); s->len = 0; switch (event) { case I2C_START_SEND: break; case I2C_START_RECV: printf("%s: recv not supported!!!\n", __FUNCTION__); break; case I2C_FINISH: #ifdef VERBOSE if (s->len < 2) printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len); if (s->len > 2) printf("%s: message too long\n", __FUNCTION__); #endif break; default: break; } return 0; }
false
qemu
a89f364ae8740dfc31b321eed9ee454e996dc3c1
static int tosa_dac_event(I2CSlave *i2c, enum i2c_event event) { TosaDACState *s = TOSA_DAC(i2c); s->len = 0; switch (event) { case I2C_START_SEND: break; case I2C_START_RECV: printf("%s: recv not supported!!!\n", __FUNCTION__); break; case I2C_FINISH: #ifdef VERBOSE if (s->len < 2) printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len); if (s->len > 2) printf("%s: message too long\n", __FUNCTION__); #endif break; default: break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(I2CSlave *VAR_0, enum i2c_event VAR_1) { TosaDACState *s = TOSA_DAC(VAR_0); s->len = 0; switch (VAR_1) { case I2C_START_SEND: break; case I2C_START_RECV: printf("%s: recv not supported!!!\n", __FUNCTION__); break; case I2C_FINISH: #ifdef VERBOSE if (s->len < 2) printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len); if (s->len > 2) printf("%s: message too long\n", __FUNCTION__); #endif break; default: break; } return 0; }
[ "static int FUNC_0(I2CSlave *VAR_0, enum i2c_event VAR_1)\n{", "TosaDACState *s = TOSA_DAC(VAR_0);", "s->len = 0;", "switch (VAR_1) {", "case I2C_START_SEND:\nbreak;", "case I2C_START_RECV:\nprintf(\"%s: recv not supported!!!\\n\", __FUNCTION__);", "break;", "case I2C_FINISH:\n#ifdef VERBOSE\nif (s->len < 2)\nprintf(\"%s: message too short (%i bytes)\\n\", __FUNCTION__, s->len);", "if (s->len > 2)\nprintf(\"%s: message too long\\n\", __FUNCTION__);", "#endif\nbreak;", "default:\nbreak;", "}", "return 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 ], [ 47 ], [ 49 ] ]
4,938
av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; dsp->vp8_idct_add = ff_vp8_idct_add_neon; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; }
false
FFmpeg
b8664c929437d6d079e16979c496a2db40cf2324
av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; dsp->vp8_idct_add = ff_vp8_idct_add_neon; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; dsp->vp8_idct_add = ff_vp8_idct_add_neon; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; }
[ "av_cold void FUNC_0(VP8DSPContext *dsp)\n{", "dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon;", "dsp->vp8_idct_add = ff_vp8_idct_add_neon;", "dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon;", "dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon;", "dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon;", "dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon;", "dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon;", "dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon;", "dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon;", "dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon;", "dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon;", "dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon;", "dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon;", "dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon;", "dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon;", "dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;", "dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon;", "dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon;", "dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon;", "dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;", "dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon;", "dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon;", "dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon;", "dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon;", "dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon;", "dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon;", "dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon;", "dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon;", "dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon;", "dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon;", "dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon;", "dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon;", "dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon;", "dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon;", "dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon;", "dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon;", "dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ] ]
4,939
static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested, uint32_t *byte_len) { int num_cq_events = 0, ret = 0; struct ibv_cq *cq; void *cq_ctx; uint64_t wr_id = RDMA_WRID_NONE, wr_id_in; if (ibv_req_notify_cq(rdma->cq, 0)) { return -1; } /* poll cq first */ while (wr_id != wrid_requested) { ret = qemu_rdma_poll(rdma, &wr_id_in, byte_len); if (ret < 0) { return ret; } wr_id = wr_id_in & RDMA_WRID_TYPE_MASK; if (wr_id == RDMA_WRID_NONE) { break; } if (wr_id != wrid_requested) { trace_qemu_rdma_block_for_wrid_miss(print_wrid(wrid_requested), wrid_requested, print_wrid(wr_id), wr_id); } } if (wr_id == wrid_requested) { return 0; } while (1) { /* * Coroutine doesn't start until migration_fd_process_incoming() * so don't yield unless we know we're running inside of a coroutine. */ if (rdma->migration_started_on_destination) { yield_until_fd_readable(rdma->comp_channel->fd); } ret = ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx); if (ret) { perror("ibv_get_cq_event"); goto err_block_for_wrid; } num_cq_events++; ret = -ibv_req_notify_cq(cq, 0); if (ret) { goto err_block_for_wrid; } while (wr_id != wrid_requested) { ret = qemu_rdma_poll(rdma, &wr_id_in, byte_len); if (ret < 0) { goto err_block_for_wrid; } wr_id = wr_id_in & RDMA_WRID_TYPE_MASK; if (wr_id == RDMA_WRID_NONE) { break; } if (wr_id != wrid_requested) { trace_qemu_rdma_block_for_wrid_miss(print_wrid(wrid_requested), wrid_requested, print_wrid(wr_id), wr_id); } } if (wr_id == wrid_requested) { goto success_block_for_wrid; } } success_block_for_wrid: if (num_cq_events) { ibv_ack_cq_events(cq, num_cq_events); } return 0; err_block_for_wrid: if (num_cq_events) { ibv_ack_cq_events(cq, num_cq_events); } rdma->error_state = ret; return ret; }
false
qemu
9c98cfbe72b21d9d84b9ea8d231bde103b9fb7ae
static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested, uint32_t *byte_len) { int num_cq_events = 0, ret = 0; struct ibv_cq *cq; void *cq_ctx; uint64_t wr_id = RDMA_WRID_NONE, wr_id_in; if (ibv_req_notify_cq(rdma->cq, 0)) { return -1; } while (wr_id != wrid_requested) { ret = qemu_rdma_poll(rdma, &wr_id_in, byte_len); if (ret < 0) { return ret; } wr_id = wr_id_in & RDMA_WRID_TYPE_MASK; if (wr_id == RDMA_WRID_NONE) { break; } if (wr_id != wrid_requested) { trace_qemu_rdma_block_for_wrid_miss(print_wrid(wrid_requested), wrid_requested, print_wrid(wr_id), wr_id); } } if (wr_id == wrid_requested) { return 0; } while (1) { if (rdma->migration_started_on_destination) { yield_until_fd_readable(rdma->comp_channel->fd); } ret = ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx); if (ret) { perror("ibv_get_cq_event"); goto err_block_for_wrid; } num_cq_events++; ret = -ibv_req_notify_cq(cq, 0); if (ret) { goto err_block_for_wrid; } while (wr_id != wrid_requested) { ret = qemu_rdma_poll(rdma, &wr_id_in, byte_len); if (ret < 0) { goto err_block_for_wrid; } wr_id = wr_id_in & RDMA_WRID_TYPE_MASK; if (wr_id == RDMA_WRID_NONE) { break; } if (wr_id != wrid_requested) { trace_qemu_rdma_block_for_wrid_miss(print_wrid(wrid_requested), wrid_requested, print_wrid(wr_id), wr_id); } } if (wr_id == wrid_requested) { goto success_block_for_wrid; } } success_block_for_wrid: if (num_cq_events) { ibv_ack_cq_events(cq, num_cq_events); } return 0; err_block_for_wrid: if (num_cq_events) { ibv_ack_cq_events(cq, num_cq_events); } rdma->error_state = ret; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(RDMAContext *VAR_0, int VAR_1, uint32_t *VAR_2) { int VAR_3 = 0, VAR_4 = 0; struct ibv_cq *VAR_5; void *VAR_6; uint64_t wr_id = RDMA_WRID_NONE, wr_id_in; if (ibv_req_notify_cq(VAR_0->VAR_5, 0)) { return -1; } while (wr_id != VAR_1) { VAR_4 = qemu_rdma_poll(VAR_0, &wr_id_in, VAR_2); if (VAR_4 < 0) { return VAR_4; } wr_id = wr_id_in & RDMA_WRID_TYPE_MASK; if (wr_id == RDMA_WRID_NONE) { break; } if (wr_id != VAR_1) { trace_qemu_rdma_block_for_wrid_miss(print_wrid(VAR_1), VAR_1, print_wrid(wr_id), wr_id); } } if (wr_id == VAR_1) { return 0; } while (1) { if (VAR_0->migration_started_on_destination) { yield_until_fd_readable(VAR_0->comp_channel->fd); } VAR_4 = ibv_get_cq_event(VAR_0->comp_channel, &VAR_5, &VAR_6); if (VAR_4) { perror("ibv_get_cq_event"); goto err_block_for_wrid; } VAR_3++; VAR_4 = -ibv_req_notify_cq(VAR_5, 0); if (VAR_4) { goto err_block_for_wrid; } while (wr_id != VAR_1) { VAR_4 = qemu_rdma_poll(VAR_0, &wr_id_in, VAR_2); if (VAR_4 < 0) { goto err_block_for_wrid; } wr_id = wr_id_in & RDMA_WRID_TYPE_MASK; if (wr_id == RDMA_WRID_NONE) { break; } if (wr_id != VAR_1) { trace_qemu_rdma_block_for_wrid_miss(print_wrid(VAR_1), VAR_1, print_wrid(wr_id), wr_id); } } if (wr_id == VAR_1) { goto success_block_for_wrid; } } success_block_for_wrid: if (VAR_3) { ibv_ack_cq_events(VAR_5, VAR_3); } return 0; err_block_for_wrid: if (VAR_3) { ibv_ack_cq_events(VAR_5, VAR_3); } VAR_0->error_state = VAR_4; return VAR_4; }
[ "static int FUNC_0(RDMAContext *VAR_0, int VAR_1,\nuint32_t *VAR_2)\n{", "int VAR_3 = 0, VAR_4 = 0;", "struct ibv_cq *VAR_5;", "void *VAR_6;", "uint64_t wr_id = RDMA_WRID_NONE, wr_id_in;", "if (ibv_req_notify_cq(VAR_0->VAR_5, 0)) {", "return -1;", "}", "while (wr_id != VAR_1) {", "VAR_4 = qemu_rdma_poll(VAR_0, &wr_id_in, VAR_2);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "wr_id = wr_id_in & RDMA_WRID_TYPE_MASK;", "if (wr_id == RDMA_WRID_NONE) {", "break;", "}", "if (wr_id != VAR_1) {", "trace_qemu_rdma_block_for_wrid_miss(print_wrid(VAR_1),\nVAR_1, print_wrid(wr_id), wr_id);", "}", "}", "if (wr_id == VAR_1) {", "return 0;", "}", "while (1) {", "if (VAR_0->migration_started_on_destination) {", "yield_until_fd_readable(VAR_0->comp_channel->fd);", "}", "VAR_4 = ibv_get_cq_event(VAR_0->comp_channel, &VAR_5, &VAR_6);", "if (VAR_4) {", "perror(\"ibv_get_cq_event\");", "goto err_block_for_wrid;", "}", "VAR_3++;", "VAR_4 = -ibv_req_notify_cq(VAR_5, 0);", "if (VAR_4) {", "goto err_block_for_wrid;", "}", "while (wr_id != VAR_1) {", "VAR_4 = qemu_rdma_poll(VAR_0, &wr_id_in, VAR_2);", "if (VAR_4 < 0) {", "goto err_block_for_wrid;", "}", "wr_id = wr_id_in & RDMA_WRID_TYPE_MASK;", "if (wr_id == RDMA_WRID_NONE) {", "break;", "}", "if (wr_id != VAR_1) {", "trace_qemu_rdma_block_for_wrid_miss(print_wrid(VAR_1),\nVAR_1, print_wrid(wr_id), wr_id);", "}", "}", "if (wr_id == VAR_1) {", "goto success_block_for_wrid;", "}", "}", "success_block_for_wrid:\nif (VAR_3) {", "ibv_ack_cq_events(VAR_5, VAR_3);", "}", "return 0;", "err_block_for_wrid:\nif (VAR_3) {", "ibv_ack_cq_events(VAR_5, VAR_3);", "}", "VAR_0->error_state = VAR_4;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ] ]
4,940
static void mmio_ide_cmd_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { MMIOState *s = opaque; ide_cmd_write(&s->bus, 0, val); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void mmio_ide_cmd_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { MMIOState *s = opaque; ide_cmd_write(&s->bus, 0, val); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { MMIOState *s = VAR_0; ide_cmd_write(&s->bus, 0, VAR_2); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "MMIOState *s = VAR_0;", "ide_cmd_write(&s->bus, 0, VAR_2);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
4,941
static void xenfb_copy_mfns(int mode, int count, unsigned long *dst, void *src) { uint32_t *src32 = src; uint64_t *src64 = src; int i; for (i = 0; i < count; i++) dst[i] = (mode == 32) ? src32[i] : src64[i]; }
false
qemu
643f59322432d77165329dfabe2d040d7e30dae8
static void xenfb_copy_mfns(int mode, int count, unsigned long *dst, void *src) { uint32_t *src32 = src; uint64_t *src64 = src; int i; for (i = 0; i < count; i++) dst[i] = (mode == 32) ? src32[i] : src64[i]; }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, int VAR_1, unsigned long *VAR_2, void *VAR_3) { uint32_t *src32 = VAR_3; uint64_t *src64 = VAR_3; int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) VAR_2[VAR_4] = (VAR_0 == 32) ? src32[VAR_4] : src64[VAR_4]; }
[ "static void FUNC_0(int VAR_0, int VAR_1, unsigned long *VAR_2, void *VAR_3)\n{", "uint32_t *src32 = VAR_3;", "uint64_t *src64 = VAR_3;", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++)", "VAR_2[VAR_4] = (VAR_0 == 32) ? src32[VAR_4] : src64[VAR_4];", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ] ]
4,942
void memory_region_unregister_iommu_notifier(MemoryRegion *mr, Notifier *n) { notifier_remove(n); if (mr->iommu_ops->notify_stopped && QLIST_EMPTY(&mr->iommu_notify.notifiers)) { mr->iommu_ops->notify_stopped(mr); } }
false
qemu
cdb3081269347fd9271fd1b7a9df312e2953bdd9
void memory_region_unregister_iommu_notifier(MemoryRegion *mr, Notifier *n) { notifier_remove(n); if (mr->iommu_ops->notify_stopped && QLIST_EMPTY(&mr->iommu_notify.notifiers)) { mr->iommu_ops->notify_stopped(mr); } }
{ "code": [], "line_no": [] }
void FUNC_0(MemoryRegion *VAR_0, Notifier *VAR_1) { notifier_remove(VAR_1); if (VAR_0->iommu_ops->notify_stopped && QLIST_EMPTY(&VAR_0->iommu_notify.notifiers)) { VAR_0->iommu_ops->notify_stopped(VAR_0); } }
[ "void FUNC_0(MemoryRegion *VAR_0, Notifier *VAR_1)\n{", "notifier_remove(VAR_1);", "if (VAR_0->iommu_ops->notify_stopped &&\nQLIST_EMPTY(&VAR_0->iommu_notify.notifiers)) {", "VAR_0->iommu_ops->notify_stopped(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ] ]
4,943
int inet_connect(const char *str, bool block, Error **errp) { QemuOpts *opts; int sock = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); if (inet_parse(opts, str) == 0) { if (block) { qemu_opt_set(opts, "block", "on"); } sock = inet_connect_opts(opts, errp); } else { error_set(errp, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return sock; }
false
qemu
02a08fef079469c005d48fe2d181f0e0eb5752ae
int inet_connect(const char *str, bool block, Error **errp) { QemuOpts *opts; int sock = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); if (inet_parse(opts, str) == 0) { if (block) { qemu_opt_set(opts, "block", "on"); } sock = inet_connect_opts(opts, errp); } else { error_set(errp, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return sock; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0, bool VAR_1, Error **VAR_2) { QemuOpts *opts; int VAR_3 = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); if (inet_parse(opts, VAR_0) == 0) { if (VAR_1) { qemu_opt_set(opts, "VAR_1", "on"); } VAR_3 = inet_connect_opts(opts, VAR_2); } else { error_set(VAR_2, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return VAR_3; }
[ "int FUNC_0(const char *VAR_0, bool VAR_1, Error **VAR_2)\n{", "QemuOpts *opts;", "int VAR_3 = -1;", "opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);", "if (inet_parse(opts, VAR_0) == 0) {", "if (VAR_1) {", "qemu_opt_set(opts, \"VAR_1\", \"on\");", "}", "VAR_3 = inet_connect_opts(opts, VAR_2);", "} else {", "error_set(VAR_2, QERR_SOCKET_CREATE_FAILED);", "}", "qemu_opts_del(opts);", "return VAR_3;", "}" ]
[ 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 ] ]
4,944
static void eth_send(mv88w8618_eth_state *s, int queue_index) { uint32_t desc_addr = s->tx_queue[queue_index]; mv88w8618_tx_desc desc; uint8_t buf[2048]; int len; do { eth_tx_desc_get(desc_addr, &desc); if (desc.cmdstat & MP_ETH_TX_OWN) { len = desc.bytes; if (len < 2048) { cpu_physical_memory_read(desc.buffer, buf, len); qemu_send_packet(s->vc, buf, len); } desc.cmdstat &= ~MP_ETH_TX_OWN; s->icr |= 1 << (MP_ETH_IRQ_TXLO_BIT - queue_index); eth_tx_desc_put(desc_addr, &desc); } desc_addr = desc.next; } while (desc_addr != s->tx_queue[queue_index]); }
false
qemu
2e87c5b937444c1155073f7b10d630e0e383e5d8
static void eth_send(mv88w8618_eth_state *s, int queue_index) { uint32_t desc_addr = s->tx_queue[queue_index]; mv88w8618_tx_desc desc; uint8_t buf[2048]; int len; do { eth_tx_desc_get(desc_addr, &desc); if (desc.cmdstat & MP_ETH_TX_OWN) { len = desc.bytes; if (len < 2048) { cpu_physical_memory_read(desc.buffer, buf, len); qemu_send_packet(s->vc, buf, len); } desc.cmdstat &= ~MP_ETH_TX_OWN; s->icr |= 1 << (MP_ETH_IRQ_TXLO_BIT - queue_index); eth_tx_desc_put(desc_addr, &desc); } desc_addr = desc.next; } while (desc_addr != s->tx_queue[queue_index]); }
{ "code": [], "line_no": [] }
static void FUNC_0(mv88w8618_eth_state *VAR_0, int VAR_1) { uint32_t desc_addr = VAR_0->tx_queue[VAR_1]; mv88w8618_tx_desc desc; uint8_t buf[2048]; int VAR_2; do { eth_tx_desc_get(desc_addr, &desc); if (desc.cmdstat & MP_ETH_TX_OWN) { VAR_2 = desc.bytes; if (VAR_2 < 2048) { cpu_physical_memory_read(desc.buffer, buf, VAR_2); qemu_send_packet(VAR_0->vc, buf, VAR_2); } desc.cmdstat &= ~MP_ETH_TX_OWN; VAR_0->icr |= 1 << (MP_ETH_IRQ_TXLO_BIT - VAR_1); eth_tx_desc_put(desc_addr, &desc); } desc_addr = desc.next; } while (desc_addr != VAR_0->tx_queue[VAR_1]); }
[ "static void FUNC_0(mv88w8618_eth_state *VAR_0, int VAR_1)\n{", "uint32_t desc_addr = VAR_0->tx_queue[VAR_1];", "mv88w8618_tx_desc desc;", "uint8_t buf[2048];", "int VAR_2;", "do {", "eth_tx_desc_get(desc_addr, &desc);", "if (desc.cmdstat & MP_ETH_TX_OWN) {", "VAR_2 = desc.bytes;", "if (VAR_2 < 2048) {", "cpu_physical_memory_read(desc.buffer, buf, VAR_2);", "qemu_send_packet(VAR_0->vc, buf, VAR_2);", "}", "desc.cmdstat &= ~MP_ETH_TX_OWN;", "VAR_0->icr |= 1 << (MP_ETH_IRQ_TXLO_BIT - VAR_1);", "eth_tx_desc_put(desc_addr, &desc);", "}", "desc_addr = desc.next;", "} while (desc_addr != VAR_0->tx_queue[VAR_1]);", "}" ]
[ 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
4,946
static void test_submit_aio(void) { WorkerTestData data = { .n = 0, .ret = -EINPROGRESS }; data.aiocb = thread_pool_submit_aio(worker_cb, &data, done_cb, &data); /* The callbacks are not called until after the first wait. */ active = 1; g_assert_cmpint(data.ret, ==, -EINPROGRESS); qemu_aio_flush(); g_assert_cmpint(active, ==, 0); g_assert_cmpint(data.n, ==, 1); g_assert_cmpint(data.ret, ==, 0); }
false
qemu
8a805c222caa0e20bf11d2267f726d0bb5917d94
static void test_submit_aio(void) { WorkerTestData data = { .n = 0, .ret = -EINPROGRESS }; data.aiocb = thread_pool_submit_aio(worker_cb, &data, done_cb, &data); active = 1; g_assert_cmpint(data.ret, ==, -EINPROGRESS); qemu_aio_flush(); g_assert_cmpint(active, ==, 0); g_assert_cmpint(data.n, ==, 1); g_assert_cmpint(data.ret, ==, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { WorkerTestData data = { .n = 0, .ret = -EINPROGRESS }; data.aiocb = thread_pool_submit_aio(worker_cb, &data, done_cb, &data); active = 1; g_assert_cmpint(data.ret, ==, -EINPROGRESS); qemu_aio_flush(); g_assert_cmpint(active, ==, 0); g_assert_cmpint(data.n, ==, 1); g_assert_cmpint(data.ret, ==, 0); }
[ "static void FUNC_0(void)\n{", "WorkerTestData data = { .n = 0, .ret = -EINPROGRESS };", "data.aiocb = thread_pool_submit_aio(worker_cb, &data, done_cb, &data);", "active = 1;", "g_assert_cmpint(data.ret, ==, -EINPROGRESS);", "qemu_aio_flush();", "g_assert_cmpint(active, ==, 0);", "g_assert_cmpint(data.n, ==, 1);", "g_assert_cmpint(data.ret, ==, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
4,947
static int hls_start(AVFormatContext *s) { HLSContext *c = s->priv_data; AVFormatContext *oc = c->avf; int err = 0; if (c->wrap) c->number %= c->wrap; if (av_get_frame_filename(oc->filename, sizeof(oc->filename), c->basename, c->number++) < 0) return AVERROR(EINVAL); if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) return err; if (oc->oformat->priv_class && oc->priv_data) av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0); return 0; }
false
FFmpeg
340b7caf5457b2988bfd53709a00cedc2fcd73b7
static int hls_start(AVFormatContext *s) { HLSContext *c = s->priv_data; AVFormatContext *oc = c->avf; int err = 0; if (c->wrap) c->number %= c->wrap; if (av_get_frame_filename(oc->filename, sizeof(oc->filename), c->basename, c->number++) < 0) return AVERROR(EINVAL); if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) return err; if (oc->oformat->priv_class && oc->priv_data) av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { HLSContext *c = VAR_0->priv_data; AVFormatContext *oc = c->avf; int VAR_1 = 0; if (c->wrap) c->number %= c->wrap; if (av_get_frame_filename(oc->filename, sizeof(oc->filename), c->basename, c->number++) < 0) return AVERROR(EINVAL); if ((VAR_1 = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &VAR_0->interrupt_callback, NULL)) < 0) return VAR_1; if (oc->oformat->priv_class && oc->priv_data) av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "HLSContext *c = VAR_0->priv_data;", "AVFormatContext *oc = c->avf;", "int VAR_1 = 0;", "if (c->wrap)\nc->number %= c->wrap;", "if (av_get_frame_filename(oc->filename, sizeof(oc->filename),\nc->basename, c->number++) < 0)\nreturn AVERROR(EINVAL);", "if ((VAR_1 = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,\n&VAR_0->interrupt_callback, NULL)) < 0)\nreturn VAR_1;", "if (oc->oformat->priv_class && oc->priv_data)\nav_opt_set(oc->priv_data, \"mpegts_flags\", \"resend_headers\", 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19, 21, 23 ], [ 27, 29, 31 ], [ 35, 37 ], [ 41 ], [ 43 ] ]
4,950
void migrate_decompress_threads_create(void) { int i, thread_count; thread_count = migrate_decompress_threads(); decompress_threads = g_new0(QemuThread, thread_count); decomp_param = g_new0(DecompressParam, thread_count); quit_decomp_thread = false; qemu_mutex_init(&decomp_done_lock); qemu_cond_init(&decomp_done_cond); for (i = 0; i < thread_count; i++) { qemu_mutex_init(&decomp_param[i].mutex); qemu_cond_init(&decomp_param[i].cond); decomp_param[i].compbuf = g_malloc0(compressBound(TARGET_PAGE_SIZE)); decomp_param[i].done = true; qemu_thread_create(decompress_threads + i, "decompress", do_data_decompress, decomp_param + i, QEMU_THREAD_JOINABLE); } }
false
qemu
90e56fb46d0a7add88ed463efa4e723a6238f692
void migrate_decompress_threads_create(void) { int i, thread_count; thread_count = migrate_decompress_threads(); decompress_threads = g_new0(QemuThread, thread_count); decomp_param = g_new0(DecompressParam, thread_count); quit_decomp_thread = false; qemu_mutex_init(&decomp_done_lock); qemu_cond_init(&decomp_done_cond); for (i = 0; i < thread_count; i++) { qemu_mutex_init(&decomp_param[i].mutex); qemu_cond_init(&decomp_param[i].cond); decomp_param[i].compbuf = g_malloc0(compressBound(TARGET_PAGE_SIZE)); decomp_param[i].done = true; qemu_thread_create(decompress_threads + i, "decompress", do_data_decompress, decomp_param + i, QEMU_THREAD_JOINABLE); } }
{ "code": [], "line_no": [] }
void FUNC_0(void) { int VAR_0, VAR_1; VAR_1 = migrate_decompress_threads(); decompress_threads = g_new0(QemuThread, VAR_1); decomp_param = g_new0(DecompressParam, VAR_1); quit_decomp_thread = false; qemu_mutex_init(&decomp_done_lock); qemu_cond_init(&decomp_done_cond); for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) { qemu_mutex_init(&decomp_param[VAR_0].mutex); qemu_cond_init(&decomp_param[VAR_0].cond); decomp_param[VAR_0].compbuf = g_malloc0(compressBound(TARGET_PAGE_SIZE)); decomp_param[VAR_0].done = true; qemu_thread_create(decompress_threads + VAR_0, "decompress", do_data_decompress, decomp_param + VAR_0, QEMU_THREAD_JOINABLE); } }
[ "void FUNC_0(void)\n{", "int VAR_0, VAR_1;", "VAR_1 = migrate_decompress_threads();", "decompress_threads = g_new0(QemuThread, VAR_1);", "decomp_param = g_new0(DecompressParam, VAR_1);", "quit_decomp_thread = false;", "qemu_mutex_init(&decomp_done_lock);", "qemu_cond_init(&decomp_done_cond);", "for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) {", "qemu_mutex_init(&decomp_param[VAR_0].mutex);", "qemu_cond_init(&decomp_param[VAR_0].cond);", "decomp_param[VAR_0].compbuf = g_malloc0(compressBound(TARGET_PAGE_SIZE));", "decomp_param[VAR_0].done = true;", "qemu_thread_create(decompress_threads + VAR_0, \"decompress\",\ndo_data_decompress, decomp_param + VAR_0,\nQEMU_THREAD_JOINABLE);", "}", "}" ]
[ 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 ] ]
4,951
void qdev_prop_set_drive(DeviceState *dev, const char *name, DriveInfo *value) { qdev_prop_set(dev, name, &value, PROP_TYPE_DRIVE); }
false
qemu
f8b6cc0070aab8b75bd082582c829be1353f395f
void qdev_prop_set_drive(DeviceState *dev, const char *name, DriveInfo *value) { qdev_prop_set(dev, name, &value, PROP_TYPE_DRIVE); }
{ "code": [], "line_no": [] }
void FUNC_0(DeviceState *VAR_0, const char *VAR_1, DriveInfo *VAR_2) { qdev_prop_set(VAR_0, VAR_1, &VAR_2, PROP_TYPE_DRIVE); }
[ "void FUNC_0(DeviceState *VAR_0, const char *VAR_1, DriveInfo *VAR_2)\n{", "qdev_prop_set(VAR_0, VAR_1, &VAR_2, PROP_TYPE_DRIVE);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,952
static void ppc_spapr_reset(void) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); PowerPCCPU *first_ppc_cpu; uint32_t rtas_limit; /* Check for unknown sysbus devices */ foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL); /* Reset the hash table & recalc the RMA */ spapr_reset_htab(spapr); qemu_devices_reset(); /* * We place the device tree and RTAS just below either the top of the RMA, * or just below 2GB, whichever is lowere, so that it can be * processed with 32-bit real mode code if necessary */ rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR); spapr->rtas_addr = rtas_limit - RTAS_MAX_SIZE; spapr->fdt_addr = spapr->rtas_addr - FDT_MAX_SIZE; /* Load the fdt */ spapr_finalize_fdt(spapr, spapr->fdt_addr, spapr->rtas_addr, spapr->rtas_size); /* Copy RTAS over */ cpu_physical_memory_write(spapr->rtas_addr, spapr->rtas_blob, spapr->rtas_size); /* Set up the entry state */ first_ppc_cpu = POWERPC_CPU(first_cpu); first_ppc_cpu->env.gpr[3] = spapr->fdt_addr; first_ppc_cpu->env.gpr[5] = 0; first_cpu->halted = 0; first_ppc_cpu->env.nip = spapr->entry_point; }
false
qemu
1b71890729953825c57d52ace48a7671c295e899
static void ppc_spapr_reset(void) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); PowerPCCPU *first_ppc_cpu; uint32_t rtas_limit; foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL); spapr_reset_htab(spapr); qemu_devices_reset(); rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR); spapr->rtas_addr = rtas_limit - RTAS_MAX_SIZE; spapr->fdt_addr = spapr->rtas_addr - FDT_MAX_SIZE; spapr_finalize_fdt(spapr, spapr->fdt_addr, spapr->rtas_addr, spapr->rtas_size); cpu_physical_memory_write(spapr->rtas_addr, spapr->rtas_blob, spapr->rtas_size); first_ppc_cpu = POWERPC_CPU(first_cpu); first_ppc_cpu->env.gpr[3] = spapr->fdt_addr; first_ppc_cpu->env.gpr[5] = 0; first_cpu->halted = 0; first_ppc_cpu->env.nip = spapr->entry_point; }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); PowerPCCPU *first_ppc_cpu; uint32_t rtas_limit; foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL); spapr_reset_htab(spapr); qemu_devices_reset(); rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR); spapr->rtas_addr = rtas_limit - RTAS_MAX_SIZE; spapr->fdt_addr = spapr->rtas_addr - FDT_MAX_SIZE; spapr_finalize_fdt(spapr, spapr->fdt_addr, spapr->rtas_addr, spapr->rtas_size); cpu_physical_memory_write(spapr->rtas_addr, spapr->rtas_blob, spapr->rtas_size); first_ppc_cpu = POWERPC_CPU(first_cpu); first_ppc_cpu->env.gpr[3] = spapr->fdt_addr; first_ppc_cpu->env.gpr[5] = 0; first_cpu->halted = 0; first_ppc_cpu->env.nip = spapr->entry_point; }
[ "static void FUNC_0(void)\n{", "sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());", "PowerPCCPU *first_ppc_cpu;", "uint32_t rtas_limit;", "foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL);", "spapr_reset_htab(spapr);", "qemu_devices_reset();", "rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR);", "spapr->rtas_addr = rtas_limit - RTAS_MAX_SIZE;", "spapr->fdt_addr = spapr->rtas_addr - FDT_MAX_SIZE;", "spapr_finalize_fdt(spapr, spapr->fdt_addr, spapr->rtas_addr,\nspapr->rtas_size);", "cpu_physical_memory_write(spapr->rtas_addr, spapr->rtas_blob,\nspapr->rtas_size);", "first_ppc_cpu = POWERPC_CPU(first_cpu);", "first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;", "first_ppc_cpu->env.gpr[5] = 0;", "first_cpu->halted = 0;", "first_ppc_cpu->env.nip = spapr->entry_point;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 21 ], [ 25 ], [ 39 ], [ 41 ], [ 43 ], [ 49, 51 ], [ 57, 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ] ]
4,953
static void create_one_flash(const char *name, hwaddr flashbase, hwaddr flashsize) { /* Create and map a single flash device. We use the same * parameters as the flash devices on the Versatile Express board. */ DriveInfo *dinfo = drive_get_next(IF_PFLASH); DeviceState *dev = qdev_create(NULL, "cfi.pflash01"); const uint64_t sectorlength = 256 * 1024; if (dinfo && qdev_prop_set_drive(dev, "drive", blk_bs(blk_by_legacy_dinfo(dinfo)))) { abort(); } qdev_prop_set_uint32(dev, "num-blocks", flashsize / sectorlength); qdev_prop_set_uint64(dev, "sector-length", sectorlength); qdev_prop_set_uint8(dev, "width", 4); qdev_prop_set_uint8(dev, "device-width", 2); qdev_prop_set_uint8(dev, "big-endian", 0); qdev_prop_set_uint16(dev, "id0", 0x89); qdev_prop_set_uint16(dev, "id1", 0x18); qdev_prop_set_uint16(dev, "id2", 0x00); qdev_prop_set_uint16(dev, "id3", 0x00); qdev_prop_set_string(dev, "name", name); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, flashbase); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void create_one_flash(const char *name, hwaddr flashbase, hwaddr flashsize) { DriveInfo *dinfo = drive_get_next(IF_PFLASH); DeviceState *dev = qdev_create(NULL, "cfi.pflash01"); const uint64_t sectorlength = 256 * 1024; if (dinfo && qdev_prop_set_drive(dev, "drive", blk_bs(blk_by_legacy_dinfo(dinfo)))) { abort(); } qdev_prop_set_uint32(dev, "num-blocks", flashsize / sectorlength); qdev_prop_set_uint64(dev, "sector-length", sectorlength); qdev_prop_set_uint8(dev, "width", 4); qdev_prop_set_uint8(dev, "device-width", 2); qdev_prop_set_uint8(dev, "big-endian", 0); qdev_prop_set_uint16(dev, "id0", 0x89); qdev_prop_set_uint16(dev, "id1", 0x18); qdev_prop_set_uint16(dev, "id2", 0x00); qdev_prop_set_uint16(dev, "id3", 0x00); qdev_prop_set_string(dev, "name", name); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, flashbase); }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0, hwaddr VAR_1, hwaddr VAR_2) { DriveInfo *dinfo = drive_get_next(IF_PFLASH); DeviceState *dev = qdev_create(NULL, "cfi.pflash01"); const uint64_t VAR_3 = 256 * 1024; if (dinfo && qdev_prop_set_drive(dev, "drive", blk_bs(blk_by_legacy_dinfo(dinfo)))) { abort(); } qdev_prop_set_uint32(dev, "num-blocks", VAR_2 / VAR_3); qdev_prop_set_uint64(dev, "sector-length", VAR_3); qdev_prop_set_uint8(dev, "width", 4); qdev_prop_set_uint8(dev, "device-width", 2); qdev_prop_set_uint8(dev, "big-endian", 0); qdev_prop_set_uint16(dev, "id0", 0x89); qdev_prop_set_uint16(dev, "id1", 0x18); qdev_prop_set_uint16(dev, "id2", 0x00); qdev_prop_set_uint16(dev, "id3", 0x00); qdev_prop_set_string(dev, "VAR_0", VAR_0); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, VAR_1); }
[ "static void FUNC_0(const char *VAR_0, hwaddr VAR_1,\nhwaddr VAR_2)\n{", "DriveInfo *dinfo = drive_get_next(IF_PFLASH);", "DeviceState *dev = qdev_create(NULL, \"cfi.pflash01\");", "const uint64_t VAR_3 = 256 * 1024;", "if (dinfo && qdev_prop_set_drive(dev, \"drive\",\nblk_bs(blk_by_legacy_dinfo(dinfo)))) {", "abort();", "}", "qdev_prop_set_uint32(dev, \"num-blocks\", VAR_2 / VAR_3);", "qdev_prop_set_uint64(dev, \"sector-length\", VAR_3);", "qdev_prop_set_uint8(dev, \"width\", 4);", "qdev_prop_set_uint8(dev, \"device-width\", 2);", "qdev_prop_set_uint8(dev, \"big-endian\", 0);", "qdev_prop_set_uint16(dev, \"id0\", 0x89);", "qdev_prop_set_uint16(dev, \"id1\", 0x18);", "qdev_prop_set_uint16(dev, \"id2\", 0x00);", "qdev_prop_set_uint16(dev, \"id3\", 0x00);", "qdev_prop_set_string(dev, \"VAR_0\", VAR_0);", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ] ]
4,954
gdb_handlesig (CPUState *env, int sig) { GDBState *s; char buf[256]; int n; s = &gdbserver_state; if (gdbserver_fd < 0 || s->fd < 0) return sig; /* disable single step if it was enabled */ cpu_single_step(env, 0); tb_flush(env); if (sig != 0) { snprintf(buf, sizeof(buf), "S%02x", sig); put_packet(s, buf); } /* put_packet() might have detected that the peer terminated the connection. */ if (s->fd < 0) return sig; sig = 0; s->state = RS_IDLE; s->running_state = 0; while (s->running_state == 0) { n = read (s->fd, buf, 256); if (n > 0) { int i; for (i = 0; i < n; i++) gdb_read_byte (s, buf[i]); } else if (n == 0 || errno != EAGAIN) { /* XXX: Connection closed. Should probably wait for annother connection before continuing. */ return sig; } } sig = s->signal; s->signal = 0; return sig; }
false
qemu
880a7578381d1c7ed4d41c7599ae3cc06567a824
gdb_handlesig (CPUState *env, int sig) { GDBState *s; char buf[256]; int n; s = &gdbserver_state; if (gdbserver_fd < 0 || s->fd < 0) return sig; cpu_single_step(env, 0); tb_flush(env); if (sig != 0) { snprintf(buf, sizeof(buf), "S%02x", sig); put_packet(s, buf); } if (s->fd < 0) return sig; sig = 0; s->state = RS_IDLE; s->running_state = 0; while (s->running_state == 0) { n = read (s->fd, buf, 256); if (n > 0) { int i; for (i = 0; i < n; i++) gdb_read_byte (s, buf[i]); } else if (n == 0 || errno != EAGAIN) { return sig; } } sig = s->signal; s->signal = 0; return sig; }
{ "code": [], "line_no": [] }
FUNC_0 (CPUState *VAR_0, int VAR_1) { GDBState *s; char VAR_2[256]; int VAR_3; s = &gdbserver_state; if (gdbserver_fd < 0 || s->fd < 0) return VAR_1; cpu_single_step(VAR_0, 0); tb_flush(VAR_0); if (VAR_1 != 0) { snprintf(VAR_2, sizeof(VAR_2), "S%02x", VAR_1); put_packet(s, VAR_2); } if (s->fd < 0) return VAR_1; VAR_1 = 0; s->state = RS_IDLE; s->running_state = 0; while (s->running_state == 0) { VAR_3 = read (s->fd, VAR_2, 256); if (VAR_3 > 0) { int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) gdb_read_byte (s, VAR_2[VAR_4]); } else if (VAR_3 == 0 || errno != EAGAIN) { return VAR_1; } } VAR_1 = s->signal; s->signal = 0; return VAR_1; }
[ "FUNC_0 (CPUState *VAR_0, int VAR_1)\n{", "GDBState *s;", "char VAR_2[256];", "int VAR_3;", "s = &gdbserver_state;", "if (gdbserver_fd < 0 || s->fd < 0)\nreturn VAR_1;", "cpu_single_step(VAR_0, 0);", "tb_flush(VAR_0);", "if (VAR_1 != 0)\n{", "snprintf(VAR_2, sizeof(VAR_2), \"S%02x\", VAR_1);", "put_packet(s, VAR_2);", "}", "if (s->fd < 0)\nreturn VAR_1;", "VAR_1 = 0;", "s->state = RS_IDLE;", "s->running_state = 0;", "while (s->running_state == 0) {", "VAR_3 = read (s->fd, VAR_2, 256);", "if (VAR_3 > 0)\n{", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++)", "gdb_read_byte (s, VAR_2[VAR_4]);", "}", "else if (VAR_3 == 0 || errno != EAGAIN)\n{", "return VAR_1;", "}", "}", "VAR_1 = s->signal;", "s->signal = 0;", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
4,955
uint32_t HELPER(csst)(CPUS390XState *env, uint32_t r3, uint64_t a1, uint64_t a2) { #if !defined(CONFIG_USER_ONLY) || defined(CONFIG_ATOMIC128) uint32_t mem_idx = cpu_mmu_index(env, false); #endif uintptr_t ra = GETPC(); uint32_t fc = extract32(env->regs[0], 0, 8); uint32_t sc = extract32(env->regs[0], 8, 8); uint64_t pl = get_address(env, 1) & -16; uint64_t svh, svl; uint32_t cc; /* Sanity check the function code and storage characteristic. */ if (fc > 1 || sc > 3) { if (!s390_has_feat(S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2)) { goto spec_exception; } if (fc > 2 || sc > 4 || (fc == 2 && (r3 & 1))) { goto spec_exception; } } /* Sanity check the alignments. */ if (extract32(a1, 0, 4 << fc) || extract32(a2, 0, 1 << sc)) { goto spec_exception; } /* Sanity check writability of the store address. */ #ifndef CONFIG_USER_ONLY probe_write(env, a2, mem_idx, ra); #endif /* Note that the compare-and-swap is atomic, and the store is atomic, but the complete operation is not. Therefore we do not need to assert serial context in order to implement this. That said, restart early if we can't support either operation that is supposed to be atomic. */ if (parallel_cpus) { int mask = 0; #if !defined(CONFIG_ATOMIC64) mask = -8; #elif !defined(CONFIG_ATOMIC128) mask = -16; #endif if (((4 << fc) | (1 << sc)) & mask) { cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); } } /* All loads happen before all stores. For simplicity, load the entire store value area from the parameter list. */ svh = cpu_ldq_data_ra(env, pl + 16, ra); svl = cpu_ldq_data_ra(env, pl + 24, ra); switch (fc) { case 0: { uint32_t nv = cpu_ldl_data_ra(env, pl, ra); uint32_t cv = env->regs[r3]; uint32_t ov; if (parallel_cpus) { #ifdef CONFIG_USER_ONLY uint32_t *haddr = g2h(a1); ov = atomic_cmpxchg__nocheck(haddr, cv, nv); #else TCGMemOpIdx oi = make_memop_idx(MO_TEUL | MO_ALIGN, mem_idx); ov = helper_atomic_cmpxchgl_be_mmu(env, a1, cv, nv, oi, ra); #endif } else { ov = cpu_ldl_data_ra(env, a1, ra); cpu_stl_data_ra(env, a1, (ov == cv ? nv : ov), ra); } cc = (ov != cv); env->regs[r3] = deposit64(env->regs[r3], 32, 32, ov); } break; case 1: { uint64_t nv = cpu_ldq_data_ra(env, pl, ra); uint64_t cv = env->regs[r3]; uint64_t ov; if (parallel_cpus) { #ifdef CONFIG_ATOMIC64 # ifdef CONFIG_USER_ONLY uint64_t *haddr = g2h(a1); ov = atomic_cmpxchg__nocheck(haddr, cv, nv); # else TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN, mem_idx); ov = helper_atomic_cmpxchgq_be_mmu(env, a1, cv, nv, oi, ra); # endif #else /* Note that we asserted !parallel_cpus above. */ g_assert_not_reached(); #endif } else { ov = cpu_ldq_data_ra(env, a1, ra); cpu_stq_data_ra(env, a1, (ov == cv ? nv : ov), ra); } cc = (ov != cv); env->regs[r3] = ov; } break; case 2: { uint64_t nvh = cpu_ldq_data_ra(env, pl, ra); uint64_t nvl = cpu_ldq_data_ra(env, pl + 8, ra); Int128 nv = int128_make128(nvl, nvh); Int128 cv = int128_make128(env->regs[r3 + 1], env->regs[r3]); Int128 ov; if (parallel_cpus) { #ifdef CONFIG_ATOMIC128 TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx); ov = helper_atomic_cmpxchgo_be_mmu(env, a1, cv, nv, oi, ra); cc = !int128_eq(ov, cv); #else /* Note that we asserted !parallel_cpus above. */ g_assert_not_reached(); #endif } else { uint64_t oh = cpu_ldq_data_ra(env, a1 + 0, ra); uint64_t ol = cpu_ldq_data_ra(env, a1 + 8, ra); ov = int128_make128(ol, oh); cc = !int128_eq(ov, cv); if (cc) { nv = ov; } cpu_stq_data_ra(env, a1 + 0, int128_gethi(nv), ra); cpu_stq_data_ra(env, a1 + 8, int128_getlo(nv), ra); } env->regs[r3 + 0] = int128_gethi(ov); env->regs[r3 + 1] = int128_getlo(ov); } break; default: g_assert_not_reached(); } /* Store only if the comparison succeeded. Note that above we use a pair of 64-bit big-endian loads, so for sc < 3 we must extract the value from the most-significant bits of svh. */ if (cc == 0) { switch (sc) { case 0: cpu_stb_data_ra(env, a2, svh >> 56, ra); break; case 1: cpu_stw_data_ra(env, a2, svh >> 48, ra); break; case 2: cpu_stl_data_ra(env, a2, svh >> 32, ra); break; case 3: cpu_stq_data_ra(env, a2, svh, ra); break; case 4: if (parallel_cpus) { #ifdef CONFIG_ATOMIC128 TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx); Int128 sv = int128_make128(svl, svh); helper_atomic_sto_be_mmu(env, a2, sv, oi, ra); #else /* Note that we asserted !parallel_cpus above. */ g_assert_not_reached(); #endif } else { cpu_stq_data_ra(env, a2 + 0, svh, ra); cpu_stq_data_ra(env, a2 + 8, svl, ra); } break; default: g_assert_not_reached(); } } return cc; spec_exception: cpu_restore_state(ENV_GET_CPU(env), ra); program_interrupt(env, PGM_SPECIFICATION, 6); g_assert_not_reached(); }
false
qemu
6476615d385eb249105b25873ef30ba4b9c808dc
uint32_t HELPER(csst)(CPUS390XState *env, uint32_t r3, uint64_t a1, uint64_t a2) { #if !defined(CONFIG_USER_ONLY) || defined(CONFIG_ATOMIC128) uint32_t mem_idx = cpu_mmu_index(env, false); #endif uintptr_t ra = GETPC(); uint32_t fc = extract32(env->regs[0], 0, 8); uint32_t sc = extract32(env->regs[0], 8, 8); uint64_t pl = get_address(env, 1) & -16; uint64_t svh, svl; uint32_t cc; if (fc > 1 || sc > 3) { if (!s390_has_feat(S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2)) { goto spec_exception; } if (fc > 2 || sc > 4 || (fc == 2 && (r3 & 1))) { goto spec_exception; } } if (extract32(a1, 0, 4 << fc) || extract32(a2, 0, 1 << sc)) { goto spec_exception; } #ifndef CONFIG_USER_ONLY probe_write(env, a2, mem_idx, ra); #endif if (parallel_cpus) { int mask = 0; #if !defined(CONFIG_ATOMIC64) mask = -8; #elif !defined(CONFIG_ATOMIC128) mask = -16; #endif if (((4 << fc) | (1 << sc)) & mask) { cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); } } svh = cpu_ldq_data_ra(env, pl + 16, ra); svl = cpu_ldq_data_ra(env, pl + 24, ra); switch (fc) { case 0: { uint32_t nv = cpu_ldl_data_ra(env, pl, ra); uint32_t cv = env->regs[r3]; uint32_t ov; if (parallel_cpus) { #ifdef CONFIG_USER_ONLY uint32_t *haddr = g2h(a1); ov = atomic_cmpxchg__nocheck(haddr, cv, nv); #else TCGMemOpIdx oi = make_memop_idx(MO_TEUL | MO_ALIGN, mem_idx); ov = helper_atomic_cmpxchgl_be_mmu(env, a1, cv, nv, oi, ra); #endif } else { ov = cpu_ldl_data_ra(env, a1, ra); cpu_stl_data_ra(env, a1, (ov == cv ? nv : ov), ra); } cc = (ov != cv); env->regs[r3] = deposit64(env->regs[r3], 32, 32, ov); } break; case 1: { uint64_t nv = cpu_ldq_data_ra(env, pl, ra); uint64_t cv = env->regs[r3]; uint64_t ov; if (parallel_cpus) { #ifdef CONFIG_ATOMIC64 # ifdef CONFIG_USER_ONLY uint64_t *haddr = g2h(a1); ov = atomic_cmpxchg__nocheck(haddr, cv, nv); # else TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN, mem_idx); ov = helper_atomic_cmpxchgq_be_mmu(env, a1, cv, nv, oi, ra); # endif #else g_assert_not_reached(); #endif } else { ov = cpu_ldq_data_ra(env, a1, ra); cpu_stq_data_ra(env, a1, (ov == cv ? nv : ov), ra); } cc = (ov != cv); env->regs[r3] = ov; } break; case 2: { uint64_t nvh = cpu_ldq_data_ra(env, pl, ra); uint64_t nvl = cpu_ldq_data_ra(env, pl + 8, ra); Int128 nv = int128_make128(nvl, nvh); Int128 cv = int128_make128(env->regs[r3 + 1], env->regs[r3]); Int128 ov; if (parallel_cpus) { #ifdef CONFIG_ATOMIC128 TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx); ov = helper_atomic_cmpxchgo_be_mmu(env, a1, cv, nv, oi, ra); cc = !int128_eq(ov, cv); #else g_assert_not_reached(); #endif } else { uint64_t oh = cpu_ldq_data_ra(env, a1 + 0, ra); uint64_t ol = cpu_ldq_data_ra(env, a1 + 8, ra); ov = int128_make128(ol, oh); cc = !int128_eq(ov, cv); if (cc) { nv = ov; } cpu_stq_data_ra(env, a1 + 0, int128_gethi(nv), ra); cpu_stq_data_ra(env, a1 + 8, int128_getlo(nv), ra); } env->regs[r3 + 0] = int128_gethi(ov); env->regs[r3 + 1] = int128_getlo(ov); } break; default: g_assert_not_reached(); } if (cc == 0) { switch (sc) { case 0: cpu_stb_data_ra(env, a2, svh >> 56, ra); break; case 1: cpu_stw_data_ra(env, a2, svh >> 48, ra); break; case 2: cpu_stl_data_ra(env, a2, svh >> 32, ra); break; case 3: cpu_stq_data_ra(env, a2, svh, ra); break; case 4: if (parallel_cpus) { #ifdef CONFIG_ATOMIC128 TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx); Int128 sv = int128_make128(svl, svh); helper_atomic_sto_be_mmu(env, a2, sv, oi, ra); #else g_assert_not_reached(); #endif } else { cpu_stq_data_ra(env, a2 + 0, svh, ra); cpu_stq_data_ra(env, a2 + 8, svl, ra); } break; default: g_assert_not_reached(); } } return cc; spec_exception: cpu_restore_state(ENV_GET_CPU(env), ra); program_interrupt(env, PGM_SPECIFICATION, 6); g_assert_not_reached(); }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(csst)(CPUS390XState *env, uint32_t r3, uint64_t a1, uint64_t a2) { #if !defined(CONFIG_USER_ONLY) || defined(CONFIG_ATOMIC128) uint32_t mem_idx = cpu_mmu_index(env, false); #endif uintptr_t ra = GETPC(); uint32_t fc = extract32(env->regs[0], 0, 8); uint32_t sc = extract32(env->regs[0], 8, 8); uint64_t pl = get_address(env, 1) & -16; uint64_t svh, svl; uint32_t cc; if (fc > 1 || sc > 3) { if (!s390_has_feat(S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2)) { goto spec_exception; } if (fc > 2 || sc > 4 || (fc == 2 && (r3 & 1))) { goto spec_exception; } } if (extract32(a1, 0, 4 << fc) || extract32(a2, 0, 1 << sc)) { goto spec_exception; } #ifndef CONFIG_USER_ONLY probe_write(env, a2, mem_idx, ra); #endif if (parallel_cpus) { int VAR_0 = 0; #if !defined(CONFIG_ATOMIC64) VAR_0 = -8; #elif !defined(CONFIG_ATOMIC128) VAR_0 = -16; #endif if (((4 << fc) | (1 << sc)) & VAR_0) { cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); } } svh = cpu_ldq_data_ra(env, pl + 16, ra); svl = cpu_ldq_data_ra(env, pl + 24, ra); switch (fc) { case 0: { uint32_t nv = cpu_ldl_data_ra(env, pl, ra); uint32_t cv = env->regs[r3]; uint32_t ov; if (parallel_cpus) { #ifdef CONFIG_USER_ONLY uint32_t *haddr = g2h(a1); ov = atomic_cmpxchg__nocheck(haddr, cv, nv); #else TCGMemOpIdx oi = make_memop_idx(MO_TEUL | MO_ALIGN, mem_idx); ov = helper_atomic_cmpxchgl_be_mmu(env, a1, cv, nv, oi, ra); #endif } else { ov = cpu_ldl_data_ra(env, a1, ra); cpu_stl_data_ra(env, a1, (ov == cv ? nv : ov), ra); } cc = (ov != cv); env->regs[r3] = deposit64(env->regs[r3], 32, 32, ov); } break; case 1: { uint64_t nv = cpu_ldq_data_ra(env, pl, ra); uint64_t cv = env->regs[r3]; uint64_t ov; if (parallel_cpus) { #ifdef CONFIG_ATOMIC64 # ifdef CONFIG_USER_ONLY uint64_t *haddr = g2h(a1); ov = atomic_cmpxchg__nocheck(haddr, cv, nv); # else TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN, mem_idx); ov = helper_atomic_cmpxchgq_be_mmu(env, a1, cv, nv, oi, ra); # endif #else g_assert_not_reached(); #endif } else { ov = cpu_ldq_data_ra(env, a1, ra); cpu_stq_data_ra(env, a1, (ov == cv ? nv : ov), ra); } cc = (ov != cv); env->regs[r3] = ov; } break; case 2: { uint64_t nvh = cpu_ldq_data_ra(env, pl, ra); uint64_t nvl = cpu_ldq_data_ra(env, pl + 8, ra); Int128 nv = int128_make128(nvl, nvh); Int128 cv = int128_make128(env->regs[r3 + 1], env->regs[r3]); Int128 ov; if (parallel_cpus) { #ifdef CONFIG_ATOMIC128 TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx); ov = helper_atomic_cmpxchgo_be_mmu(env, a1, cv, nv, oi, ra); cc = !int128_eq(ov, cv); #else g_assert_not_reached(); #endif } else { uint64_t oh = cpu_ldq_data_ra(env, a1 + 0, ra); uint64_t ol = cpu_ldq_data_ra(env, a1 + 8, ra); ov = int128_make128(ol, oh); cc = !int128_eq(ov, cv); if (cc) { nv = ov; } cpu_stq_data_ra(env, a1 + 0, int128_gethi(nv), ra); cpu_stq_data_ra(env, a1 + 8, int128_getlo(nv), ra); } env->regs[r3 + 0] = int128_gethi(ov); env->regs[r3 + 1] = int128_getlo(ov); } break; default: g_assert_not_reached(); } if (cc == 0) { switch (sc) { case 0: cpu_stb_data_ra(env, a2, svh >> 56, ra); break; case 1: cpu_stw_data_ra(env, a2, svh >> 48, ra); break; case 2: cpu_stl_data_ra(env, a2, svh >> 32, ra); break; case 3: cpu_stq_data_ra(env, a2, svh, ra); break; case 4: if (parallel_cpus) { #ifdef CONFIG_ATOMIC128 TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx); Int128 sv = int128_make128(svl, svh); helper_atomic_sto_be_mmu(env, a2, sv, oi, ra); #else g_assert_not_reached(); #endif } else { cpu_stq_data_ra(env, a2 + 0, svh, ra); cpu_stq_data_ra(env, a2 + 8, svl, ra); } break; default: g_assert_not_reached(); } } return cc; spec_exception: cpu_restore_state(ENV_GET_CPU(env), ra); program_interrupt(env, PGM_SPECIFICATION, 6); g_assert_not_reached(); }
[ "uint32_t FUNC_0(csst)(CPUS390XState *env, uint32_t r3, uint64_t a1, uint64_t a2)\n{", "#if !defined(CONFIG_USER_ONLY) || defined(CONFIG_ATOMIC128)\nuint32_t mem_idx = cpu_mmu_index(env, false);", "#endif\nuintptr_t ra = GETPC();", "uint32_t fc = extract32(env->regs[0], 0, 8);", "uint32_t sc = extract32(env->regs[0], 8, 8);", "uint64_t pl = get_address(env, 1) & -16;", "uint64_t svh, svl;", "uint32_t cc;", "if (fc > 1 || sc > 3) {", "if (!s390_has_feat(S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2)) {", "goto spec_exception;", "}", "if (fc > 2 || sc > 4 || (fc == 2 && (r3 & 1))) {", "goto spec_exception;", "}", "}", "if (extract32(a1, 0, 4 << fc) || extract32(a2, 0, 1 << sc)) {", "goto spec_exception;", "}", "#ifndef CONFIG_USER_ONLY\nprobe_write(env, a2, mem_idx, ra);", "#endif\nif (parallel_cpus) {", "int VAR_0 = 0;", "#if !defined(CONFIG_ATOMIC64)\nVAR_0 = -8;", "#elif !defined(CONFIG_ATOMIC128)\nVAR_0 = -16;", "#endif\nif (((4 << fc) | (1 << sc)) & VAR_0) {", "cpu_loop_exit_atomic(ENV_GET_CPU(env), ra);", "}", "}", "svh = cpu_ldq_data_ra(env, pl + 16, ra);", "svl = cpu_ldq_data_ra(env, pl + 24, ra);", "switch (fc) {", "case 0:\n{", "uint32_t nv = cpu_ldl_data_ra(env, pl, ra);", "uint32_t cv = env->regs[r3];", "uint32_t ov;", "if (parallel_cpus) {", "#ifdef CONFIG_USER_ONLY\nuint32_t *haddr = g2h(a1);", "ov = atomic_cmpxchg__nocheck(haddr, cv, nv);", "#else\nTCGMemOpIdx oi = make_memop_idx(MO_TEUL | MO_ALIGN, mem_idx);", "ov = helper_atomic_cmpxchgl_be_mmu(env, a1, cv, nv, oi, ra);", "#endif\n} else {", "ov = cpu_ldl_data_ra(env, a1, ra);", "cpu_stl_data_ra(env, a1, (ov == cv ? nv : ov), ra);", "}", "cc = (ov != cv);", "env->regs[r3] = deposit64(env->regs[r3], 32, 32, ov);", "}", "break;", "case 1:\n{", "uint64_t nv = cpu_ldq_data_ra(env, pl, ra);", "uint64_t cv = env->regs[r3];", "uint64_t ov;", "if (parallel_cpus) {", "#ifdef CONFIG_ATOMIC64\n# ifdef CONFIG_USER_ONLY\nuint64_t *haddr = g2h(a1);", "ov = atomic_cmpxchg__nocheck(haddr, cv, nv);", "# else\nTCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN, mem_idx);", "ov = helper_atomic_cmpxchgq_be_mmu(env, a1, cv, nv, oi, ra);", "# endif\n#else\ng_assert_not_reached();", "#endif\n} else {", "ov = cpu_ldq_data_ra(env, a1, ra);", "cpu_stq_data_ra(env, a1, (ov == cv ? nv : ov), ra);", "}", "cc = (ov != cv);", "env->regs[r3] = ov;", "}", "break;", "case 2:\n{", "uint64_t nvh = cpu_ldq_data_ra(env, pl, ra);", "uint64_t nvl = cpu_ldq_data_ra(env, pl + 8, ra);", "Int128 nv = int128_make128(nvl, nvh);", "Int128 cv = int128_make128(env->regs[r3 + 1], env->regs[r3]);", "Int128 ov;", "if (parallel_cpus) {", "#ifdef CONFIG_ATOMIC128\nTCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx);", "ov = helper_atomic_cmpxchgo_be_mmu(env, a1, cv, nv, oi, ra);", "cc = !int128_eq(ov, cv);", "#else\ng_assert_not_reached();", "#endif\n} else {", "uint64_t oh = cpu_ldq_data_ra(env, a1 + 0, ra);", "uint64_t ol = cpu_ldq_data_ra(env, a1 + 8, ra);", "ov = int128_make128(ol, oh);", "cc = !int128_eq(ov, cv);", "if (cc) {", "nv = ov;", "}", "cpu_stq_data_ra(env, a1 + 0, int128_gethi(nv), ra);", "cpu_stq_data_ra(env, a1 + 8, int128_getlo(nv), ra);", "}", "env->regs[r3 + 0] = int128_gethi(ov);", "env->regs[r3 + 1] = int128_getlo(ov);", "}", "break;", "default:\ng_assert_not_reached();", "}", "if (cc == 0) {", "switch (sc) {", "case 0:\ncpu_stb_data_ra(env, a2, svh >> 56, ra);", "break;", "case 1:\ncpu_stw_data_ra(env, a2, svh >> 48, ra);", "break;", "case 2:\ncpu_stl_data_ra(env, a2, svh >> 32, ra);", "break;", "case 3:\ncpu_stq_data_ra(env, a2, svh, ra);", "break;", "case 4:\nif (parallel_cpus) {", "#ifdef CONFIG_ATOMIC128\nTCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx);", "Int128 sv = int128_make128(svl, svh);", "helper_atomic_sto_be_mmu(env, a2, sv, oi, ra);", "#else\ng_assert_not_reached();", "#endif\n} else {", "cpu_stq_data_ra(env, a2 + 0, svh, ra);", "cpu_stq_data_ra(env, a2 + 8, svl, ra);", "}", "break;", "default:\ng_assert_not_reached();", "}", "}", "return cc;", "spec_exception:\ncpu_restore_state(ENV_GET_CPU(env), ra);", "program_interrupt(env, PGM_SPECIFICATION, 6);", "g_assert_not_reached();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 51 ], [ 57, 59 ], [ 61, 73 ], [ 75 ], [ 77, 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 101 ], [ 103 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169, 171, 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183, 185, 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237, 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283, 285 ], [ 287 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313, 315 ], [ 317 ], [ 319, 321 ], [ 323 ], [ 325, 327 ], [ 329, 331 ], [ 333 ], [ 335 ], [ 337, 341 ], [ 343, 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 365 ], [ 369, 371 ], [ 373 ], [ 375 ], [ 377 ] ]
4,956
static void nbd_request_put(NBDRequest *req) { NBDClient *client = req->client; if (req->data) { qemu_vfree(req->data); } g_slice_free(NBDRequest, req); if (client->nb_requests-- == MAX_NBD_REQUESTS) { qemu_notify_event(); } nbd_client_put(client); }
false
qemu
958c717df97ea9ca47a2253b8371130fe5f22980
static void nbd_request_put(NBDRequest *req) { NBDClient *client = req->client; if (req->data) { qemu_vfree(req->data); } g_slice_free(NBDRequest, req); if (client->nb_requests-- == MAX_NBD_REQUESTS) { qemu_notify_event(); } nbd_client_put(client); }
{ "code": [], "line_no": [] }
static void FUNC_0(NBDRequest *VAR_0) { NBDClient *client = VAR_0->client; if (VAR_0->data) { qemu_vfree(VAR_0->data); } g_slice_free(NBDRequest, VAR_0); if (client->nb_requests-- == MAX_NBD_REQUESTS) { qemu_notify_event(); } nbd_client_put(client); }
[ "static void FUNC_0(NBDRequest *VAR_0)\n{", "NBDClient *client = VAR_0->client;", "if (VAR_0->data) {", "qemu_vfree(VAR_0->data);", "}", "g_slice_free(NBDRequest, VAR_0);", "if (client->nb_requests-- == MAX_NBD_REQUESTS) {", "qemu_notify_event();", "}", "nbd_client_put(client);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
4,957
void timerlistgroup_deinit(QEMUTimerListGroup *tlg) { QEMUClockType type; for (type = 0; type < QEMU_CLOCK_MAX; type++) { timerlist_free(tlg->tl[type]); } }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
void timerlistgroup_deinit(QEMUTimerListGroup *tlg) { QEMUClockType type; for (type = 0; type < QEMU_CLOCK_MAX; type++) { timerlist_free(tlg->tl[type]); } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUTimerListGroup *VAR_0) { QEMUClockType type; for (type = 0; type < QEMU_CLOCK_MAX; type++) { timerlist_free(VAR_0->tl[type]); } }
[ "void FUNC_0(QEMUTimerListGroup *VAR_0)\n{", "QEMUClockType type;", "for (type = 0; type < QEMU_CLOCK_MAX; type++) {", "timerlist_free(VAR_0->tl[type]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
4,959
static int nbd_receive_options(NBDClient *client) { int csock = client->sock; uint32_t flags; /* Client sends: [ 0 .. 3] client flags [ 0 .. 7] NBD_OPTS_MAGIC [ 8 .. 11] NBD option [12 .. 15] Data length ... Rest of request [ 0 .. 7] NBD_OPTS_MAGIC [ 8 .. 11] Second NBD option [12 .. 15] Data length ... Rest of request */ if (read_sync(csock, &flags, sizeof(flags)) != sizeof(flags)) { LOG("read failed"); return -EIO; } TRACE("Checking client flags"); be32_to_cpus(&flags); if (flags != 0 && flags != NBD_FLAG_C_FIXED_NEWSTYLE) { LOG("Bad client flags received"); return -EIO; } while (1) { int ret; uint32_t tmp, length; uint64_t magic; if (read_sync(csock, &magic, sizeof(magic)) != sizeof(magic)) { LOG("read failed"); return -EINVAL; } TRACE("Checking opts magic"); if (magic != be64_to_cpu(NBD_OPTS_MAGIC)) { LOG("Bad magic received"); return -EINVAL; } if (read_sync(csock, &tmp, sizeof(tmp)) != sizeof(tmp)) { LOG("read failed"); return -EINVAL; } if (read_sync(csock, &length, sizeof(length)) != sizeof(length)) { LOG("read failed"); return -EINVAL; } length = be32_to_cpu(length); TRACE("Checking option"); switch (be32_to_cpu(tmp)) { case NBD_OPT_LIST: ret = nbd_handle_list(client, length); if (ret < 0) { return ret; } break; case NBD_OPT_ABORT: return -EINVAL; case NBD_OPT_EXPORT_NAME: return nbd_handle_export_name(client, length); default: tmp = be32_to_cpu(tmp); LOG("Unsupported option 0x%x", tmp); nbd_send_rep(client->sock, NBD_REP_ERR_UNSUP, tmp); return -EINVAL; } } }
false
qemu
1a6245a5b0b4e8d822c739b403fc67c8a7bc8d12
static int nbd_receive_options(NBDClient *client) { int csock = client->sock; uint32_t flags; if (read_sync(csock, &flags, sizeof(flags)) != sizeof(flags)) { LOG("read failed"); return -EIO; } TRACE("Checking client flags"); be32_to_cpus(&flags); if (flags != 0 && flags != NBD_FLAG_C_FIXED_NEWSTYLE) { LOG("Bad client flags received"); return -EIO; } while (1) { int ret; uint32_t tmp, length; uint64_t magic; if (read_sync(csock, &magic, sizeof(magic)) != sizeof(magic)) { LOG("read failed"); return -EINVAL; } TRACE("Checking opts magic"); if (magic != be64_to_cpu(NBD_OPTS_MAGIC)) { LOG("Bad magic received"); return -EINVAL; } if (read_sync(csock, &tmp, sizeof(tmp)) != sizeof(tmp)) { LOG("read failed"); return -EINVAL; } if (read_sync(csock, &length, sizeof(length)) != sizeof(length)) { LOG("read failed"); return -EINVAL; } length = be32_to_cpu(length); TRACE("Checking option"); switch (be32_to_cpu(tmp)) { case NBD_OPT_LIST: ret = nbd_handle_list(client, length); if (ret < 0) { return ret; } break; case NBD_OPT_ABORT: return -EINVAL; case NBD_OPT_EXPORT_NAME: return nbd_handle_export_name(client, length); default: tmp = be32_to_cpu(tmp); LOG("Unsupported option 0x%x", tmp); nbd_send_rep(client->sock, NBD_REP_ERR_UNSUP, tmp); return -EINVAL; } } }
{ "code": [], "line_no": [] }
static int FUNC_0(NBDClient *VAR_0) { int VAR_1 = VAR_0->sock; uint32_t flags; if (read_sync(VAR_1, &flags, sizeof(flags)) != sizeof(flags)) { LOG("read failed"); return -EIO; } TRACE("Checking VAR_0 flags"); be32_to_cpus(&flags); if (flags != 0 && flags != NBD_FLAG_C_FIXED_NEWSTYLE) { LOG("Bad VAR_0 flags received"); return -EIO; } while (1) { int VAR_2; uint32_t tmp, length; uint64_t magic; if (read_sync(VAR_1, &magic, sizeof(magic)) != sizeof(magic)) { LOG("read failed"); return -EINVAL; } TRACE("Checking opts magic"); if (magic != be64_to_cpu(NBD_OPTS_MAGIC)) { LOG("Bad magic received"); return -EINVAL; } if (read_sync(VAR_1, &tmp, sizeof(tmp)) != sizeof(tmp)) { LOG("read failed"); return -EINVAL; } if (read_sync(VAR_1, &length, sizeof(length)) != sizeof(length)) { LOG("read failed"); return -EINVAL; } length = be32_to_cpu(length); TRACE("Checking option"); switch (be32_to_cpu(tmp)) { case NBD_OPT_LIST: VAR_2 = nbd_handle_list(VAR_0, length); if (VAR_2 < 0) { return VAR_2; } break; case NBD_OPT_ABORT: return -EINVAL; case NBD_OPT_EXPORT_NAME: return nbd_handle_export_name(VAR_0, length); default: tmp = be32_to_cpu(tmp); LOG("Unsupported option 0x%x", tmp); nbd_send_rep(VAR_0->sock, NBD_REP_ERR_UNSUP, tmp); return -EINVAL; } } }
[ "static int FUNC_0(NBDClient *VAR_0)\n{", "int VAR_1 = VAR_0->sock;", "uint32_t flags;", "if (read_sync(VAR_1, &flags, sizeof(flags)) != sizeof(flags)) {", "LOG(\"read failed\");", "return -EIO;", "}", "TRACE(\"Checking VAR_0 flags\");", "be32_to_cpus(&flags);", "if (flags != 0 && flags != NBD_FLAG_C_FIXED_NEWSTYLE) {", "LOG(\"Bad VAR_0 flags received\");", "return -EIO;", "}", "while (1) {", "int VAR_2;", "uint32_t tmp, length;", "uint64_t magic;", "if (read_sync(VAR_1, &magic, sizeof(magic)) != sizeof(magic)) {", "LOG(\"read failed\");", "return -EINVAL;", "}", "TRACE(\"Checking opts magic\");", "if (magic != be64_to_cpu(NBD_OPTS_MAGIC)) {", "LOG(\"Bad magic received\");", "return -EINVAL;", "}", "if (read_sync(VAR_1, &tmp, sizeof(tmp)) != sizeof(tmp)) {", "LOG(\"read failed\");", "return -EINVAL;", "}", "if (read_sync(VAR_1, &length, sizeof(length)) != sizeof(length)) {", "LOG(\"read failed\");", "return -EINVAL;", "}", "length = be32_to_cpu(length);", "TRACE(\"Checking option\");", "switch (be32_to_cpu(tmp)) {", "case NBD_OPT_LIST:\nVAR_2 = nbd_handle_list(VAR_0, length);", "if (VAR_2 < 0) {", "return VAR_2;", "}", "break;", "case NBD_OPT_ABORT:\nreturn -EINVAL;", "case NBD_OPT_EXPORT_NAME:\nreturn nbd_handle_export_name(VAR_0, length);", "default:\ntmp = be32_to_cpu(tmp);", "LOG(\"Unsupported option 0x%x\", tmp);", "nbd_send_rep(VAR_0->sock, NBD_REP_ERR_UNSUP, tmp);", "return -EINVAL;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131, 133 ], [ 137, 139 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ] ]
4,962
void xtensa_breakpoint_handler(CPUState *cs) { XtensaCPU *cpu = XTENSA_CPU(cs); CPUXtensaState *env = &cpu->env; if (cs->watchpoint_hit) { if (cs->watchpoint_hit->flags & BP_CPU) { uint32_t cause; cs->watchpoint_hit = NULL; cause = check_hw_breakpoints(env); if (cause) { debug_exception_env(env, cause); } cpu_resume_from_signal(cs, NULL); } } }
false
qemu
6886b98036a8f8f5bce8b10756ce080084cef11b
void xtensa_breakpoint_handler(CPUState *cs) { XtensaCPU *cpu = XTENSA_CPU(cs); CPUXtensaState *env = &cpu->env; if (cs->watchpoint_hit) { if (cs->watchpoint_hit->flags & BP_CPU) { uint32_t cause; cs->watchpoint_hit = NULL; cause = check_hw_breakpoints(env); if (cause) { debug_exception_env(env, cause); } cpu_resume_from_signal(cs, NULL); } } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0) { XtensaCPU *cpu = XTENSA_CPU(VAR_0); CPUXtensaState *env = &cpu->env; if (VAR_0->watchpoint_hit) { if (VAR_0->watchpoint_hit->flags & BP_CPU) { uint32_t cause; VAR_0->watchpoint_hit = NULL; cause = check_hw_breakpoints(env); if (cause) { debug_exception_env(env, cause); } cpu_resume_from_signal(VAR_0, NULL); } } }
[ "void FUNC_0(CPUState *VAR_0)\n{", "XtensaCPU *cpu = XTENSA_CPU(VAR_0);", "CPUXtensaState *env = &cpu->env;", "if (VAR_0->watchpoint_hit) {", "if (VAR_0->watchpoint_hit->flags & BP_CPU) {", "uint32_t cause;", "VAR_0->watchpoint_hit = NULL;", "cause = check_hw_breakpoints(env);", "if (cause) {", "debug_exception_env(env, cause);", "}", "cpu_resume_from_signal(VAR_0, NULL);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
4,963
static int qcow2_probe(const uint8_t *buf, int buf_size, const char *filename) { const QCowHeader *cow_header = (const void *)buf; if (buf_size >= sizeof(QCowHeader) && be32_to_cpu(cow_header->magic) == QCOW_MAGIC && be32_to_cpu(cow_header->version) >= QCOW_VERSION) return 100; else return 0; }
false
qemu
6744cbab8cd63b7ce72b3eee4f0055007acf0798
static int qcow2_probe(const uint8_t *buf, int buf_size, const char *filename) { const QCowHeader *cow_header = (const void *)buf; if (buf_size >= sizeof(QCowHeader) && be32_to_cpu(cow_header->magic) == QCOW_MAGIC && be32_to_cpu(cow_header->version) >= QCOW_VERSION) return 100; else return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(const uint8_t *VAR_0, int VAR_1, const char *VAR_2) { const QCowHeader *VAR_3 = (const void *)VAR_0; if (VAR_1 >= sizeof(QCowHeader) && be32_to_cpu(VAR_3->magic) == QCOW_MAGIC && be32_to_cpu(VAR_3->version) >= QCOW_VERSION) return 100; else return 0; }
[ "static int FUNC_0(const uint8_t *VAR_0, int VAR_1, const char *VAR_2)\n{", "const QCowHeader *VAR_3 = (const void *)VAR_0;", "if (VAR_1 >= sizeof(QCowHeader) &&\nbe32_to_cpu(VAR_3->magic) == QCOW_MAGIC &&\nbe32_to_cpu(VAR_3->version) >= QCOW_VERSION)\nreturn 100;", "else\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15 ], [ 17, 19 ], [ 21 ] ]
4,964
static int read_header(AVFormatContext *s, AVFormatParameters *ap) { BinkDemuxContext *bink = s->priv_data; AVIOContext *pb = s->pb; uint32_t fps_num, fps_den; AVStream *vst, *ast; unsigned int i; uint32_t pos, next_pos; uint16_t flags; int keyframe; vst = av_new_stream(s, 0); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_tag = avio_rl32(pb); bink->file_size = avio_rl32(pb) + 8; vst->duration = avio_rl32(pb); if (vst->duration > 1000000) { av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n"); return AVERROR(EIO); } if (avio_rl32(pb) > bink->file_size) { av_log(s, AV_LOG_ERROR, "invalid header: largest frame size greater than file size\n"); return AVERROR(EIO); } avio_skip(pb, 4); vst->codec->width = avio_rl32(pb); vst->codec->height = avio_rl32(pb); fps_num = avio_rl32(pb); fps_den = avio_rl32(pb); if (fps_num == 0 || fps_den == 0) { av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den); return AVERROR(EIO); } av_set_pts_info(vst, 64, fps_den, fps_num); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_BINKVIDEO; vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); vst->codec->extradata_size = 4; avio_read(pb, vst->codec->extradata, 4); bink->num_audio_tracks = avio_rl32(pb); if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) { av_log(s, AV_LOG_ERROR, "invalid header: more than "AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)" audio tracks (%d)\n", bink->num_audio_tracks); return AVERROR(EIO); } if (bink->num_audio_tracks) { avio_skip(pb, 4 * bink->num_audio_tracks); for (i = 0; i < bink->num_audio_tracks; i++) { ast = av_new_stream(s, 1); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_tag = vst->codec->codec_tag; ast->codec->sample_rate = avio_rl16(pb); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); flags = avio_rl16(pb); ast->codec->codec_id = flags & BINK_AUD_USEDCT ? CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT; ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; } for (i = 0; i < bink->num_audio_tracks; i++) s->streams[i + 1]->id = avio_rl32(pb); } /* frame index table */ next_pos = avio_rl32(pb); for (i = 0; i < vst->duration; i++) { pos = next_pos; if (i == vst->duration - 1) { next_pos = bink->file_size; keyframe = 0; } else { next_pos = avio_rl32(pb); keyframe = pos & 1; } pos &= ~1; next_pos &= ~1; if (next_pos <= pos) { av_log(s, AV_LOG_ERROR, "invalid frame index table\n"); return AVERROR(EIO); } av_add_index_entry(vst, pos, i, next_pos - pos, 0, keyframe ? AVINDEX_KEYFRAME : 0); } avio_skip(pb, 4); bink->current_track = -1; return 0; }
false
FFmpeg
093768c9a4855b82c13124f835b655dd70883012
static int read_header(AVFormatContext *s, AVFormatParameters *ap) { BinkDemuxContext *bink = s->priv_data; AVIOContext *pb = s->pb; uint32_t fps_num, fps_den; AVStream *vst, *ast; unsigned int i; uint32_t pos, next_pos; uint16_t flags; int keyframe; vst = av_new_stream(s, 0); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_tag = avio_rl32(pb); bink->file_size = avio_rl32(pb) + 8; vst->duration = avio_rl32(pb); if (vst->duration > 1000000) { av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n"); return AVERROR(EIO); } if (avio_rl32(pb) > bink->file_size) { av_log(s, AV_LOG_ERROR, "invalid header: largest frame size greater than file size\n"); return AVERROR(EIO); } avio_skip(pb, 4); vst->codec->width = avio_rl32(pb); vst->codec->height = avio_rl32(pb); fps_num = avio_rl32(pb); fps_den = avio_rl32(pb); if (fps_num == 0 || fps_den == 0) { av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den); return AVERROR(EIO); } av_set_pts_info(vst, 64, fps_den, fps_num); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_BINKVIDEO; vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); vst->codec->extradata_size = 4; avio_read(pb, vst->codec->extradata, 4); bink->num_audio_tracks = avio_rl32(pb); if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) { av_log(s, AV_LOG_ERROR, "invalid header: more than "AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)" audio tracks (%d)\n", bink->num_audio_tracks); return AVERROR(EIO); } if (bink->num_audio_tracks) { avio_skip(pb, 4 * bink->num_audio_tracks); for (i = 0; i < bink->num_audio_tracks; i++) { ast = av_new_stream(s, 1); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_tag = vst->codec->codec_tag; ast->codec->sample_rate = avio_rl16(pb); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); flags = avio_rl16(pb); ast->codec->codec_id = flags & BINK_AUD_USEDCT ? CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT; ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; } for (i = 0; i < bink->num_audio_tracks; i++) s->streams[i + 1]->id = avio_rl32(pb); } next_pos = avio_rl32(pb); for (i = 0; i < vst->duration; i++) { pos = next_pos; if (i == vst->duration - 1) { next_pos = bink->file_size; keyframe = 0; } else { next_pos = avio_rl32(pb); keyframe = pos & 1; } pos &= ~1; next_pos &= ~1; if (next_pos <= pos) { av_log(s, AV_LOG_ERROR, "invalid frame index table\n"); return AVERROR(EIO); } av_add_index_entry(vst, pos, i, next_pos - pos, 0, keyframe ? AVINDEX_KEYFRAME : 0); } avio_skip(pb, 4); bink->current_track = -1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { BinkDemuxContext *bink = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; uint32_t fps_num, fps_den; AVStream *vst, *ast; unsigned int VAR_2; uint32_t pos, next_pos; uint16_t flags; int VAR_3; vst = av_new_stream(VAR_0, 0); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_tag = avio_rl32(pb); bink->file_size = avio_rl32(pb) + 8; vst->duration = avio_rl32(pb); if (vst->duration > 1000000) { av_log(VAR_0, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n"); return AVERROR(EIO); } if (avio_rl32(pb) > bink->file_size) { av_log(VAR_0, AV_LOG_ERROR, "invalid header: largest frame size greater than file size\n"); return AVERROR(EIO); } avio_skip(pb, 4); vst->codec->width = avio_rl32(pb); vst->codec->height = avio_rl32(pb); fps_num = avio_rl32(pb); fps_den = avio_rl32(pb); if (fps_num == 0 || fps_den == 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den); return AVERROR(EIO); } av_set_pts_info(vst, 64, fps_den, fps_num); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_BINKVIDEO; vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); vst->codec->extradata_size = 4; avio_read(pb, vst->codec->extradata, 4); bink->num_audio_tracks = avio_rl32(pb); if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) { av_log(VAR_0, AV_LOG_ERROR, "invalid header: more than "AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)" audio tracks (%d)\n", bink->num_audio_tracks); return AVERROR(EIO); } if (bink->num_audio_tracks) { avio_skip(pb, 4 * bink->num_audio_tracks); for (VAR_2 = 0; VAR_2 < bink->num_audio_tracks; VAR_2++) { ast = av_new_stream(VAR_0, 1); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_tag = vst->codec->codec_tag; ast->codec->sample_rate = avio_rl16(pb); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); flags = avio_rl16(pb); ast->codec->codec_id = flags & BINK_AUD_USEDCT ? CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT; ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; } for (VAR_2 = 0; VAR_2 < bink->num_audio_tracks; VAR_2++) VAR_0->streams[VAR_2 + 1]->id = avio_rl32(pb); } next_pos = avio_rl32(pb); for (VAR_2 = 0; VAR_2 < vst->duration; VAR_2++) { pos = next_pos; if (VAR_2 == vst->duration - 1) { next_pos = bink->file_size; VAR_3 = 0; } else { next_pos = avio_rl32(pb); VAR_3 = pos & 1; } pos &= ~1; next_pos &= ~1; if (next_pos <= pos) { av_log(VAR_0, AV_LOG_ERROR, "invalid frame index table\n"); return AVERROR(EIO); } av_add_index_entry(vst, pos, VAR_2, next_pos - pos, 0, VAR_3 ? AVINDEX_KEYFRAME : 0); } avio_skip(pb, 4); bink->current_track = -1; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{", "BinkDemuxContext *bink = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "uint32_t fps_num, fps_den;", "AVStream *vst, *ast;", "unsigned int VAR_2;", "uint32_t pos, next_pos;", "uint16_t flags;", "int VAR_3;", "vst = av_new_stream(VAR_0, 0);", "if (!vst)\nreturn AVERROR(ENOMEM);", "vst->codec->codec_tag = avio_rl32(pb);", "bink->file_size = avio_rl32(pb) + 8;", "vst->duration = avio_rl32(pb);", "if (vst->duration > 1000000) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid header: more than 1000000 frames\\n\");", "return AVERROR(EIO);", "}", "if (avio_rl32(pb) > bink->file_size) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"invalid header: largest frame size greater than file size\\n\");", "return AVERROR(EIO);", "}", "avio_skip(pb, 4);", "vst->codec->width = avio_rl32(pb);", "vst->codec->height = avio_rl32(pb);", "fps_num = avio_rl32(pb);", "fps_den = avio_rl32(pb);", "if (fps_num == 0 || fps_den == 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid header: invalid fps (%d/%d)\\n\", fps_num, fps_den);", "return AVERROR(EIO);", "}", "av_set_pts_info(vst, 64, fps_den, fps_num);", "vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "vst->codec->codec_id = CODEC_ID_BINKVIDEO;", "vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);", "vst->codec->extradata_size = 4;", "avio_read(pb, vst->codec->extradata, 4);", "bink->num_audio_tracks = avio_rl32(pb);", "if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"invalid header: more than \"AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)\" audio tracks (%d)\\n\",\nbink->num_audio_tracks);", "return AVERROR(EIO);", "}", "if (bink->num_audio_tracks) {", "avio_skip(pb, 4 * bink->num_audio_tracks);", "for (VAR_2 = 0; VAR_2 < bink->num_audio_tracks; VAR_2++) {", "ast = av_new_stream(VAR_0, 1);", "if (!ast)\nreturn AVERROR(ENOMEM);", "ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "ast->codec->codec_tag = vst->codec->codec_tag;", "ast->codec->sample_rate = avio_rl16(pb);", "av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);", "flags = avio_rl16(pb);", "ast->codec->codec_id = flags & BINK_AUD_USEDCT ?\nCODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;", "ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;", "}", "for (VAR_2 = 0; VAR_2 < bink->num_audio_tracks; VAR_2++)", "VAR_0->streams[VAR_2 + 1]->id = avio_rl32(pb);", "}", "next_pos = avio_rl32(pb);", "for (VAR_2 = 0; VAR_2 < vst->duration; VAR_2++) {", "pos = next_pos;", "if (VAR_2 == vst->duration - 1) {", "next_pos = bink->file_size;", "VAR_3 = 0;", "} else {", "next_pos = avio_rl32(pb);", "VAR_3 = pos & 1;", "}", "pos &= ~1;", "next_pos &= ~1;", "if (next_pos <= pos) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid frame index table\\n\");", "return AVERROR(EIO);", "}", "av_add_index_entry(vst, pos, VAR_2, next_pos - pos, 0,\nVAR_3 ? AVINDEX_KEYFRAME : 0);", "}", "avio_skip(pb, 4);", "bink->current_track = -1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ] ]
4,965
static int ftp_status(FTPContext *s, char **line, const int response_codes[]) { int err, i, result = 0, pref_code_found = 0, wait_count = 100; char buf[CONTROL_BUFFER_SIZE]; /* Set blocking mode */ s->conn_control_block_flag = 0; for (;;) { if ((err = ftp_get_line(s, buf, sizeof(buf))) < 0) { if (err == AVERROR_EXIT) { if (!pref_code_found && wait_count--) { av_usleep(10000); continue; } } return result; } av_log(s, AV_LOG_DEBUG, "%s\n", buf); if (!pref_code_found) { if (strlen(buf) < 3) continue; err = 0; for (i = 0; i < 3; ++i) { if (buf[i] < '0' || buf[i] > '9') continue; err *= 10; err += buf[i] - '0'; } for (i = 0; response_codes[i]; ++i) { if (err == response_codes[i]) { /* first code received. Now get all lines in non blocking mode */ s->conn_control_block_flag = 1; pref_code_found = 1; result = err; if (line) *line = av_strdup(buf); break; } } } } return result; }
false
FFmpeg
247e658784ead984f96021acb9c95052ba599f26
static int ftp_status(FTPContext *s, char **line, const int response_codes[]) { int err, i, result = 0, pref_code_found = 0, wait_count = 100; char buf[CONTROL_BUFFER_SIZE]; s->conn_control_block_flag = 0; for (;;) { if ((err = ftp_get_line(s, buf, sizeof(buf))) < 0) { if (err == AVERROR_EXIT) { if (!pref_code_found && wait_count--) { av_usleep(10000); continue; } } return result; } av_log(s, AV_LOG_DEBUG, "%s\n", buf); if (!pref_code_found) { if (strlen(buf) < 3) continue; err = 0; for (i = 0; i < 3; ++i) { if (buf[i] < '0' || buf[i] > '9') continue; err *= 10; err += buf[i] - '0'; } for (i = 0; response_codes[i]; ++i) { if (err == response_codes[i]) { s->conn_control_block_flag = 1; pref_code_found = 1; result = err; if (line) *line = av_strdup(buf); break; } } } } return result; }
{ "code": [], "line_no": [] }
static int FUNC_0(FTPContext *VAR_0, char **VAR_1, const int VAR_2[]) { int VAR_3, VAR_4, VAR_5 = 0, VAR_6 = 0, VAR_7 = 100; char VAR_8[CONTROL_BUFFER_SIZE]; VAR_0->conn_control_block_flag = 0; for (;;) { if ((VAR_3 = ftp_get_line(VAR_0, VAR_8, sizeof(VAR_8))) < 0) { if (VAR_3 == AVERROR_EXIT) { if (!VAR_6 && VAR_7--) { av_usleep(10000); continue; } } return VAR_5; } av_log(VAR_0, AV_LOG_DEBUG, "%VAR_0\n", VAR_8); if (!VAR_6) { if (strlen(VAR_8) < 3) continue; VAR_3 = 0; for (VAR_4 = 0; VAR_4 < 3; ++VAR_4) { if (VAR_8[VAR_4] < '0' || VAR_8[VAR_4] > '9') continue; VAR_3 *= 10; VAR_3 += VAR_8[VAR_4] - '0'; } for (VAR_4 = 0; VAR_2[VAR_4]; ++VAR_4) { if (VAR_3 == VAR_2[VAR_4]) { VAR_0->conn_control_block_flag = 1; VAR_6 = 1; VAR_5 = VAR_3; if (VAR_1) *VAR_1 = av_strdup(VAR_8); break; } } } } return VAR_5; }
[ "static int FUNC_0(FTPContext *VAR_0, char **VAR_1, const int VAR_2[])\n{", "int VAR_3, VAR_4, VAR_5 = 0, VAR_6 = 0, VAR_7 = 100;", "char VAR_8[CONTROL_BUFFER_SIZE];", "VAR_0->conn_control_block_flag = 0;", "for (;;) {", "if ((VAR_3 = ftp_get_line(VAR_0, VAR_8, sizeof(VAR_8))) < 0) {", "if (VAR_3 == AVERROR_EXIT) {", "if (!VAR_6 && VAR_7--) {", "av_usleep(10000);", "continue;", "}", "}", "return VAR_5;", "}", "av_log(VAR_0, AV_LOG_DEBUG, \"%VAR_0\\n\", VAR_8);", "if (!VAR_6) {", "if (strlen(VAR_8) < 3)\ncontinue;", "VAR_3 = 0;", "for (VAR_4 = 0; VAR_4 < 3; ++VAR_4) {", "if (VAR_8[VAR_4] < '0' || VAR_8[VAR_4] > '9')\ncontinue;", "VAR_3 *= 10;", "VAR_3 += VAR_8[VAR_4] - '0';", "}", "for (VAR_4 = 0; VAR_2[VAR_4]; ++VAR_4) {", "if (VAR_3 == VAR_2[VAR_4]) {", "VAR_0->conn_control_block_flag = 1;", "VAR_6 = 1;", "VAR_5 = VAR_3;", "if (VAR_1)\n*VAR_1 = av_strdup(VAR_8);", "break;", "}", "}", "}", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
4,966
static void unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) { int i, j, k; int coding_mode; int motion_x[6]; int motion_y[6]; int last_motion_x = 0; int last_motion_y = 0; int prior_last_motion_x = 0; int prior_last_motion_y = 0; int current_macroblock; int current_fragment; debug_vp3(" vp3: unpacking motion vectors\n"); if (s->keyframe) { debug_vp3(" keyframe-- there are no motion vectors\n"); } else { memset(motion_x, 0, 6 * sizeof(int)); memset(motion_y, 0, 6 * sizeof(int)); /* coding mode 0 is the VLC scheme; 1 is the fixed code scheme */ coding_mode = get_bits(gb, 1); debug_vectors(" using %s scheme for unpacking motion vectors\n", (coding_mode == 0) ? "VLC" : "fixed-length"); /* iterate through all of the macroblocks that contain 1 or more * coded fragments */ for (i = 0; i < s->u_superblock_start; i++) { for (j = 0; j < 4; j++) { current_macroblock = s->superblock_macroblocks[i * 4 + j]; if ((current_macroblock == -1) || (!s->macroblock_coded[current_macroblock])) continue; current_fragment = s->macroblock_fragments[current_macroblock * 6]; switch (s->all_fragments[current_fragment].coding_method) { case MODE_INTER_PLUS_MV: case MODE_GOLDEN_MV: /* all 6 fragments use the same motion vector */ if (coding_mode == 0) { motion_x[0] = get_motion_vector_vlc(gb); motion_y[0] = get_motion_vector_vlc(gb); } else { motion_x[0] = get_motion_vector_fixed(gb); motion_y[0] = get_motion_vector_fixed(gb); } for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } /* vector maintenance, only on MODE_INTER_PLUS_MV */ if (s->all_fragments[current_fragment].coding_method == MODE_INTER_PLUS_MV) { prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[0]; last_motion_y = motion_y[0]; } break; case MODE_INTER_FOURMV: /* fetch 4 vectors from the bitstream, one for each * Y fragment, then average for the C fragment vectors */ motion_x[4] = motion_y[4] = 0; for (k = 0; k < 4; k++) { if (coding_mode == 0) { motion_x[k] = get_motion_vector_vlc(gb); motion_y[k] = get_motion_vector_vlc(gb); } else { motion_x[k] = get_motion_vector_fixed(gb); motion_y[k] = get_motion_vector_fixed(gb); } motion_x[4] += motion_x[k]; motion_y[4] += motion_y[k]; } if (motion_x[4] >= 0) motion_x[4] = (motion_x[4] + 2) / 4; else motion_x[4] = (motion_x[4] - 2) / 4; motion_x[5] = motion_x[4]; if (motion_y[4] >= 0) motion_y[4] = (motion_y[4] + 2) / 4; else motion_y[4] = (motion_y[4] - 2) / 4; motion_y[5] = motion_y[4]; /* vector maintenance; vector[3] is treated as the * last vector in this case */ prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[3]; last_motion_y = motion_y[3]; break; case MODE_INTER_LAST_MV: /* all 6 fragments use the last motion vector */ motion_x[0] = last_motion_x; motion_y[0] = last_motion_y; for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } /* no vector maintenance (last vector remains the * last vector) */ break; case MODE_INTER_PRIOR_LAST: /* all 6 fragments use the motion vector prior to the * last motion vector */ motion_x[0] = prior_last_motion_x; motion_y[0] = prior_last_motion_y; for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } /* vector maintenance */ prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[0]; last_motion_y = motion_y[0]; break; default: /* covers intra, inter without MV, golden without MV */ memset(motion_x, 0, 6 * sizeof(int)); memset(motion_y, 0, 6 * sizeof(int)); /* no vector maintenance */ break; } /* assign the motion vectors to the correct fragments */ debug_vectors(" vectors for macroblock starting @ fragment %d (coding method %d):\n", current_fragment, s->all_fragments[current_fragment].coding_method); for (k = 0; k < 6; k++) { current_fragment = s->macroblock_fragments[current_macroblock * 6 + k]; s->all_fragments[current_fragment].motion_halfpel_index = adjust_vector(&motion_x[k], &motion_y[k], ((k == 4) || (k == 5))); s->all_fragments[current_fragment].motion_x = motion_x[k]; s->all_fragments[current_fragment].motion_y = motion_y[k]; debug_vectors(" vector %d: fragment %d = (%d, %d), index %d\n", k, current_fragment, motion_x[k], motion_y[k], s->all_fragments[current_fragment].motion_halfpel_index); } } } } }
false
FFmpeg
892fc83e88a20f9543c6c5be3626712be7a2e6f2
static void unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) { int i, j, k; int coding_mode; int motion_x[6]; int motion_y[6]; int last_motion_x = 0; int last_motion_y = 0; int prior_last_motion_x = 0; int prior_last_motion_y = 0; int current_macroblock; int current_fragment; debug_vp3(" vp3: unpacking motion vectors\n"); if (s->keyframe) { debug_vp3(" keyframe-- there are no motion vectors\n"); } else { memset(motion_x, 0, 6 * sizeof(int)); memset(motion_y, 0, 6 * sizeof(int)); coding_mode = get_bits(gb, 1); debug_vectors(" using %s scheme for unpacking motion vectors\n", (coding_mode == 0) ? "VLC" : "fixed-length"); for (i = 0; i < s->u_superblock_start; i++) { for (j = 0; j < 4; j++) { current_macroblock = s->superblock_macroblocks[i * 4 + j]; if ((current_macroblock == -1) || (!s->macroblock_coded[current_macroblock])) continue; current_fragment = s->macroblock_fragments[current_macroblock * 6]; switch (s->all_fragments[current_fragment].coding_method) { case MODE_INTER_PLUS_MV: case MODE_GOLDEN_MV: if (coding_mode == 0) { motion_x[0] = get_motion_vector_vlc(gb); motion_y[0] = get_motion_vector_vlc(gb); } else { motion_x[0] = get_motion_vector_fixed(gb); motion_y[0] = get_motion_vector_fixed(gb); } for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } if (s->all_fragments[current_fragment].coding_method == MODE_INTER_PLUS_MV) { prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[0]; last_motion_y = motion_y[0]; } break; case MODE_INTER_FOURMV: motion_x[4] = motion_y[4] = 0; for (k = 0; k < 4; k++) { if (coding_mode == 0) { motion_x[k] = get_motion_vector_vlc(gb); motion_y[k] = get_motion_vector_vlc(gb); } else { motion_x[k] = get_motion_vector_fixed(gb); motion_y[k] = get_motion_vector_fixed(gb); } motion_x[4] += motion_x[k]; motion_y[4] += motion_y[k]; } if (motion_x[4] >= 0) motion_x[4] = (motion_x[4] + 2) / 4; else motion_x[4] = (motion_x[4] - 2) / 4; motion_x[5] = motion_x[4]; if (motion_y[4] >= 0) motion_y[4] = (motion_y[4] + 2) / 4; else motion_y[4] = (motion_y[4] - 2) / 4; motion_y[5] = motion_y[4]; prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[3]; last_motion_y = motion_y[3]; break; case MODE_INTER_LAST_MV: motion_x[0] = last_motion_x; motion_y[0] = last_motion_y; for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } break; case MODE_INTER_PRIOR_LAST: motion_x[0] = prior_last_motion_x; motion_y[0] = prior_last_motion_y; for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[0]; last_motion_y = motion_y[0]; break; default: memset(motion_x, 0, 6 * sizeof(int)); memset(motion_y, 0, 6 * sizeof(int)); break; } debug_vectors(" vectors for macroblock starting @ fragment %d (coding method %d):\n", current_fragment, s->all_fragments[current_fragment].coding_method); for (k = 0; k < 6; k++) { current_fragment = s->macroblock_fragments[current_macroblock * 6 + k]; s->all_fragments[current_fragment].motion_halfpel_index = adjust_vector(&motion_x[k], &motion_y[k], ((k == 4) || (k == 5))); s->all_fragments[current_fragment].motion_x = motion_x[k]; s->all_fragments[current_fragment].motion_y = motion_y[k]; debug_vectors(" vector %d: fragment %d = (%d, %d), index %d\n", k, current_fragment, motion_x[k], motion_y[k], s->all_fragments[current_fragment].motion_halfpel_index); } } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1) { int VAR_2, VAR_3, VAR_4; int VAR_5; int VAR_6[6]; int VAR_7[6]; int VAR_8 = 0; int VAR_9 = 0; int VAR_10 = 0; int VAR_11 = 0; int VAR_12; int VAR_13; debug_vp3(" vp3: unpacking motion vectors\n"); if (VAR_0->keyframe) { debug_vp3(" keyframe-- there are no motion vectors\n"); } else { memset(VAR_6, 0, 6 * sizeof(int)); memset(VAR_7, 0, 6 * sizeof(int)); VAR_5 = get_bits(VAR_1, 1); debug_vectors(" using %VAR_0 scheme for unpacking motion vectors\n", (VAR_5 == 0) ? "VLC" : "fixed-length"); for (VAR_2 = 0; VAR_2 < VAR_0->u_superblock_start; VAR_2++) { for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { VAR_12 = VAR_0->superblock_macroblocks[VAR_2 * 4 + VAR_3]; if ((VAR_12 == -1) || (!VAR_0->macroblock_coded[VAR_12])) continue; VAR_13 = VAR_0->macroblock_fragments[VAR_12 * 6]; switch (VAR_0->all_fragments[VAR_13].coding_method) { case MODE_INTER_PLUS_MV: case MODE_GOLDEN_MV: if (VAR_5 == 0) { VAR_6[0] = get_motion_vector_vlc(VAR_1); VAR_7[0] = get_motion_vector_vlc(VAR_1); } else { VAR_6[0] = get_motion_vector_fixed(VAR_1); VAR_7[0] = get_motion_vector_fixed(VAR_1); } for (VAR_4 = 1; VAR_4 < 6; VAR_4++) { VAR_6[VAR_4] = VAR_6[0]; VAR_7[VAR_4] = VAR_7[0]; } if (VAR_0->all_fragments[VAR_13].coding_method == MODE_INTER_PLUS_MV) { VAR_10 = VAR_8; VAR_11 = VAR_9; VAR_8 = VAR_6[0]; VAR_9 = VAR_7[0]; } break; case MODE_INTER_FOURMV: VAR_6[4] = VAR_7[4] = 0; for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { if (VAR_5 == 0) { VAR_6[VAR_4] = get_motion_vector_vlc(VAR_1); VAR_7[VAR_4] = get_motion_vector_vlc(VAR_1); } else { VAR_6[VAR_4] = get_motion_vector_fixed(VAR_1); VAR_7[VAR_4] = get_motion_vector_fixed(VAR_1); } VAR_6[4] += VAR_6[VAR_4]; VAR_7[4] += VAR_7[VAR_4]; } if (VAR_6[4] >= 0) VAR_6[4] = (VAR_6[4] + 2) / 4; else VAR_6[4] = (VAR_6[4] - 2) / 4; VAR_6[5] = VAR_6[4]; if (VAR_7[4] >= 0) VAR_7[4] = (VAR_7[4] + 2) / 4; else VAR_7[4] = (VAR_7[4] - 2) / 4; VAR_7[5] = VAR_7[4]; VAR_10 = VAR_8; VAR_11 = VAR_9; VAR_8 = VAR_6[3]; VAR_9 = VAR_7[3]; break; case MODE_INTER_LAST_MV: VAR_6[0] = VAR_8; VAR_7[0] = VAR_9; for (VAR_4 = 1; VAR_4 < 6; VAR_4++) { VAR_6[VAR_4] = VAR_6[0]; VAR_7[VAR_4] = VAR_7[0]; } break; case MODE_INTER_PRIOR_LAST: VAR_6[0] = VAR_10; VAR_7[0] = VAR_11; for (VAR_4 = 1; VAR_4 < 6; VAR_4++) { VAR_6[VAR_4] = VAR_6[0]; VAR_7[VAR_4] = VAR_7[0]; } VAR_10 = VAR_8; VAR_11 = VAR_9; VAR_8 = VAR_6[0]; VAR_9 = VAR_7[0]; break; default: memset(VAR_6, 0, 6 * sizeof(int)); memset(VAR_7, 0, 6 * sizeof(int)); break; } debug_vectors(" vectors for macroblock starting @ fragment %d (coding method %d):\n", VAR_13, VAR_0->all_fragments[VAR_13].coding_method); for (VAR_4 = 0; VAR_4 < 6; VAR_4++) { VAR_13 = VAR_0->macroblock_fragments[VAR_12 * 6 + VAR_4]; VAR_0->all_fragments[VAR_13].motion_halfpel_index = adjust_vector(&VAR_6[VAR_4], &VAR_7[VAR_4], ((VAR_4 == 4) || (VAR_4 == 5))); VAR_0->all_fragments[VAR_13].VAR_6 = VAR_6[VAR_4]; VAR_0->all_fragments[VAR_13].VAR_7 = VAR_7[VAR_4]; debug_vectors(" vector %d: fragment %d = (%d, %d), index %d\n", VAR_4, VAR_13, VAR_6[VAR_4], VAR_7[VAR_4], VAR_0->all_fragments[VAR_13].motion_halfpel_index); } } } } }
[ "static void FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "int VAR_5;", "int VAR_6[6];", "int VAR_7[6];", "int VAR_8 = 0;", "int VAR_9 = 0;", "int VAR_10 = 0;", "int VAR_11 = 0;", "int VAR_12;", "int VAR_13;", "debug_vp3(\" vp3: unpacking motion vectors\\n\");", "if (VAR_0->keyframe) {", "debug_vp3(\" keyframe-- there are no motion vectors\\n\");", "} else {", "memset(VAR_6, 0, 6 * sizeof(int));", "memset(VAR_7, 0, 6 * sizeof(int));", "VAR_5 = get_bits(VAR_1, 1);", "debug_vectors(\" using %VAR_0 scheme for unpacking motion vectors\\n\",\n(VAR_5 == 0) ? \"VLC\" : \"fixed-length\");", "for (VAR_2 = 0; VAR_2 < VAR_0->u_superblock_start; VAR_2++) {", "for (VAR_3 = 0; VAR_3 < 4; VAR_3++) {", "VAR_12 = VAR_0->superblock_macroblocks[VAR_2 * 4 + VAR_3];", "if ((VAR_12 == -1) ||\n(!VAR_0->macroblock_coded[VAR_12]))\ncontinue;", "VAR_13 = VAR_0->macroblock_fragments[VAR_12 * 6];", "switch (VAR_0->all_fragments[VAR_13].coding_method) {", "case MODE_INTER_PLUS_MV:\ncase MODE_GOLDEN_MV:\nif (VAR_5 == 0) {", "VAR_6[0] = get_motion_vector_vlc(VAR_1);", "VAR_7[0] = get_motion_vector_vlc(VAR_1);", "} else {", "VAR_6[0] = get_motion_vector_fixed(VAR_1);", "VAR_7[0] = get_motion_vector_fixed(VAR_1);", "}", "for (VAR_4 = 1; VAR_4 < 6; VAR_4++) {", "VAR_6[VAR_4] = VAR_6[0];", "VAR_7[VAR_4] = VAR_7[0];", "}", "if (VAR_0->all_fragments[VAR_13].coding_method ==\nMODE_INTER_PLUS_MV) {", "VAR_10 = VAR_8;", "VAR_11 = VAR_9;", "VAR_8 = VAR_6[0];", "VAR_9 = VAR_7[0];", "}", "break;", "case MODE_INTER_FOURMV:\nVAR_6[4] = VAR_7[4] = 0;", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++) {", "if (VAR_5 == 0) {", "VAR_6[VAR_4] = get_motion_vector_vlc(VAR_1);", "VAR_7[VAR_4] = get_motion_vector_vlc(VAR_1);", "} else {", "VAR_6[VAR_4] = get_motion_vector_fixed(VAR_1);", "VAR_7[VAR_4] = get_motion_vector_fixed(VAR_1);", "}", "VAR_6[4] += VAR_6[VAR_4];", "VAR_7[4] += VAR_7[VAR_4];", "}", "if (VAR_6[4] >= 0)\nVAR_6[4] = (VAR_6[4] + 2) / 4;", "else\nVAR_6[4] = (VAR_6[4] - 2) / 4;", "VAR_6[5] = VAR_6[4];", "if (VAR_7[4] >= 0)\nVAR_7[4] = (VAR_7[4] + 2) / 4;", "else\nVAR_7[4] = (VAR_7[4] - 2) / 4;", "VAR_7[5] = VAR_7[4];", "VAR_10 = VAR_8;", "VAR_11 = VAR_9;", "VAR_8 = VAR_6[3];", "VAR_9 = VAR_7[3];", "break;", "case MODE_INTER_LAST_MV:\nVAR_6[0] = VAR_8;", "VAR_7[0] = VAR_9;", "for (VAR_4 = 1; VAR_4 < 6; VAR_4++) {", "VAR_6[VAR_4] = VAR_6[0];", "VAR_7[VAR_4] = VAR_7[0];", "}", "break;", "case MODE_INTER_PRIOR_LAST:\nVAR_6[0] = VAR_10;", "VAR_7[0] = VAR_11;", "for (VAR_4 = 1; VAR_4 < 6; VAR_4++) {", "VAR_6[VAR_4] = VAR_6[0];", "VAR_7[VAR_4] = VAR_7[0];", "}", "VAR_10 = VAR_8;", "VAR_11 = VAR_9;", "VAR_8 = VAR_6[0];", "VAR_9 = VAR_7[0];", "break;", "default:\nmemset(VAR_6, 0, 6 * sizeof(int));", "memset(VAR_7, 0, 6 * sizeof(int));", "break;", "}", "debug_vectors(\" vectors for macroblock starting @ fragment %d (coding method %d):\\n\",\nVAR_13,\nVAR_0->all_fragments[VAR_13].coding_method);", "for (VAR_4 = 0; VAR_4 < 6; VAR_4++) {", "VAR_13 =\nVAR_0->macroblock_fragments[VAR_12 * 6 + VAR_4];", "VAR_0->all_fragments[VAR_13].motion_halfpel_index =\nadjust_vector(&VAR_6[VAR_4], &VAR_7[VAR_4],\n((VAR_4 == 4) || (VAR_4 == 5)));", "VAR_0->all_fragments[VAR_13].VAR_6 = VAR_6[VAR_4];", "VAR_0->all_fragments[VAR_13].VAR_7 = VAR_7[VAR_4];", "debug_vectors(\" vector %d: fragment %d = (%d, %d), index %d\\n\",\nVAR_4, VAR_13, VAR_6[VAR_4], VAR_7[VAR_4],\nVAR_0->all_fragments[VAR_13].motion_halfpel_index);", "}", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 51 ], [ 53, 55 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 79 ], [ 81 ], [ 85, 87, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 179, 181 ], [ 183, 185 ], [ 187 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 229 ], [ 233, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267, 271 ], [ 273 ], [ 279 ], [ 281 ], [ 287, 289, 291 ], [ 293 ], [ 295, 297 ], [ 299, 301, 303 ], [ 305 ], [ 307 ], [ 309, 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ] ]
4,967
static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame) { int x, y; unsigned char opcode; int ret; GetBitContext gb; bytestream2_skip(&s->stream_ptr, 14); /* data starts 14 bytes in */ if (!s->is_16bpp) { /* this is PAL8, so make the palette available */ memcpy(frame->data[1], s->pal, AVPALETTE_SIZE); s->stride = frame->linesize[0]; } else { s->stride = frame->linesize[0] >> 1; s->mv_ptr = s->stream_ptr; bytestream2_skip(&s->mv_ptr, bytestream2_get_le16(&s->stream_ptr)); } s->line_inc = s->stride - 8; s->upper_motion_limit_offset = (s->avctx->height - 8) * frame->linesize[0] + (s->avctx->width - 8) * (1 + s->is_16bpp); init_get_bits(&gb, s->decoding_map, s->decoding_map_size * 8); for (y = 0; y < s->avctx->height; y += 8) { for (x = 0; x < s->avctx->width; x += 8) { if (get_bits_left(&gb) < 4) return; opcode = get_bits(&gb, 4); ff_tlog(s->avctx, " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n", x, y, opcode, bytestream2_tell(&s->stream_ptr)); if (!s->is_16bpp) { s->pixel_ptr = frame->data[0] + x + y*frame->linesize[0]; ret = ipvideo_decode_block[opcode](s, frame); } else { s->pixel_ptr = frame->data[0] + x*2 + y*frame->linesize[0]; ret = ipvideo_decode_block16[opcode](s, frame); } if (ret != 0) { av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %d, @ block (%d, %d)\n", s->avctx->frame_number, x, y); return; } } } if (bytestream2_get_bytes_left(&s->stream_ptr) > 1) { av_log(s->avctx, AV_LOG_DEBUG, "decode finished with %d bytes left over\n", bytestream2_get_bytes_left(&s->stream_ptr)); } }
false
FFmpeg
19f6fd199e46c5a56f09a768ece4246b48bd86dd
static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame) { int x, y; unsigned char opcode; int ret; GetBitContext gb; bytestream2_skip(&s->stream_ptr, 14); if (!s->is_16bpp) { memcpy(frame->data[1], s->pal, AVPALETTE_SIZE); s->stride = frame->linesize[0]; } else { s->stride = frame->linesize[0] >> 1; s->mv_ptr = s->stream_ptr; bytestream2_skip(&s->mv_ptr, bytestream2_get_le16(&s->stream_ptr)); } s->line_inc = s->stride - 8; s->upper_motion_limit_offset = (s->avctx->height - 8) * frame->linesize[0] + (s->avctx->width - 8) * (1 + s->is_16bpp); init_get_bits(&gb, s->decoding_map, s->decoding_map_size * 8); for (y = 0; y < s->avctx->height; y += 8) { for (x = 0; x < s->avctx->width; x += 8) { if (get_bits_left(&gb) < 4) return; opcode = get_bits(&gb, 4); ff_tlog(s->avctx, " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n", x, y, opcode, bytestream2_tell(&s->stream_ptr)); if (!s->is_16bpp) { s->pixel_ptr = frame->data[0] + x + y*frame->linesize[0]; ret = ipvideo_decode_block[opcode](s, frame); } else { s->pixel_ptr = frame->data[0] + x*2 + y*frame->linesize[0]; ret = ipvideo_decode_block16[opcode](s, frame); } if (ret != 0) { av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %d, @ block (%d, %d)\n", s->avctx->frame_number, x, y); return; } } } if (bytestream2_get_bytes_left(&s->stream_ptr) > 1) { av_log(s->avctx, AV_LOG_DEBUG, "decode finished with %d bytes left over\n", bytestream2_get_bytes_left(&s->stream_ptr)); } }
{ "code": [], "line_no": [] }
static void FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1) { int VAR_2, VAR_3; unsigned char VAR_4; int VAR_5; GetBitContext gb; bytestream2_skip(&VAR_0->stream_ptr, 14); if (!VAR_0->is_16bpp) { memcpy(VAR_1->data[1], VAR_0->pal, AVPALETTE_SIZE); VAR_0->stride = VAR_1->linesize[0]; } else { VAR_0->stride = VAR_1->linesize[0] >> 1; VAR_0->mv_ptr = VAR_0->stream_ptr; bytestream2_skip(&VAR_0->mv_ptr, bytestream2_get_le16(&VAR_0->stream_ptr)); } VAR_0->line_inc = VAR_0->stride - 8; VAR_0->upper_motion_limit_offset = (VAR_0->avctx->height - 8) * VAR_1->linesize[0] + (VAR_0->avctx->width - 8) * (1 + VAR_0->is_16bpp); init_get_bits(&gb, VAR_0->decoding_map, VAR_0->decoding_map_size * 8); for (VAR_3 = 0; VAR_3 < VAR_0->avctx->height; VAR_3 += 8) { for (VAR_2 = 0; VAR_2 < VAR_0->avctx->width; VAR_2 += 8) { if (get_bits_left(&gb) < 4) return; VAR_4 = get_bits(&gb, 4); ff_tlog(VAR_0->avctx, " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n", VAR_2, VAR_3, VAR_4, bytestream2_tell(&VAR_0->stream_ptr)); if (!VAR_0->is_16bpp) { VAR_0->pixel_ptr = VAR_1->data[0] + VAR_2 + VAR_3*VAR_1->linesize[0]; VAR_5 = ipvideo_decode_block[VAR_4](VAR_0, VAR_1); } else { VAR_0->pixel_ptr = VAR_1->data[0] + VAR_2*2 + VAR_3*VAR_1->linesize[0]; VAR_5 = ipvideo_decode_block16[VAR_4](VAR_0, VAR_1); } if (VAR_5 != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "decode problem on VAR_1 %d, @ block (%d, %d)\n", VAR_0->avctx->frame_number, VAR_2, VAR_3); return; } } } if (bytestream2_get_bytes_left(&VAR_0->stream_ptr) > 1) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "decode finished with %d bytes left over\n", bytestream2_get_bytes_left(&VAR_0->stream_ptr)); } }
[ "static void FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1)\n{", "int VAR_2, VAR_3;", "unsigned char VAR_4;", "int VAR_5;", "GetBitContext gb;", "bytestream2_skip(&VAR_0->stream_ptr, 14);", "if (!VAR_0->is_16bpp) {", "memcpy(VAR_1->data[1], VAR_0->pal, AVPALETTE_SIZE);", "VAR_0->stride = VAR_1->linesize[0];", "} else {", "VAR_0->stride = VAR_1->linesize[0] >> 1;", "VAR_0->mv_ptr = VAR_0->stream_ptr;", "bytestream2_skip(&VAR_0->mv_ptr, bytestream2_get_le16(&VAR_0->stream_ptr));", "}", "VAR_0->line_inc = VAR_0->stride - 8;", "VAR_0->upper_motion_limit_offset = (VAR_0->avctx->height - 8) * VAR_1->linesize[0]\n+ (VAR_0->avctx->width - 8) * (1 + VAR_0->is_16bpp);", "init_get_bits(&gb, VAR_0->decoding_map, VAR_0->decoding_map_size * 8);", "for (VAR_3 = 0; VAR_3 < VAR_0->avctx->height; VAR_3 += 8) {", "for (VAR_2 = 0; VAR_2 < VAR_0->avctx->width; VAR_2 += 8) {", "if (get_bits_left(&gb) < 4)\nreturn;", "VAR_4 = get_bits(&gb, 4);", "ff_tlog(VAR_0->avctx,\n\" block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\\n\",\nVAR_2, VAR_3, VAR_4, bytestream2_tell(&VAR_0->stream_ptr));", "if (!VAR_0->is_16bpp) {", "VAR_0->pixel_ptr = VAR_1->data[0] + VAR_2\n+ VAR_3*VAR_1->linesize[0];", "VAR_5 = ipvideo_decode_block[VAR_4](VAR_0, VAR_1);", "} else {", "VAR_0->pixel_ptr = VAR_1->data[0] + VAR_2*2\n+ VAR_3*VAR_1->linesize[0];", "VAR_5 = ipvideo_decode_block16[VAR_4](VAR_0, VAR_1);", "}", "if (VAR_5 != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"decode problem on VAR_1 %d, @ block (%d, %d)\\n\",\nVAR_0->avctx->frame_number, VAR_2, VAR_3);", "return;", "}", "}", "}", "if (bytestream2_get_bytes_left(&VAR_0->stream_ptr) > 1) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"decode finished with %d bytes left over\\n\",\nbytestream2_get_bytes_left(&VAR_0->stream_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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 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 ] ]
4,968
static int cinvideo_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; CinVideoContext *cin = avctx->priv_data; int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size, res = 0; palette_type = buf[0]; palette_colors_count = AV_RL16(buf+1); bitmap_frame_type = buf[3]; buf += 4; bitmap_frame_size = buf_size - 4; /* handle palette */ if (bitmap_frame_size < palette_colors_count * (3 + (palette_type != 0))) return AVERROR_INVALIDDATA; if (palette_type == 0) { if (palette_colors_count > 256) return AVERROR_INVALIDDATA; for (i = 0; i < palette_colors_count; ++i) { cin->palette[i] = 0xFFU << 24 | bytestream_get_le24(&buf); bitmap_frame_size -= 3; } } else { for (i = 0; i < palette_colors_count; ++i) { cin->palette[buf[0]] = 0xFFU << 24 | AV_RL24(buf+1); buf += 4; bitmap_frame_size -= 4; } } /* note: the decoding routines below assumes that surface.width = surface.pitch */ switch (bitmap_frame_type) { case 9: cin_decode_rle(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 34: cin_decode_rle(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 35: cin_decode_huffman(buf, bitmap_frame_size, cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 36: bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size, cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 37: cin_decode_huffman(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 38: res = cin_decode_lzss(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); if (res < 0) return res; break; case 39: res = cin_decode_lzss(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); if (res < 0) return res; cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; } cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if ((res = avctx->reget_buffer(avctx, &cin->frame))) { av_log(cin->avctx, AV_LOG_ERROR, "failed to allocate a frame\n"); return res; } memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette)); cin->frame.palette_has_changed = 1; for (y = 0; y < cin->avctx->height; ++y) memcpy(cin->frame.data[0] + (cin->avctx->height - 1 - y) * cin->frame.linesize[0], cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width, cin->avctx->width); FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]); *data_size = sizeof(AVFrame); *(AVFrame *)data = cin->frame; return buf_size; }
false
FFmpeg
7faa17764ad8aa9919125834b97e7fb574af90d4
static int cinvideo_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; CinVideoContext *cin = avctx->priv_data; int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size, res = 0; palette_type = buf[0]; palette_colors_count = AV_RL16(buf+1); bitmap_frame_type = buf[3]; buf += 4; bitmap_frame_size = buf_size - 4; if (bitmap_frame_size < palette_colors_count * (3 + (palette_type != 0))) return AVERROR_INVALIDDATA; if (palette_type == 0) { if (palette_colors_count > 256) return AVERROR_INVALIDDATA; for (i = 0; i < palette_colors_count; ++i) { cin->palette[i] = 0xFFU << 24 | bytestream_get_le24(&buf); bitmap_frame_size -= 3; } } else { for (i = 0; i < palette_colors_count; ++i) { cin->palette[buf[0]] = 0xFFU << 24 | AV_RL24(buf+1); buf += 4; bitmap_frame_size -= 4; } } switch (bitmap_frame_type) { case 9: cin_decode_rle(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 34: cin_decode_rle(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 35: cin_decode_huffman(buf, bitmap_frame_size, cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 36: bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size, cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 37: cin_decode_huffman(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 38: res = cin_decode_lzss(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); if (res < 0) return res; break; case 39: res = cin_decode_lzss(buf, bitmap_frame_size, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); if (res < 0) return res; cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; } cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if ((res = avctx->reget_buffer(avctx, &cin->frame))) { av_log(cin->avctx, AV_LOG_ERROR, "failed to allocate a frame\n"); return res; } memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette)); cin->frame.palette_has_changed = 1; for (y = 0; y < cin->avctx->height; ++y) memcpy(cin->frame.data[0] + (cin->avctx->height - 1 - y) * cin->frame.linesize[0], cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width, cin->avctx->width); FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]); *data_size = sizeof(AVFrame); *(AVFrame *)data = cin->frame; 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; CinVideoContext *cin = VAR_0->priv_data; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12 = 0; VAR_8 = VAR_4[0]; VAR_9 = AV_RL16(VAR_4+1); VAR_10 = VAR_4[3]; VAR_4 += 4; VAR_11 = VAR_5 - 4; if (VAR_11 < VAR_9 * (3 + (VAR_8 != 0))) return AVERROR_INVALIDDATA; if (VAR_8 == 0) { if (VAR_9 > 256) return AVERROR_INVALIDDATA; for (VAR_6 = 0; VAR_6 < VAR_9; ++VAR_6) { cin->palette[VAR_6] = 0xFFU << 24 | bytestream_get_le24(&VAR_4); VAR_11 -= 3; } } else { for (VAR_6 = 0; VAR_6 < VAR_9; ++VAR_6) { cin->palette[VAR_4[0]] = 0xFFU << 24 | AV_RL24(VAR_4+1); VAR_4 += 4; VAR_11 -= 4; } } switch (VAR_10) { case 9: cin_decode_rle(VAR_4, VAR_11, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 34: cin_decode_rle(VAR_4, VAR_11, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 35: cin_decode_huffman(VAR_4, VAR_11, cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], VAR_11, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 36: VAR_11 = cin_decode_huffman(VAR_4, VAR_11, cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], VAR_11, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 37: cin_decode_huffman(VAR_4, VAR_11, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; case 38: VAR_12 = cin_decode_lzss(VAR_4, VAR_11, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); if (VAR_12 < 0) return VAR_12; break; case 39: VAR_12 = cin_decode_lzss(VAR_4, VAR_11, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); if (VAR_12 < 0) return VAR_12; cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); break; } cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if ((VAR_12 = VAR_0->reget_buffer(VAR_0, &cin->frame))) { av_log(cin->VAR_0, AV_LOG_ERROR, "failed to allocate a frame\n"); return VAR_12; } memcpy(cin->frame.VAR_1[1], cin->palette, sizeof(cin->palette)); cin->frame.palette_has_changed = 1; for (VAR_7 = 0; VAR_7 < cin->VAR_0->height; ++VAR_7) memcpy(cin->frame.VAR_1[0] + (cin->VAR_0->height - 1 - VAR_7) * cin->frame.linesize[0], cin->bitmap_table[CIN_CUR_BMP] + VAR_7 * cin->VAR_0->width, cin->VAR_0->width); FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]); *VAR_2 = sizeof(AVFrame); *(AVFrame *)VAR_1 = cin->frame; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "CinVideoContext *cin = VAR_0->priv_data;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12 = 0;", "VAR_8 = VAR_4[0];", "VAR_9 = AV_RL16(VAR_4+1);", "VAR_10 = VAR_4[3];", "VAR_4 += 4;", "VAR_11 = VAR_5 - 4;", "if (VAR_11 < VAR_9 * (3 + (VAR_8 != 0)))\nreturn AVERROR_INVALIDDATA;", "if (VAR_8 == 0) {", "if (VAR_9 > 256)\nreturn AVERROR_INVALIDDATA;", "for (VAR_6 = 0; VAR_6 < VAR_9; ++VAR_6) {", "cin->palette[VAR_6] = 0xFFU << 24 | bytestream_get_le24(&VAR_4);", "VAR_11 -= 3;", "}", "} else {", "for (VAR_6 = 0; VAR_6 < VAR_9; ++VAR_6) {", "cin->palette[VAR_4[0]] = 0xFFU << 24 | AV_RL24(VAR_4+1);", "VAR_4 += 4;", "VAR_11 -= 4;", "}", "}", "switch (VAR_10) {", "case 9:\ncin_decode_rle(VAR_4, VAR_11,\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "break;", "case 34:\ncin_decode_rle(VAR_4, VAR_11,\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "break;", "case 35:\ncin_decode_huffman(VAR_4, VAR_11,\ncin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);", "cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], VAR_11,\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "break;", "case 36:\nVAR_11 = cin_decode_huffman(VAR_4, VAR_11,\ncin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);", "cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], VAR_11,\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "break;", "case 37:\ncin_decode_huffman(VAR_4, VAR_11,\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "break;", "case 38:\nVAR_12 = cin_decode_lzss(VAR_4, VAR_11,\ncin->bitmap_table[CIN_CUR_BMP],\ncin->bitmap_size);", "if (VAR_12 < 0)\nreturn VAR_12;", "break;", "case 39:\nVAR_12 = cin_decode_lzss(VAR_4, VAR_11,\ncin->bitmap_table[CIN_CUR_BMP],\ncin->bitmap_size);", "if (VAR_12 < 0)\nreturn VAR_12;", "cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],\ncin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);", "break;", "}", "cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;", "if ((VAR_12 = VAR_0->reget_buffer(VAR_0, &cin->frame))) {", "av_log(cin->VAR_0, AV_LOG_ERROR, \"failed to allocate a frame\\n\");", "return VAR_12;", "}", "memcpy(cin->frame.VAR_1[1], cin->palette, sizeof(cin->palette));", "cin->frame.palette_has_changed = 1;", "for (VAR_7 = 0; VAR_7 < cin->VAR_0->height; ++VAR_7)", "memcpy(cin->frame.VAR_1[0] + (cin->VAR_0->height - 1 - VAR_7) * cin->frame.linesize[0],\ncin->bitmap_table[CIN_CUR_BMP] + VAR_7 * cin->VAR_0->width,\ncin->VAR_0->width);", "FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]);", "*VAR_2 = sizeof(AVFrame);", "*(AVFrame *)VAR_1 = cin->frame;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81, 83, 85 ], [ 87, 89 ], [ 91 ], [ 93, 95, 97 ], [ 99, 101 ], [ 103 ], [ 105, 107, 109 ], [ 111, 113 ], [ 115, 117 ], [ 119 ], [ 121, 123, 125 ], [ 127 ], [ 129, 131, 133, 135 ], [ 137, 139 ], [ 141 ], [ 143, 145, 147, 149 ], [ 151, 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185, 187 ], [ 191 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ] ]
4,969
static void check_threshold_8(void){ LOCAL_ALIGNED_32(uint8_t, in , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, min , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, max , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_ref , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_new , [WIDTH_PADDED]); ptrdiff_t line_size = WIDTH_PADDED; int w = WIDTH; ThresholdContext s; s.depth = 8; ff_threshold_init(&s); declare_func(void, const uint8_t *in, const uint8_t *threshold, const uint8_t *min, const uint8_t *max, uint8_t *out, ptrdiff_t ilinesize, ptrdiff_t tlinesize, ptrdiff_t flinesize, ptrdiff_t slinesize, ptrdiff_t olinesize, int w, int h); memset(in, 0, WIDTH_PADDED); memset(threshold, 0, WIDTH_PADDED); memset(min, 0, WIDTH_PADDED); memset(max, 0, WIDTH_PADDED); memset(out_ref, 0, WIDTH_PADDED); memset(out_new, 0, WIDTH_PADDED); randomize_buffers(in, WIDTH); randomize_buffers(threshold, WIDTH); randomize_buffers(min, WIDTH); randomize_buffers(max, WIDTH); if (check_func(s.threshold, "threshold8")) { call_ref(in, threshold, min, max, out_ref, line_size, line_size, line_size, line_size, line_size, w, 1); call_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1); if (memcmp(out_ref, out_new, w)) fail(); bench_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1); } }
false
FFmpeg
1b324700e3a1cb7894bfbd76f5591cf643dc0371
static void check_threshold_8(void){ LOCAL_ALIGNED_32(uint8_t, in , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, min , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, max , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_ref , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_new , [WIDTH_PADDED]); ptrdiff_t line_size = WIDTH_PADDED; int w = WIDTH; ThresholdContext s; s.depth = 8; ff_threshold_init(&s); declare_func(void, const uint8_t *in, const uint8_t *threshold, const uint8_t *min, const uint8_t *max, uint8_t *out, ptrdiff_t ilinesize, ptrdiff_t tlinesize, ptrdiff_t flinesize, ptrdiff_t slinesize, ptrdiff_t olinesize, int w, int h); memset(in, 0, WIDTH_PADDED); memset(threshold, 0, WIDTH_PADDED); memset(min, 0, WIDTH_PADDED); memset(max, 0, WIDTH_PADDED); memset(out_ref, 0, WIDTH_PADDED); memset(out_new, 0, WIDTH_PADDED); randomize_buffers(in, WIDTH); randomize_buffers(threshold, WIDTH); randomize_buffers(min, WIDTH); randomize_buffers(max, WIDTH); if (check_func(s.threshold, "threshold8")) { call_ref(in, threshold, min, max, out_ref, line_size, line_size, line_size, line_size, line_size, w, 1); call_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1); if (memcmp(out_ref, out_new, w)) fail(); bench_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void){ LOCAL_ALIGNED_32(uint8_t, in , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, min , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, max , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_ref , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_new , [WIDTH_PADDED]); ptrdiff_t line_size = WIDTH_PADDED; int VAR_0 = WIDTH; ThresholdContext s; s.depth = 8; ff_threshold_init(&s); declare_func(void, const uint8_t *in, const uint8_t *threshold, const uint8_t *min, const uint8_t *max, uint8_t *out, ptrdiff_t ilinesize, ptrdiff_t tlinesize, ptrdiff_t flinesize, ptrdiff_t slinesize, ptrdiff_t olinesize, int VAR_0, int h); memset(in, 0, WIDTH_PADDED); memset(threshold, 0, WIDTH_PADDED); memset(min, 0, WIDTH_PADDED); memset(max, 0, WIDTH_PADDED); memset(out_ref, 0, WIDTH_PADDED); memset(out_new, 0, WIDTH_PADDED); randomize_buffers(in, WIDTH); randomize_buffers(threshold, WIDTH); randomize_buffers(min, WIDTH); randomize_buffers(max, WIDTH); if (check_func(s.threshold, "threshold8")) { call_ref(in, threshold, min, max, out_ref, line_size, line_size, line_size, line_size, line_size, VAR_0, 1); call_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, VAR_0, 1); if (memcmp(out_ref, out_new, VAR_0)) fail(); bench_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, VAR_0, 1); } }
[ "static void FUNC_0(void){", "LOCAL_ALIGNED_32(uint8_t, in , [WIDTH_PADDED]);", "LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]);", "LOCAL_ALIGNED_32(uint8_t, min , [WIDTH_PADDED]);", "LOCAL_ALIGNED_32(uint8_t, max , [WIDTH_PADDED]);", "LOCAL_ALIGNED_32(uint8_t, out_ref , [WIDTH_PADDED]);", "LOCAL_ALIGNED_32(uint8_t, out_new , [WIDTH_PADDED]);", "ptrdiff_t line_size = WIDTH_PADDED;", "int VAR_0 = WIDTH;", "ThresholdContext s;", "s.depth = 8;", "ff_threshold_init(&s);", "declare_func(void, const uint8_t *in, const uint8_t *threshold,\nconst uint8_t *min, const uint8_t *max, uint8_t *out,\nptrdiff_t ilinesize, ptrdiff_t tlinesize,\nptrdiff_t flinesize, ptrdiff_t slinesize,\nptrdiff_t olinesize, int VAR_0, int h);", "memset(in, 0, WIDTH_PADDED);", "memset(threshold, 0, WIDTH_PADDED);", "memset(min, 0, WIDTH_PADDED);", "memset(max, 0, WIDTH_PADDED);", "memset(out_ref, 0, WIDTH_PADDED);", "memset(out_new, 0, WIDTH_PADDED);", "randomize_buffers(in, WIDTH);", "randomize_buffers(threshold, WIDTH);", "randomize_buffers(min, WIDTH);", "randomize_buffers(max, WIDTH);", "if (check_func(s.threshold, \"threshold8\")) {", "call_ref(in, threshold, min, max, out_ref, line_size, line_size, line_size, line_size, line_size, VAR_0, 1);", "call_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, VAR_0, 1);", "if (memcmp(out_ref, out_new, VAR_0))\nfail();", "bench_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, VAR_0, 1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31, 33, 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ] ]
4,970
static void gen_rp_realize(DeviceState *dev, Error **errp) { PCIDevice *d = PCI_DEVICE(dev); GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d); PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d); rpc->parent_realize(dev, errp); int rc = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve, grp->io_reserve, grp->mem_reserve, grp->pref32_reserve, grp->pref64_reserve, errp); if (rc < 0) { rpc->parent_class.exit(d); return; } if (!grp->io_reserve) { pci_word_test_and_clear_mask(d->wmask + PCI_COMMAND, PCI_COMMAND_IO); d->wmask[PCI_IO_BASE] = 0; d->wmask[PCI_IO_LIMIT] = 0; } }
true
qemu
fced4d00e68e7559c73746d963265f7fd0b6abf9
static void gen_rp_realize(DeviceState *dev, Error **errp) { PCIDevice *d = PCI_DEVICE(dev); GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d); PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d); rpc->parent_realize(dev, errp); int rc = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve, grp->io_reserve, grp->mem_reserve, grp->pref32_reserve, grp->pref64_reserve, errp); if (rc < 0) { rpc->parent_class.exit(d); return; } if (!grp->io_reserve) { pci_word_test_and_clear_mask(d->wmask + PCI_COMMAND, PCI_COMMAND_IO); d->wmask[PCI_IO_BASE] = 0; d->wmask[PCI_IO_LIMIT] = 0; } }
{ "code": [ " rpc->parent_realize(dev, errp);" ], "line_no": [ 13 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { PCIDevice *d = PCI_DEVICE(VAR_0); GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d); PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d); rpc->parent_realize(VAR_0, VAR_1); int VAR_2 = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve, grp->io_reserve, grp->mem_reserve, grp->pref32_reserve, grp->pref64_reserve, VAR_1); if (VAR_2 < 0) { rpc->parent_class.exit(d); return; } if (!grp->io_reserve) { pci_word_test_and_clear_mask(d->wmask + PCI_COMMAND, PCI_COMMAND_IO); d->wmask[PCI_IO_BASE] = 0; d->wmask[PCI_IO_LIMIT] = 0; } }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "PCIDevice *d = PCI_DEVICE(VAR_0);", "GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);", "PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);", "rpc->parent_realize(VAR_0, VAR_1);", "int VAR_2 = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve,\ngrp->io_reserve, grp->mem_reserve, grp->pref32_reserve,\ngrp->pref64_reserve, VAR_1);", "if (VAR_2 < 0) {", "rpc->parent_class.exit(d);", "return;", "}", "if (!grp->io_reserve) {", "pci_word_test_and_clear_mask(d->wmask + PCI_COMMAND,\nPCI_COMMAND_IO);", "d->wmask[PCI_IO_BASE] = 0;", "d->wmask[PCI_IO_LIMIT] = 0;", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
4,972
static bool megasas_use_msi(MegasasState *s) { return s->msi != ON_OFF_AUTO_OFF; }
true
qemu
afea4e1410654154018587dd35c1b250ba4d8ec4
static bool megasas_use_msi(MegasasState *s) { return s->msi != ON_OFF_AUTO_OFF; }
{ "code": [ "static bool megasas_use_msi(MegasasState *s)", " return s->msi != ON_OFF_AUTO_OFF;" ], "line_no": [ 1, 5 ] }
static bool FUNC_0(MegasasState *s) { return s->msi != ON_OFF_AUTO_OFF; }
[ "static bool FUNC_0(MegasasState *s)\n{", "return s->msi != ON_OFF_AUTO_OFF;", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,974
int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun) { int64_t nb_sectors; uint32_t lba; uint32_t len; int cmdlen; int is_write; s->command = buf[0]; s->tag = tag; s->sector_count = 0; s->buf_pos = 0; s->buf_len = 0; is_write = 0; DPRINTF("Command: 0x%02x", buf[0]); switch (s->command >> 5) { case 0: lba = buf[3] | (buf[2] << 8) | ((buf[1] & 0x1f) << 16); len = buf[4]; cmdlen = 6; break; case 1: case 2: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[8] | (buf[7] << 8); cmdlen = 10; break; case 4: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[13] | (buf[12] << 8) | (buf[11] << 16) | (buf[10] << 24); cmdlen = 16; break; case 5: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[9] | (buf[8] << 8) | (buf[7] << 16) | (buf[6] << 24); cmdlen = 12; break; default: BADF("Unsupported command length, command %x\n", s->command); goto fail; } #ifdef DEBUG_SCSI { int i; for (i = 1; i < cmdlen; i++) { printf(" 0x%02x", buf[i]); } printf("\n"); } #endif if (lun || buf[1] >> 5) { /* Only LUN 0 supported. */ DPRINTF("Unimplemented LUN %d\n", lun ? lun : buf[1] >> 5); goto fail; } switch (s->command) { case 0x0: DPRINTF("Test Unit Ready\n"); break; case 0x03: DPRINTF("Request Sense (len %d)\n", len); if (len < 4) goto fail; memset(buf, 0, 4); s->buf[0] = 0xf0; s->buf[1] = 0; s->buf[2] = s->sense; s->buf_len = 4; break; case 0x12: DPRINTF("Inquiry (len %d)\n", len); if (len < 36) { BADF("Inquiry buffer too small (%d)\n", len); } memset(s->buf, 0, 36); if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { s->buf[0] = 5; s->buf[1] = 0x80; memcpy(&s->buf[16], "QEMU CD-ROM ", 16); } else { s->buf[0] = 0; memcpy(&s->buf[16], "QEMU HARDDISK ", 16); } memcpy(&s->buf[8], "QEMU ", 8); memcpy(&s->buf[32], QEMU_VERSION, 4); /* Identify device as SCSI-3 rev 1. Some later commands are also implemented. */ s->buf[2] = 3; s->buf[3] = 2; /* Format 2 */ s->buf[4] = 32; s->buf_len = 36; break; case 0x16: DPRINTF("Reserve(6)\n"); if (buf[1] & 1) goto fail; break; case 0x17: DPRINTF("Release(6)\n"); if (buf[1] & 1) goto fail; break; case 0x1a: case 0x5a: { char *p; int page; page = buf[2] & 0x3f; DPRINTF("Mode Sense (page %d, len %d)\n", page, len); p = s->buf; memset(p, 0, 4); s->buf[1] = 0; /* Default media type. */ s->buf[3] = 0; /* Block descriptor length. */ if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { s->buf[2] = 0x80; /* Readonly. */ } p += 4; if ((page == 8 || page == 0x3f)) { /* Caching page. */ p[0] = 8; p[1] = 0x12; p[2] = 4; /* WCE */ p += 19; } if ((page == 0x3f || page == 0x2a) && (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM)) { /* CD Capabilities and Mechanical Status page. */ p[0] = 0x2a; p[1] = 0x14; p[2] = 3; // CD-R & CD-RW read p[3] = 0; // Writing not supported p[4] = 0x7f; /* Audio, composite, digital out, mode 2 form 1&2, multi session */ p[5] = 0xff; /* CD DA, DA accurate, RW supported, RW corrected, C2 errors, ISRC, UPC, Bar code */ p[6] = 0x2d | (bdrv_is_locked(s->bdrv)? 2 : 0); /* Locking supported, jumper present, eject, tray */ p[7] = 0; /* no volume & mute control, no changer */ p[8] = (50 * 176) >> 8; // 50x read speed p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; // No volume p[11] = 0 & 0xff; p[12] = 2048 >> 8; // 2M buffer p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; // 16x read speed current p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; // 16x write speed p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; // 16x write speed current p[21] = (16 * 176) & 0xff; p += 21; } s->buf_len = p - s->buf; s->buf[0] = s->buf_len - 4; if (s->buf_len > len) s->buf_len = len; } break; case 0x1b: DPRINTF("Start Stop Unit\n"); break; case 0x1e: DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3); bdrv_set_locked(s->bdrv, buf[4] & 1); break; case 0x25: DPRINTF("Read Capacity\n"); /* The normal LEN field for this command is zero. */ memset(s->buf, 0, 8); bdrv_get_geometry(s->bdrv, &nb_sectors); s->buf[0] = (nb_sectors >> 24) & 0xff; s->buf[1] = (nb_sectors >> 16) & 0xff; s->buf[2] = (nb_sectors >> 8) & 0xff; s->buf[3] = nb_sectors & 0xff; s->buf[4] = 0; s->buf[5] = 0; s->buf[6] = s->cluster_size * 2; s->buf[7] = 0; s->buf_len = 8; break; case 0x08: case 0x28: DPRINTF("Read (sector %d, count %d)\n", lba, len); s->sector = lba * s->cluster_size; s->sector_count = len * s->cluster_size; break; case 0x0a: case 0x2a: DPRINTF("Write (sector %d, count %d)\n", lba, len); s->sector = lba * s->cluster_size; s->sector_count = len * s->cluster_size; is_write = 1; break; case 0x35: DPRINTF("Syncronise cache (sector %d, count %d)\n", lba, len); bdrv_flush(s->bdrv); break; case 0x43: { int start_track, format, msf, toclen; msf = buf[1] & 2; format = buf[2] & 0xf; start_track = buf[6]; bdrv_get_geometry(s->bdrv, &nb_sectors); DPRINTF("Read TOC (track %d format %d msf %d)\n", start_track, format, msf >> 1); switch(format) { case 0: toclen = cdrom_read_toc(nb_sectors, s->buf, msf, start_track); break; case 1: /* multi session : only a single session defined */ toclen = 12; memset(s->buf, 0, 12); s->buf[1] = 0x0a; s->buf[2] = 0x01; s->buf[3] = 0x01; break; case 2: toclen = cdrom_read_toc_raw(nb_sectors, s->buf, msf, start_track); break; default: goto error_cmd; } if (toclen > 0) { if (len > toclen) len = toclen; s->buf_len = len; break; } error_cmd: DPRINTF("Read TOC error\n"); goto fail; } case 0x46: DPRINTF("Get Configuration (rt %d, maxlen %d)\n", buf[1] & 3, len); memset(s->buf, 0, 8); /* ??? This shoud probably return much more information. For now just return the basic header indicating the CD-ROM profile. */ s->buf[7] = 8; // CD-ROM s->buf_len = 8; break; case 0x56: DPRINTF("Reserve(10)\n"); if (buf[1] & 3) goto fail; break; case 0x57: DPRINTF("Release(10)\n"); if (buf[1] & 3) goto fail; break; case 0xa0: DPRINTF("Report LUNs (len %d)\n", len); if (len < 16) goto fail; memset(s->buf, 0, 16); s->buf[3] = 8; s->buf_len = 16; break; default: DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]); fail: scsi_command_complete(s, SENSE_ILLEGAL_REQUEST); return 0; } if (s->sector_count == 0 && s->buf_len == 0) { scsi_command_complete(s, SENSE_NO_SENSE); } len = s->sector_count * 512 + s->buf_len; return is_write ? -len : len; }
true
qemu
51c1ebb1bc2642296379a8db1ba9dfb4f78a2f80
int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun) { int64_t nb_sectors; uint32_t lba; uint32_t len; int cmdlen; int is_write; s->command = buf[0]; s->tag = tag; s->sector_count = 0; s->buf_pos = 0; s->buf_len = 0; is_write = 0; DPRINTF("Command: 0x%02x", buf[0]); switch (s->command >> 5) { case 0: lba = buf[3] | (buf[2] << 8) | ((buf[1] & 0x1f) << 16); len = buf[4]; cmdlen = 6; break; case 1: case 2: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[8] | (buf[7] << 8); cmdlen = 10; break; case 4: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[13] | (buf[12] << 8) | (buf[11] << 16) | (buf[10] << 24); cmdlen = 16; break; case 5: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[9] | (buf[8] << 8) | (buf[7] << 16) | (buf[6] << 24); cmdlen = 12; break; default: BADF("Unsupported command length, command %x\n", s->command); goto fail; } #ifdef DEBUG_SCSI { int i; for (i = 1; i < cmdlen; i++) { printf(" 0x%02x", buf[i]); } printf("\n"); } #endif if (lun || buf[1] >> 5) { DPRINTF("Unimplemented LUN %d\n", lun ? lun : buf[1] >> 5); goto fail; } switch (s->command) { case 0x0: DPRINTF("Test Unit Ready\n"); break; case 0x03: DPRINTF("Request Sense (len %d)\n", len); if (len < 4) goto fail; memset(buf, 0, 4); s->buf[0] = 0xf0; s->buf[1] = 0; s->buf[2] = s->sense; s->buf_len = 4; break; case 0x12: DPRINTF("Inquiry (len %d)\n", len); if (len < 36) { BADF("Inquiry buffer too small (%d)\n", len); } memset(s->buf, 0, 36); if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { s->buf[0] = 5; s->buf[1] = 0x80; memcpy(&s->buf[16], "QEMU CD-ROM ", 16); } else { s->buf[0] = 0; memcpy(&s->buf[16], "QEMU HARDDISK ", 16); } memcpy(&s->buf[8], "QEMU ", 8); memcpy(&s->buf[32], QEMU_VERSION, 4); s->buf[2] = 3; s->buf[3] = 2; s->buf[4] = 32; s->buf_len = 36; break; case 0x16: DPRINTF("Reserve(6)\n"); if (buf[1] & 1) goto fail; break; case 0x17: DPRINTF("Release(6)\n"); if (buf[1] & 1) goto fail; break; case 0x1a: case 0x5a: { char *p; int page; page = buf[2] & 0x3f; DPRINTF("Mode Sense (page %d, len %d)\n", page, len); p = s->buf; memset(p, 0, 4); s->buf[1] = 0; s->buf[3] = 0; if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { s->buf[2] = 0x80; } p += 4; if ((page == 8 || page == 0x3f)) { p[0] = 8; p[1] = 0x12; p[2] = 4; p += 19; } if ((page == 0x3f || page == 0x2a) && (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM)) { p[0] = 0x2a; p[1] = 0x14; p[2] = 3; p[3] = 0; p[4] = 0x7f; p[5] = 0xff; p[6] = 0x2d | (bdrv_is_locked(s->bdrv)? 2 : 0); p[7] = 0; p[8] = (50 * 176) >> 8; p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; p[11] = 0 & 0xff; p[12] = 2048 >> 8; p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; current p[21] = (16 * 176) & 0xff; p += 21; } s->buf_len = p - s->buf; s->buf[0] = s->buf_len - 4; if (s->buf_len > len) s->buf_len = len; } break; case 0x1b: DPRINTF("Start Stop Unit\n"); break; case 0x1e: DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3); bdrv_set_locked(s->bdrv, buf[4] & 1); break; case 0x25: DPRINTF("Read Capacity\n"); memset(s->buf, 0, 8); bdrv_get_geometry(s->bdrv, &nb_sectors); s->buf[0] = (nb_sectors >> 24) & 0xff; s->buf[1] = (nb_sectors >> 16) & 0xff; s->buf[2] = (nb_sectors >> 8) & 0xff; s->buf[3] = nb_sectors & 0xff; s->buf[4] = 0; s->buf[5] = 0; s->buf[6] = s->cluster_size * 2; s->buf[7] = 0; s->buf_len = 8; break; case 0x08: case 0x28: DPRINTF("Read (sector %d, count %d)\n", lba, len); s->sector = lba * s->cluster_size; s->sector_count = len * s->cluster_size; break; case 0x0a: case 0x2a: DPRINTF("Write (sector %d, count %d)\n", lba, len); s->sector = lba * s->cluster_size; s->sector_count = len * s->cluster_size; is_write = 1; break; case 0x35: DPRINTF("Syncronise cache (sector %d, count %d)\n", lba, len); bdrv_flush(s->bdrv); break; case 0x43: { int start_track, format, msf, toclen; msf = buf[1] & 2; format = buf[2] & 0xf; start_track = buf[6]; bdrv_get_geometry(s->bdrv, &nb_sectors); DPRINTF("Read TOC (track %d format %d msf %d)\n", start_track, format, msf >> 1); switch(format) { case 0: toclen = cdrom_read_toc(nb_sectors, s->buf, msf, start_track); break; case 1: toclen = 12; memset(s->buf, 0, 12); s->buf[1] = 0x0a; s->buf[2] = 0x01; s->buf[3] = 0x01; break; case 2: toclen = cdrom_read_toc_raw(nb_sectors, s->buf, msf, start_track); break; default: goto error_cmd; } if (toclen > 0) { if (len > toclen) len = toclen; s->buf_len = len; break; } error_cmd: DPRINTF("Read TOC error\n"); goto fail; } case 0x46: DPRINTF("Get Configuration (rt %d, maxlen %d)\n", buf[1] & 3, len); memset(s->buf, 0, 8); s->buf[7] = 8; s->buf_len = 8; break; case 0x56: DPRINTF("Reserve(10)\n"); if (buf[1] & 3) goto fail; break; case 0x57: DPRINTF("Release(10)\n"); if (buf[1] & 3) goto fail; break; case 0xa0: DPRINTF("Report LUNs (len %d)\n", len); if (len < 16) goto fail; memset(s->buf, 0, 16); s->buf[3] = 8; s->buf_len = 16; break; default: DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]); fail: scsi_command_complete(s, SENSE_ILLEGAL_REQUEST); return 0; } if (s->sector_count == 0 && s->buf_len == 0) { scsi_command_complete(s, SENSE_NO_SENSE); } len = s->sector_count * 512 + s->buf_len; return is_write ? -len : len; }
{ "code": [ "\ts->buf[0] = (nb_sectors >> 24) & 0xff;", "\ts->buf[1] = (nb_sectors >> 16) & 0xff;", "\ts->buf[2] = (nb_sectors >> 8) & 0xff;", "\ts->buf[3] = nb_sectors & 0xff;", "\ts->buf[4] = 0;", "\ts->buf[5] = 0;", " s->buf[6] = s->cluster_size * 2;", "\ts->buf[7] = 0;", "\ts->buf_len = 8;" ], "line_no": [ 347, 349, 351, 353, 355, 357, 359, 361, 363 ] }
int32_t FUNC_0(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun) { int64_t nb_sectors; uint32_t lba; uint32_t len; int VAR_0; int VAR_1; s->command = buf[0]; s->tag = tag; s->sector_count = 0; s->buf_pos = 0; s->buf_len = 0; VAR_1 = 0; DPRINTF("Command: 0x%02x", buf[0]); switch (s->command >> 5) { case 0: lba = buf[3] | (buf[2] << 8) | ((buf[1] & 0x1f) << 16); len = buf[4]; VAR_0 = 6; break; case 1: case 2: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[8] | (buf[7] << 8); VAR_0 = 10; break; case 4: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[13] | (buf[12] << 8) | (buf[11] << 16) | (buf[10] << 24); VAR_0 = 16; break; case 5: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[9] | (buf[8] << 8) | (buf[7] << 16) | (buf[6] << 24); VAR_0 = 12; break; default: BADF("Unsupported command length, command %x\n", s->command); goto fail; } #ifdef DEBUG_SCSI { int i; for (i = 1; i < VAR_0; i++) { printf(" 0x%02x", buf[i]); } printf("\n"); } #endif if (lun || buf[1] >> 5) { DPRINTF("Unimplemented LUN %d\n", lun ? lun : buf[1] >> 5); goto fail; } switch (s->command) { case 0x0: DPRINTF("Test Unit Ready\n"); break; case 0x03: DPRINTF("Request Sense (len %d)\n", len); if (len < 4) goto fail; memset(buf, 0, 4); s->buf[0] = 0xf0; s->buf[1] = 0; s->buf[2] = s->sense; s->buf_len = 4; break; case 0x12: DPRINTF("Inquiry (len %d)\n", len); if (len < 36) { BADF("Inquiry buffer too small (%d)\n", len); } memset(s->buf, 0, 36); if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { s->buf[0] = 5; s->buf[1] = 0x80; memcpy(&s->buf[16], "QEMU CD-ROM ", 16); } else { s->buf[0] = 0; memcpy(&s->buf[16], "QEMU HARDDISK ", 16); } memcpy(&s->buf[8], "QEMU ", 8); memcpy(&s->buf[32], QEMU_VERSION, 4); s->buf[2] = 3; s->buf[3] = 2; s->buf[4] = 32; s->buf_len = 36; break; case 0x16: DPRINTF("Reserve(6)\n"); if (buf[1] & 1) goto fail; break; case 0x17: DPRINTF("Release(6)\n"); if (buf[1] & 1) goto fail; break; case 0x1a: case 0x5a: { char *VAR_2; int VAR_3; VAR_3 = buf[2] & 0x3f; DPRINTF("Mode Sense (VAR_3 %d, len %d)\n", VAR_3, len); VAR_2 = s->buf; memset(VAR_2, 0, 4); s->buf[1] = 0; s->buf[3] = 0; if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { s->buf[2] = 0x80; } VAR_2 += 4; if ((VAR_3 == 8 || VAR_3 == 0x3f)) { VAR_2[0] = 8; VAR_2[1] = 0x12; VAR_2[2] = 4; VAR_2 += 19; } if ((VAR_3 == 0x3f || VAR_3 == 0x2a) && (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM)) { VAR_2[0] = 0x2a; VAR_2[1] = 0x14; VAR_2[2] = 3; VAR_2[3] = 0; VAR_2[4] = 0x7f; VAR_2[5] = 0xff; VAR_2[6] = 0x2d | (bdrv_is_locked(s->bdrv)? 2 : 0); VAR_2[7] = 0; VAR_2[8] = (50 * 176) >> 8; VAR_2[9] = (50 * 176) & 0xff; VAR_2[10] = 0 >> 8; VAR_2[11] = 0 & 0xff; VAR_2[12] = 2048 >> 8; VAR_2[13] = 2048 & 0xff; VAR_2[14] = (16 * 176) >> 8; VAR_2[15] = (16 * 176) & 0xff; VAR_2[18] = (16 * 176) >> 8; VAR_2[19] = (16 * 176) & 0xff; VAR_2[20] = (16 * 176) >> 8; current VAR_2[21] = (16 * 176) & 0xff; VAR_2 += 21; } s->buf_len = VAR_2 - s->buf; s->buf[0] = s->buf_len - 4; if (s->buf_len > len) s->buf_len = len; } break; case 0x1b: DPRINTF("Start Stop Unit\n"); break; case 0x1e: DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3); bdrv_set_locked(s->bdrv, buf[4] & 1); break; case 0x25: DPRINTF("Read Capacity\n"); memset(s->buf, 0, 8); bdrv_get_geometry(s->bdrv, &nb_sectors); s->buf[0] = (nb_sectors >> 24) & 0xff; s->buf[1] = (nb_sectors >> 16) & 0xff; s->buf[2] = (nb_sectors >> 8) & 0xff; s->buf[3] = nb_sectors & 0xff; s->buf[4] = 0; s->buf[5] = 0; s->buf[6] = s->cluster_size * 2; s->buf[7] = 0; s->buf_len = 8; break; case 0x08: case 0x28: DPRINTF("Read (sector %d, count %d)\n", lba, len); s->sector = lba * s->cluster_size; s->sector_count = len * s->cluster_size; break; case 0x0a: case 0x2a: DPRINTF("Write (sector %d, count %d)\n", lba, len); s->sector = lba * s->cluster_size; s->sector_count = len * s->cluster_size; VAR_1 = 1; break; case 0x35: DPRINTF("Syncronise cache (sector %d, count %d)\n", lba, len); bdrv_flush(s->bdrv); break; case 0x43: { int VAR_4, VAR_5, VAR_6, VAR_7; VAR_6 = buf[1] & 2; VAR_5 = buf[2] & 0xf; VAR_4 = buf[6]; bdrv_get_geometry(s->bdrv, &nb_sectors); DPRINTF("Read TOC (track %d VAR_5 %d VAR_6 %d)\n", VAR_4, VAR_5, VAR_6 >> 1); switch(VAR_5) { case 0: VAR_7 = cdrom_read_toc(nb_sectors, s->buf, VAR_6, VAR_4); break; case 1: VAR_7 = 12; memset(s->buf, 0, 12); s->buf[1] = 0x0a; s->buf[2] = 0x01; s->buf[3] = 0x01; break; case 2: VAR_7 = cdrom_read_toc_raw(nb_sectors, s->buf, VAR_6, VAR_4); break; default: goto error_cmd; } if (VAR_7 > 0) { if (len > VAR_7) len = VAR_7; s->buf_len = len; break; } error_cmd: DPRINTF("Read TOC error\n"); goto fail; } case 0x46: DPRINTF("Get Configuration (rt %d, maxlen %d)\n", buf[1] & 3, len); memset(s->buf, 0, 8); s->buf[7] = 8; s->buf_len = 8; break; case 0x56: DPRINTF("Reserve(10)\n"); if (buf[1] & 3) goto fail; break; case 0x57: DPRINTF("Release(10)\n"); if (buf[1] & 3) goto fail; break; case 0xa0: DPRINTF("Report LUNs (len %d)\n", len); if (len < 16) goto fail; memset(s->buf, 0, 16); s->buf[3] = 8; s->buf_len = 16; break; default: DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]); fail: scsi_command_complete(s, SENSE_ILLEGAL_REQUEST); return 0; } if (s->sector_count == 0 && s->buf_len == 0) { scsi_command_complete(s, SENSE_NO_SENSE); } len = s->sector_count * 512 + s->buf_len; return VAR_1 ? -len : len; }
[ "int32_t FUNC_0(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun)\n{", "int64_t nb_sectors;", "uint32_t lba;", "uint32_t len;", "int VAR_0;", "int VAR_1;", "s->command = buf[0];", "s->tag = tag;", "s->sector_count = 0;", "s->buf_pos = 0;", "s->buf_len = 0;", "VAR_1 = 0;", "DPRINTF(\"Command: 0x%02x\", buf[0]);", "switch (s->command >> 5) {", "case 0:\nlba = buf[3] | (buf[2] << 8) | ((buf[1] & 0x1f) << 16);", "len = buf[4];", "VAR_0 = 6;", "break;", "case 1:\ncase 2:\nlba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24);", "len = buf[8] | (buf[7] << 8);", "VAR_0 = 10;", "break;", "case 4:\nlba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24);", "len = buf[13] | (buf[12] << 8) | (buf[11] << 16) | (buf[10] << 24);", "VAR_0 = 16;", "break;", "case 5:\nlba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24);", "len = buf[9] | (buf[8] << 8) | (buf[7] << 16) | (buf[6] << 24);", "VAR_0 = 12;", "break;", "default:\nBADF(\"Unsupported command length, command %x\\n\", s->command);", "goto fail;", "}", "#ifdef DEBUG_SCSI\n{", "int i;", "for (i = 1; i < VAR_0; i++) {", "printf(\" 0x%02x\", buf[i]);", "}", "printf(\"\\n\");", "}", "#endif\nif (lun || buf[1] >> 5) {", "DPRINTF(\"Unimplemented LUN %d\\n\", lun ? lun : buf[1] >> 5);", "goto fail;", "}", "switch (s->command) {", "case 0x0:\nDPRINTF(\"Test Unit Ready\\n\");", "break;", "case 0x03:\nDPRINTF(\"Request Sense (len %d)\\n\", len);", "if (len < 4)\ngoto fail;", "memset(buf, 0, 4);", "s->buf[0] = 0xf0;", "s->buf[1] = 0;", "s->buf[2] = s->sense;", "s->buf_len = 4;", "break;", "case 0x12:\nDPRINTF(\"Inquiry (len %d)\\n\", len);", "if (len < 36) {", "BADF(\"Inquiry buffer too small (%d)\\n\", len);", "}", "memset(s->buf, 0, 36);", "if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) {", "s->buf[0] = 5;", "s->buf[1] = 0x80;", "memcpy(&s->buf[16], \"QEMU CD-ROM \", 16);", "} else {", "s->buf[0] = 0;", "memcpy(&s->buf[16], \"QEMU HARDDISK \", 16);", "}", "memcpy(&s->buf[8], \"QEMU \", 8);", "memcpy(&s->buf[32], QEMU_VERSION, 4);", "s->buf[2] = 3;", "s->buf[3] = 2;", "s->buf[4] = 32;", "s->buf_len = 36;", "break;", "case 0x16:\nDPRINTF(\"Reserve(6)\\n\");", "if (buf[1] & 1)\ngoto fail;", "break;", "case 0x17:\nDPRINTF(\"Release(6)\\n\");", "if (buf[1] & 1)\ngoto fail;", "break;", "case 0x1a:\ncase 0x5a:\n{", "char *VAR_2;", "int VAR_3;", "VAR_3 = buf[2] & 0x3f;", "DPRINTF(\"Mode Sense (VAR_3 %d, len %d)\\n\", VAR_3, len);", "VAR_2 = s->buf;", "memset(VAR_2, 0, 4);", "s->buf[1] = 0;", "s->buf[3] = 0;", "if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) {", "s->buf[2] = 0x80;", "}", "VAR_2 += 4;", "if ((VAR_3 == 8 || VAR_3 == 0x3f)) {", "VAR_2[0] = 8;", "VAR_2[1] = 0x12;", "VAR_2[2] = 4;", "VAR_2 += 19;", "}", "if ((VAR_3 == 0x3f || VAR_3 == 0x2a)\n&& (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM)) {", "VAR_2[0] = 0x2a;", "VAR_2[1] = 0x14;", "VAR_2[2] = 3;", "VAR_2[3] = 0;", "VAR_2[4] = 0x7f;", "VAR_2[5] = 0xff;", "VAR_2[6] = 0x2d | (bdrv_is_locked(s->bdrv)? 2 : 0);", "VAR_2[7] = 0;", "VAR_2[8] = (50 * 176) >> 8;", "VAR_2[9] = (50 * 176) & 0xff;", "VAR_2[10] = 0 >> 8;", "VAR_2[11] = 0 & 0xff;", "VAR_2[12] = 2048 >> 8;", "VAR_2[13] = 2048 & 0xff;", "VAR_2[14] = (16 * 176) >> 8;", "VAR_2[15] = (16 * 176) & 0xff;", "VAR_2[18] = (16 * 176) >> 8;", "VAR_2[19] = (16 * 176) & 0xff;", "VAR_2[20] = (16 * 176) >> 8; current", "VAR_2[21] = (16 * 176) & 0xff;", "VAR_2 += 21;", "}", "s->buf_len = VAR_2 - s->buf;", "s->buf[0] = s->buf_len - 4;", "if (s->buf_len > len)\ns->buf_len = len;", "}", "break;", "case 0x1b:\nDPRINTF(\"Start Stop Unit\\n\");", "break;", "case 0x1e:\nDPRINTF(\"Prevent Allow Medium Removal (prevent = %d)\\n\", buf[4] & 3);", "bdrv_set_locked(s->bdrv, buf[4] & 1);", "break;", "case 0x25:\nDPRINTF(\"Read Capacity\\n\");", "memset(s->buf, 0, 8);", "bdrv_get_geometry(s->bdrv, &nb_sectors);", "s->buf[0] = (nb_sectors >> 24) & 0xff;", "s->buf[1] = (nb_sectors >> 16) & 0xff;", "s->buf[2] = (nb_sectors >> 8) & 0xff;", "s->buf[3] = nb_sectors & 0xff;", "s->buf[4] = 0;", "s->buf[5] = 0;", "s->buf[6] = s->cluster_size * 2;", "s->buf[7] = 0;", "s->buf_len = 8;", "break;", "case 0x08:\ncase 0x28:\nDPRINTF(\"Read (sector %d, count %d)\\n\", lba, len);", "s->sector = lba * s->cluster_size;", "s->sector_count = len * s->cluster_size;", "break;", "case 0x0a:\ncase 0x2a:\nDPRINTF(\"Write (sector %d, count %d)\\n\", lba, len);", "s->sector = lba * s->cluster_size;", "s->sector_count = len * s->cluster_size;", "VAR_1 = 1;", "break;", "case 0x35:\nDPRINTF(\"Syncronise cache (sector %d, count %d)\\n\", lba, len);", "bdrv_flush(s->bdrv);", "break;", "case 0x43:\n{", "int VAR_4, VAR_5, VAR_6, VAR_7;", "VAR_6 = buf[1] & 2;", "VAR_5 = buf[2] & 0xf;", "VAR_4 = buf[6];", "bdrv_get_geometry(s->bdrv, &nb_sectors);", "DPRINTF(\"Read TOC (track %d VAR_5 %d VAR_6 %d)\\n\", VAR_4, VAR_5, VAR_6 >> 1);", "switch(VAR_5) {", "case 0:\nVAR_7 = cdrom_read_toc(nb_sectors, s->buf, VAR_6, VAR_4);", "break;", "case 1:\nVAR_7 = 12;", "memset(s->buf, 0, 12);", "s->buf[1] = 0x0a;", "s->buf[2] = 0x01;", "s->buf[3] = 0x01;", "break;", "case 2:\nVAR_7 = cdrom_read_toc_raw(nb_sectors, s->buf, VAR_6, VAR_4);", "break;", "default:\ngoto error_cmd;", "}", "if (VAR_7 > 0) {", "if (len > VAR_7)\nlen = VAR_7;", "s->buf_len = len;", "break;", "}", "error_cmd:\nDPRINTF(\"Read TOC error\\n\");", "goto fail;", "}", "case 0x46:\nDPRINTF(\"Get Configuration (rt %d, maxlen %d)\\n\", buf[1] & 3, len);", "memset(s->buf, 0, 8);", "s->buf[7] = 8;", "s->buf_len = 8;", "break;", "case 0x56:\nDPRINTF(\"Reserve(10)\\n\");", "if (buf[1] & 3)\ngoto fail;", "break;", "case 0x57:\nDPRINTF(\"Release(10)\\n\");", "if (buf[1] & 3)\ngoto fail;", "break;", "case 0xa0:\nDPRINTF(\"Report LUNs (len %d)\\n\", len);", "if (len < 16)\ngoto fail;", "memset(s->buf, 0, 16);", "s->buf[3] = 8;", "s->buf_len = 16;", "break;", "default:\nDPRINTF(\"Unknown SCSI command (%2.2x)\\n\", buf[0]);", "fail:\nscsi_command_complete(s, SENSE_ILLEGAL_REQUEST);", "return 0;", "}", "if (s->sector_count == 0 && s->buf_len == 0) {", "scsi_command_complete(s, SENSE_NO_SENSE);", "}", "len = s->sector_count * 512 + s->buf_len;", "return VAR_1 ? -len : len;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189, 191 ], [ 193 ], [ 195, 197 ], [ 199, 201 ], [ 203 ], [ 205, 207, 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 275 ], [ 279 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323, 325 ], [ 327 ], [ 329, 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367, 369, 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381, 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399 ], [ 401, 403 ], [ 405 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423 ], [ 425 ], [ 427, 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443, 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 457, 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467, 469 ], [ 471 ], [ 473 ], [ 475, 477 ], [ 479 ], [ 485 ], [ 487 ], [ 489 ], [ 491, 493 ], [ 495, 497 ], [ 499 ], [ 501, 503 ], [ 505, 507 ], [ 509 ], [ 511, 513 ], [ 515, 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527, 529 ], [ 531, 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ] ]
4,975
static int vda_h264_uninit(AVCodecContext *avctx) { VDAContext *vda = avctx->internal->hwaccel_priv_data; av_freep(&vda->bitstream); if (vda->frame) CVPixelBufferRelease(vda->frame); return 0; }
true
FFmpeg
2856332719d8ec182523f7793bb0517aaac68e73
static int vda_h264_uninit(AVCodecContext *avctx) { VDAContext *vda = avctx->internal->hwaccel_priv_data; av_freep(&vda->bitstream); if (vda->frame) CVPixelBufferRelease(vda->frame); return 0; }
{ "code": [ " av_freep(&vda->bitstream);", " if (vda->frame)", " CVPixelBufferRelease(vda->frame);" ], "line_no": [ 7, 9, 11 ] }
static int FUNC_0(AVCodecContext *VAR_0) { VDAContext *vda = VAR_0->internal->hwaccel_priv_data; av_freep(&vda->bitstream); if (vda->frame) CVPixelBufferRelease(vda->frame); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "VDAContext *vda = VAR_0->internal->hwaccel_priv_data;", "av_freep(&vda->bitstream);", "if (vda->frame)\nCVPixelBufferRelease(vda->frame);", "return 0;", "}" ]
[ 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ] ]
4,977
static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p) { MTPState *s = USB_MTP(dev); MTPControl cmd; mtp_container container; uint32_t params[5]; int i, rc; switch (p->ep->nr) { case EP_DATA_IN: if (s->data_out != NULL) { /* guest bug */ trace_usb_mtp_stall(s->dev.addr, "awaiting data-out"); p->status = USB_RET_STALL; return; } if (p->iov.size < sizeof(container)) { trace_usb_mtp_stall(s->dev.addr, "packet too small"); p->status = USB_RET_STALL; return; } if (s->data_in != NULL) { MTPData *d = s->data_in; int dlen = d->length - d->offset; if (d->first) { trace_usb_mtp_data_in(s->dev.addr, d->trans, d->length); container.length = cpu_to_le32(d->length + sizeof(container)); container.type = cpu_to_le16(TYPE_DATA); container.code = cpu_to_le16(d->code); container.trans = cpu_to_le32(d->trans); usb_packet_copy(p, &container, sizeof(container)); d->first = false; if (dlen > p->iov.size - sizeof(container)) { dlen = p->iov.size - sizeof(container); } } else { if (dlen > p->iov.size) { dlen = p->iov.size; } } if (d->fd == -1) { usb_packet_copy(p, d->data + d->offset, dlen); } else { if (d->alloc < p->iov.size) { d->alloc = p->iov.size; d->data = g_realloc(d->data, d->alloc); } rc = read(d->fd, d->data, dlen); if (rc != dlen) { memset(d->data, 0, dlen); s->result->code = RES_INCOMPLETE_TRANSFER; } usb_packet_copy(p, d->data, dlen); } d->offset += dlen; if (d->offset == d->length) { usb_mtp_data_free(s->data_in); s->data_in = NULL; } } else if (s->result != NULL) { MTPControl *r = s->result; int length = sizeof(container) + r->argc * sizeof(uint32_t); if (r->code == RES_OK) { trace_usb_mtp_success(s->dev.addr, r->trans, (r->argc > 0) ? r->argv[0] : 0, (r->argc > 1) ? r->argv[1] : 0); } else { trace_usb_mtp_error(s->dev.addr, r->code, r->trans, (r->argc > 0) ? r->argv[0] : 0, (r->argc > 1) ? r->argv[1] : 0); } container.length = cpu_to_le32(length); container.type = cpu_to_le16(TYPE_RESPONSE); container.code = cpu_to_le16(r->code); container.trans = cpu_to_le32(r->trans); for (i = 0; i < r->argc; i++) { params[i] = cpu_to_le32(r->argv[i]); } usb_packet_copy(p, &container, sizeof(container)); usb_packet_copy(p, &params, length - sizeof(container)); g_free(s->result); s->result = NULL; } break; case EP_DATA_OUT: if (p->iov.size < sizeof(container)) { trace_usb_mtp_stall(s->dev.addr, "packet too small"); p->status = USB_RET_STALL; return; } usb_packet_copy(p, &container, sizeof(container)); switch (le16_to_cpu(container.type)) { case TYPE_COMMAND: if (s->data_in || s->data_out || s->result) { trace_usb_mtp_stall(s->dev.addr, "transaction inflight"); p->status = USB_RET_STALL; return; } cmd.code = le16_to_cpu(container.code); cmd.argc = (le32_to_cpu(container.length) - sizeof(container)) / sizeof(uint32_t); cmd.trans = le32_to_cpu(container.trans); if (cmd.argc > ARRAY_SIZE(cmd.argv)) { cmd.argc = ARRAY_SIZE(cmd.argv); } if (p->iov.size < sizeof(container) + cmd.argc * sizeof(uint32_t)) { trace_usb_mtp_stall(s->dev.addr, "packet too small"); p->status = USB_RET_STALL; return; } usb_packet_copy(p, &params, cmd.argc * sizeof(uint32_t)); for (i = 0; i < cmd.argc; i++) { cmd.argv[i] = le32_to_cpu(params[i]); } trace_usb_mtp_command(s->dev.addr, cmd.code, cmd.trans, (cmd.argc > 0) ? cmd.argv[0] : 0, (cmd.argc > 1) ? cmd.argv[1] : 0, (cmd.argc > 2) ? cmd.argv[2] : 0, (cmd.argc > 3) ? cmd.argv[3] : 0, (cmd.argc > 4) ? cmd.argv[4] : 0); usb_mtp_command(s, &cmd); break; default: /* not needed as long as the mtp device is read-only */ p->status = USB_RET_STALL; return; } break; case EP_EVENT: #ifdef __linux__ if (!QTAILQ_EMPTY(&s->events)) { struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events); uint32_t handle; int len = sizeof(container) + sizeof(uint32_t); if (p->iov.size < len) { trace_usb_mtp_stall(s->dev.addr, "packet too small to send event"); p->status = USB_RET_STALL; return; } QTAILQ_REMOVE(&s->events, e, next); container.length = cpu_to_le32(len); container.type = cpu_to_le32(TYPE_EVENT); container.code = cpu_to_le16(e->event); container.trans = 0; /* no trans specific events */ handle = cpu_to_le32(e->handle); usb_packet_copy(p, &container, sizeof(container)); usb_packet_copy(p, &handle, sizeof(uint32_t)); g_free(e); return; } #endif p->status = USB_RET_NAK; return; default: trace_usb_mtp_stall(s->dev.addr, "invalid endpoint"); p->status = USB_RET_STALL; return; } if (p->actual_length == 0) { trace_usb_mtp_nak(s->dev.addr, p->ep->nr); p->status = USB_RET_NAK; return; } else { trace_usb_mtp_xfer(s->dev.addr, p->ep->nr, p->actual_length, p->iov.size); return; } }
true
qemu
983bff3530782d51c46c8d7c0e17e2a9dfe5fb77
static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p) { MTPState *s = USB_MTP(dev); MTPControl cmd; mtp_container container; uint32_t params[5]; int i, rc; switch (p->ep->nr) { case EP_DATA_IN: if (s->data_out != NULL) { trace_usb_mtp_stall(s->dev.addr, "awaiting data-out"); p->status = USB_RET_STALL; return; } if (p->iov.size < sizeof(container)) { trace_usb_mtp_stall(s->dev.addr, "packet too small"); p->status = USB_RET_STALL; return; } if (s->data_in != NULL) { MTPData *d = s->data_in; int dlen = d->length - d->offset; if (d->first) { trace_usb_mtp_data_in(s->dev.addr, d->trans, d->length); container.length = cpu_to_le32(d->length + sizeof(container)); container.type = cpu_to_le16(TYPE_DATA); container.code = cpu_to_le16(d->code); container.trans = cpu_to_le32(d->trans); usb_packet_copy(p, &container, sizeof(container)); d->first = false; if (dlen > p->iov.size - sizeof(container)) { dlen = p->iov.size - sizeof(container); } } else { if (dlen > p->iov.size) { dlen = p->iov.size; } } if (d->fd == -1) { usb_packet_copy(p, d->data + d->offset, dlen); } else { if (d->alloc < p->iov.size) { d->alloc = p->iov.size; d->data = g_realloc(d->data, d->alloc); } rc = read(d->fd, d->data, dlen); if (rc != dlen) { memset(d->data, 0, dlen); s->result->code = RES_INCOMPLETE_TRANSFER; } usb_packet_copy(p, d->data, dlen); } d->offset += dlen; if (d->offset == d->length) { usb_mtp_data_free(s->data_in); s->data_in = NULL; } } else if (s->result != NULL) { MTPControl *r = s->result; int length = sizeof(container) + r->argc * sizeof(uint32_t); if (r->code == RES_OK) { trace_usb_mtp_success(s->dev.addr, r->trans, (r->argc > 0) ? r->argv[0] : 0, (r->argc > 1) ? r->argv[1] : 0); } else { trace_usb_mtp_error(s->dev.addr, r->code, r->trans, (r->argc > 0) ? r->argv[0] : 0, (r->argc > 1) ? r->argv[1] : 0); } container.length = cpu_to_le32(length); container.type = cpu_to_le16(TYPE_RESPONSE); container.code = cpu_to_le16(r->code); container.trans = cpu_to_le32(r->trans); for (i = 0; i < r->argc; i++) { params[i] = cpu_to_le32(r->argv[i]); } usb_packet_copy(p, &container, sizeof(container)); usb_packet_copy(p, &params, length - sizeof(container)); g_free(s->result); s->result = NULL; } break; case EP_DATA_OUT: if (p->iov.size < sizeof(container)) { trace_usb_mtp_stall(s->dev.addr, "packet too small"); p->status = USB_RET_STALL; return; } usb_packet_copy(p, &container, sizeof(container)); switch (le16_to_cpu(container.type)) { case TYPE_COMMAND: if (s->data_in || s->data_out || s->result) { trace_usb_mtp_stall(s->dev.addr, "transaction inflight"); p->status = USB_RET_STALL; return; } cmd.code = le16_to_cpu(container.code); cmd.argc = (le32_to_cpu(container.length) - sizeof(container)) / sizeof(uint32_t); cmd.trans = le32_to_cpu(container.trans); if (cmd.argc > ARRAY_SIZE(cmd.argv)) { cmd.argc = ARRAY_SIZE(cmd.argv); } if (p->iov.size < sizeof(container) + cmd.argc * sizeof(uint32_t)) { trace_usb_mtp_stall(s->dev.addr, "packet too small"); p->status = USB_RET_STALL; return; } usb_packet_copy(p, &params, cmd.argc * sizeof(uint32_t)); for (i = 0; i < cmd.argc; i++) { cmd.argv[i] = le32_to_cpu(params[i]); } trace_usb_mtp_command(s->dev.addr, cmd.code, cmd.trans, (cmd.argc > 0) ? cmd.argv[0] : 0, (cmd.argc > 1) ? cmd.argv[1] : 0, (cmd.argc > 2) ? cmd.argv[2] : 0, (cmd.argc > 3) ? cmd.argv[3] : 0, (cmd.argc > 4) ? cmd.argv[4] : 0); usb_mtp_command(s, &cmd); break; default: p->status = USB_RET_STALL; return; } break; case EP_EVENT: #ifdef __linux__ if (!QTAILQ_EMPTY(&s->events)) { struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events); uint32_t handle; int len = sizeof(container) + sizeof(uint32_t); if (p->iov.size < len) { trace_usb_mtp_stall(s->dev.addr, "packet too small to send event"); p->status = USB_RET_STALL; return; } QTAILQ_REMOVE(&s->events, e, next); container.length = cpu_to_le32(len); container.type = cpu_to_le32(TYPE_EVENT); container.code = cpu_to_le16(e->event); container.trans = 0; handle = cpu_to_le32(e->handle); usb_packet_copy(p, &container, sizeof(container)); usb_packet_copy(p, &handle, sizeof(uint32_t)); g_free(e); return; } #endif p->status = USB_RET_NAK; return; default: trace_usb_mtp_stall(s->dev.addr, "invalid endpoint"); p->status = USB_RET_STALL; return; } if (p->actual_length == 0) { trace_usb_mtp_nak(s->dev.addr, p->ep->nr); p->status = USB_RET_NAK; return; } else { trace_usb_mtp_xfer(s->dev.addr, p->ep->nr, p->actual_length, p->iov.size); return; } }
{ "code": [ "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__" ], "line_no": [ 259, 259, 259, 259, 259, 259, 259, 259, 259, 259 ] }
static void FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1) { MTPState *s = USB_MTP(VAR_0); MTPControl cmd; mtp_container container; uint32_t params[5]; int VAR_2, VAR_3; switch (VAR_1->ep->nr) { case EP_DATA_IN: if (s->data_out != NULL) { trace_usb_mtp_stall(s->VAR_0.addr, "awaiting data-out"); VAR_1->status = USB_RET_STALL; return; } if (VAR_1->iov.size < sizeof(container)) { trace_usb_mtp_stall(s->VAR_0.addr, "packet too small"); VAR_1->status = USB_RET_STALL; return; } if (s->data_in != NULL) { MTPData *d = s->data_in; int VAR_4 = d->VAR_5 - d->offset; if (d->first) { trace_usb_mtp_data_in(s->VAR_0.addr, d->trans, d->VAR_5); container.VAR_5 = cpu_to_le32(d->VAR_5 + sizeof(container)); container.type = cpu_to_le16(TYPE_DATA); container.code = cpu_to_le16(d->code); container.trans = cpu_to_le32(d->trans); usb_packet_copy(VAR_1, &container, sizeof(container)); d->first = false; if (VAR_4 > VAR_1->iov.size - sizeof(container)) { VAR_4 = VAR_1->iov.size - sizeof(container); } } else { if (VAR_4 > VAR_1->iov.size) { VAR_4 = VAR_1->iov.size; } } if (d->fd == -1) { usb_packet_copy(VAR_1, d->data + d->offset, VAR_4); } else { if (d->alloc < VAR_1->iov.size) { d->alloc = VAR_1->iov.size; d->data = g_realloc(d->data, d->alloc); } VAR_3 = read(d->fd, d->data, VAR_4); if (VAR_3 != VAR_4) { memset(d->data, 0, VAR_4); s->result->code = RES_INCOMPLETE_TRANSFER; } usb_packet_copy(VAR_1, d->data, VAR_4); } d->offset += VAR_4; if (d->offset == d->VAR_5) { usb_mtp_data_free(s->data_in); s->data_in = NULL; } } else if (s->result != NULL) { MTPControl *r = s->result; int VAR_5 = sizeof(container) + r->argc * sizeof(uint32_t); if (r->code == RES_OK) { trace_usb_mtp_success(s->VAR_0.addr, r->trans, (r->argc > 0) ? r->argv[0] : 0, (r->argc > 1) ? r->argv[1] : 0); } else { trace_usb_mtp_error(s->VAR_0.addr, r->code, r->trans, (r->argc > 0) ? r->argv[0] : 0, (r->argc > 1) ? r->argv[1] : 0); } container.VAR_5 = cpu_to_le32(VAR_5); container.type = cpu_to_le16(TYPE_RESPONSE); container.code = cpu_to_le16(r->code); container.trans = cpu_to_le32(r->trans); for (VAR_2 = 0; VAR_2 < r->argc; VAR_2++) { params[VAR_2] = cpu_to_le32(r->argv[VAR_2]); } usb_packet_copy(VAR_1, &container, sizeof(container)); usb_packet_copy(VAR_1, &params, VAR_5 - sizeof(container)); g_free(s->result); s->result = NULL; } break; case EP_DATA_OUT: if (VAR_1->iov.size < sizeof(container)) { trace_usb_mtp_stall(s->VAR_0.addr, "packet too small"); VAR_1->status = USB_RET_STALL; return; } usb_packet_copy(VAR_1, &container, sizeof(container)); switch (le16_to_cpu(container.type)) { case TYPE_COMMAND: if (s->data_in || s->data_out || s->result) { trace_usb_mtp_stall(s->VAR_0.addr, "transaction inflight"); VAR_1->status = USB_RET_STALL; return; } cmd.code = le16_to_cpu(container.code); cmd.argc = (le32_to_cpu(container.VAR_5) - sizeof(container)) / sizeof(uint32_t); cmd.trans = le32_to_cpu(container.trans); if (cmd.argc > ARRAY_SIZE(cmd.argv)) { cmd.argc = ARRAY_SIZE(cmd.argv); } if (VAR_1->iov.size < sizeof(container) + cmd.argc * sizeof(uint32_t)) { trace_usb_mtp_stall(s->VAR_0.addr, "packet too small"); VAR_1->status = USB_RET_STALL; return; } usb_packet_copy(VAR_1, &params, cmd.argc * sizeof(uint32_t)); for (VAR_2 = 0; VAR_2 < cmd.argc; VAR_2++) { cmd.argv[VAR_2] = le32_to_cpu(params[VAR_2]); } trace_usb_mtp_command(s->VAR_0.addr, cmd.code, cmd.trans, (cmd.argc > 0) ? cmd.argv[0] : 0, (cmd.argc > 1) ? cmd.argv[1] : 0, (cmd.argc > 2) ? cmd.argv[2] : 0, (cmd.argc > 3) ? cmd.argv[3] : 0, (cmd.argc > 4) ? cmd.argv[4] : 0); usb_mtp_command(s, &cmd); break; default: VAR_1->status = USB_RET_STALL; return; } break; case EP_EVENT: #ifdef __linux__ if (!QTAILQ_EMPTY(&s->events)) { struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events); uint32_t handle; int len = sizeof(container) + sizeof(uint32_t); if (VAR_1->iov.size < len) { trace_usb_mtp_stall(s->VAR_0.addr, "packet too small to send event"); VAR_1->status = USB_RET_STALL; return; } QTAILQ_REMOVE(&s->events, e, next); container.VAR_5 = cpu_to_le32(len); container.type = cpu_to_le32(TYPE_EVENT); container.code = cpu_to_le16(e->event); container.trans = 0; handle = cpu_to_le32(e->handle); usb_packet_copy(VAR_1, &container, sizeof(container)); usb_packet_copy(VAR_1, &handle, sizeof(uint32_t)); g_free(e); return; } #endif VAR_1->status = USB_RET_NAK; return; default: trace_usb_mtp_stall(s->VAR_0.addr, "invalid endpoint"); VAR_1->status = USB_RET_STALL; return; } if (VAR_1->actual_length == 0) { trace_usb_mtp_nak(s->VAR_0.addr, VAR_1->ep->nr); VAR_1->status = USB_RET_NAK; return; } else { trace_usb_mtp_xfer(s->VAR_0.addr, VAR_1->ep->nr, VAR_1->actual_length, VAR_1->iov.size); return; } }
[ "static void FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)\n{", "MTPState *s = USB_MTP(VAR_0);", "MTPControl cmd;", "mtp_container container;", "uint32_t params[5];", "int VAR_2, VAR_3;", "switch (VAR_1->ep->nr) {", "case EP_DATA_IN:\nif (s->data_out != NULL) {", "trace_usb_mtp_stall(s->VAR_0.addr, \"awaiting data-out\");", "VAR_1->status = USB_RET_STALL;", "return;", "}", "if (VAR_1->iov.size < sizeof(container)) {", "trace_usb_mtp_stall(s->VAR_0.addr, \"packet too small\");", "VAR_1->status = USB_RET_STALL;", "return;", "}", "if (s->data_in != NULL) {", "MTPData *d = s->data_in;", "int VAR_4 = d->VAR_5 - d->offset;", "if (d->first) {", "trace_usb_mtp_data_in(s->VAR_0.addr, d->trans, d->VAR_5);", "container.VAR_5 = cpu_to_le32(d->VAR_5 + sizeof(container));", "container.type = cpu_to_le16(TYPE_DATA);", "container.code = cpu_to_le16(d->code);", "container.trans = cpu_to_le32(d->trans);", "usb_packet_copy(VAR_1, &container, sizeof(container));", "d->first = false;", "if (VAR_4 > VAR_1->iov.size - sizeof(container)) {", "VAR_4 = VAR_1->iov.size - sizeof(container);", "}", "} else {", "if (VAR_4 > VAR_1->iov.size) {", "VAR_4 = VAR_1->iov.size;", "}", "}", "if (d->fd == -1) {", "usb_packet_copy(VAR_1, d->data + d->offset, VAR_4);", "} else {", "if (d->alloc < VAR_1->iov.size) {", "d->alloc = VAR_1->iov.size;", "d->data = g_realloc(d->data, d->alloc);", "}", "VAR_3 = read(d->fd, d->data, VAR_4);", "if (VAR_3 != VAR_4) {", "memset(d->data, 0, VAR_4);", "s->result->code = RES_INCOMPLETE_TRANSFER;", "}", "usb_packet_copy(VAR_1, d->data, VAR_4);", "}", "d->offset += VAR_4;", "if (d->offset == d->VAR_5) {", "usb_mtp_data_free(s->data_in);", "s->data_in = NULL;", "}", "} else if (s->result != NULL) {", "MTPControl *r = s->result;", "int VAR_5 = sizeof(container) + r->argc * sizeof(uint32_t);", "if (r->code == RES_OK) {", "trace_usb_mtp_success(s->VAR_0.addr, r->trans,\n(r->argc > 0) ? r->argv[0] : 0,\n(r->argc > 1) ? r->argv[1] : 0);", "} else {", "trace_usb_mtp_error(s->VAR_0.addr, r->code, r->trans,\n(r->argc > 0) ? r->argv[0] : 0,\n(r->argc > 1) ? r->argv[1] : 0);", "}", "container.VAR_5 = cpu_to_le32(VAR_5);", "container.type = cpu_to_le16(TYPE_RESPONSE);", "container.code = cpu_to_le16(r->code);", "container.trans = cpu_to_le32(r->trans);", "for (VAR_2 = 0; VAR_2 < r->argc; VAR_2++) {", "params[VAR_2] = cpu_to_le32(r->argv[VAR_2]);", "}", "usb_packet_copy(VAR_1, &container, sizeof(container));", "usb_packet_copy(VAR_1, &params, VAR_5 - sizeof(container));", "g_free(s->result);", "s->result = NULL;", "}", "break;", "case EP_DATA_OUT:\nif (VAR_1->iov.size < sizeof(container)) {", "trace_usb_mtp_stall(s->VAR_0.addr, \"packet too small\");", "VAR_1->status = USB_RET_STALL;", "return;", "}", "usb_packet_copy(VAR_1, &container, sizeof(container));", "switch (le16_to_cpu(container.type)) {", "case TYPE_COMMAND:\nif (s->data_in || s->data_out || s->result) {", "trace_usb_mtp_stall(s->VAR_0.addr, \"transaction inflight\");", "VAR_1->status = USB_RET_STALL;", "return;", "}", "cmd.code = le16_to_cpu(container.code);", "cmd.argc = (le32_to_cpu(container.VAR_5) - sizeof(container))\n/ sizeof(uint32_t);", "cmd.trans = le32_to_cpu(container.trans);", "if (cmd.argc > ARRAY_SIZE(cmd.argv)) {", "cmd.argc = ARRAY_SIZE(cmd.argv);", "}", "if (VAR_1->iov.size < sizeof(container) + cmd.argc * sizeof(uint32_t)) {", "trace_usb_mtp_stall(s->VAR_0.addr, \"packet too small\");", "VAR_1->status = USB_RET_STALL;", "return;", "}", "usb_packet_copy(VAR_1, &params, cmd.argc * sizeof(uint32_t));", "for (VAR_2 = 0; VAR_2 < cmd.argc; VAR_2++) {", "cmd.argv[VAR_2] = le32_to_cpu(params[VAR_2]);", "}", "trace_usb_mtp_command(s->VAR_0.addr, cmd.code, cmd.trans,\n(cmd.argc > 0) ? cmd.argv[0] : 0,\n(cmd.argc > 1) ? cmd.argv[1] : 0,\n(cmd.argc > 2) ? cmd.argv[2] : 0,\n(cmd.argc > 3) ? cmd.argv[3] : 0,\n(cmd.argc > 4) ? cmd.argv[4] : 0);", "usb_mtp_command(s, &cmd);", "break;", "default:\nVAR_1->status = USB_RET_STALL;", "return;", "}", "break;", "case EP_EVENT:\n#ifdef __linux__\nif (!QTAILQ_EMPTY(&s->events)) {", "struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events);", "uint32_t handle;", "int len = sizeof(container) + sizeof(uint32_t);", "if (VAR_1->iov.size < len) {", "trace_usb_mtp_stall(s->VAR_0.addr,\n\"packet too small to send event\");", "VAR_1->status = USB_RET_STALL;", "return;", "}", "QTAILQ_REMOVE(&s->events, e, next);", "container.VAR_5 = cpu_to_le32(len);", "container.type = cpu_to_le32(TYPE_EVENT);", "container.code = cpu_to_le16(e->event);", "container.trans = 0;", "handle = cpu_to_le32(e->handle);", "usb_packet_copy(VAR_1, &container, sizeof(container));", "usb_packet_copy(VAR_1, &handle, sizeof(uint32_t));", "g_free(e);", "return;", "}", "#endif\nVAR_1->status = USB_RET_NAK;", "return;", "default:\ntrace_usb_mtp_stall(s->VAR_0.addr, \"invalid endpoint\");", "VAR_1->status = USB_RET_STALL;", "return;", "}", "if (VAR_1->actual_length == 0) {", "trace_usb_mtp_nak(s->VAR_0.addr, VAR_1->ep->nr);", "VAR_1->status = USB_RET_NAK;", "return;", "} else {", "trace_usb_mtp_xfer(s->VAR_0.addr, VAR_1->ep->nr, VAR_1->actual_length,\nVAR_1->iov.size);", "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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 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 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129, 131 ], [ 133 ], [ 135, 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 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, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 271 ], [ 273, 275 ], [ 277 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313, 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 343 ] ]
4,978
ReadLineState *readline_init(ReadLinePrintfFunc *printf_func, ReadLineFlushFunc *flush_func, void *opaque, ReadLineCompletionFunc *completion_finder) { ReadLineState *rs = g_malloc0(sizeof(*rs)); rs->hist_entry = -1; rs->opaque = opaque; rs->printf_func = printf_func; rs->flush_func = flush_func; rs->completion_finder = completion_finder; return rs; }
true
qemu
e5dc1a6c6c4359cd783810f63eb68e9e09350708
ReadLineState *readline_init(ReadLinePrintfFunc *printf_func, ReadLineFlushFunc *flush_func, void *opaque, ReadLineCompletionFunc *completion_finder) { ReadLineState *rs = g_malloc0(sizeof(*rs)); rs->hist_entry = -1; rs->opaque = opaque; rs->printf_func = printf_func; rs->flush_func = flush_func; rs->completion_finder = completion_finder; return rs; }
{ "code": [ " ReadLineState *rs = g_malloc0(sizeof(*rs));" ], "line_no": [ 11 ] }
ReadLineState *FUNC_0(ReadLinePrintfFunc *printf_func, ReadLineFlushFunc *flush_func, void *opaque, ReadLineCompletionFunc *completion_finder) { ReadLineState *rs = g_malloc0(sizeof(*rs)); rs->hist_entry = -1; rs->opaque = opaque; rs->printf_func = printf_func; rs->flush_func = flush_func; rs->completion_finder = completion_finder; return rs; }
[ "ReadLineState *FUNC_0(ReadLinePrintfFunc *printf_func,\nReadLineFlushFunc *flush_func,\nvoid *opaque,\nReadLineCompletionFunc *completion_finder)\n{", "ReadLineState *rs = g_malloc0(sizeof(*rs));", "rs->hist_entry = -1;", "rs->opaque = opaque;", "rs->printf_func = printf_func;", "rs->flush_func = flush_func;", "rs->completion_finder = completion_finder;", "return rs;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
4,979
static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGList *sglist, int32_t offset) { AHCICmdHdr *cmd = ad->cur_cmd; uint16_t opts = le16_to_cpu(cmd->opts); uint16_t prdtl = le16_to_cpu(cmd->prdtl); uint64_t cfis_addr = le64_to_cpu(cmd->tbl_addr); uint64_t prdt_addr = cfis_addr + 0x80; dma_addr_t prdt_len = (prdtl * sizeof(AHCI_SG)); dma_addr_t real_prdt_len = prdt_len; uint8_t *prdt; int i; int r = 0; uint64_t sum = 0; int off_idx = -1; int64_t off_pos = -1; int tbl_entry_size; IDEBus *bus = &ad->port; BusState *qbus = BUS(bus); /* * Note: AHCI PRDT can describe up to 256GiB. SATA/ATA only support * transactions of up to 32MiB as of ATA8-ACS3 rev 1b, assuming a * 512 byte sector size. We limit the PRDT in this implementation to * a reasonably large 2GiB, which can accommodate the maximum transfer * request for sector sizes up to 32K. */ if (!prdtl) { DPRINTF(ad->port_no, "no sg list given by guest: 0x%08x\n", opts); return -1; } /* map PRDT */ if (!(prdt = dma_memory_map(ad->hba->as, prdt_addr, &prdt_len, DMA_DIRECTION_TO_DEVICE))){ DPRINTF(ad->port_no, "map failed\n"); return -1; } if (prdt_len < real_prdt_len) { DPRINTF(ad->port_no, "mapped less than expected\n"); r = -1; goto out; } /* Get entries in the PRDT, init a qemu sglist accordingly */ if (prdtl > 0) { AHCI_SG *tbl = (AHCI_SG *)prdt; sum = 0; for (i = 0; i < prdtl; i++) { /* flags_size is zero-based */ tbl_entry_size = prdt_tbl_entry_size(&tbl[i]); if (offset <= (sum + tbl_entry_size)) { off_idx = i; off_pos = offset - sum; break; } sum += tbl_entry_size; } if ((off_idx == -1) || (off_pos < 0) || (off_pos > tbl_entry_size)) { DPRINTF(ad->port_no, "%s: Incorrect offset! " "off_idx: %d, off_pos: %"PRId64"\n", __func__, off_idx, off_pos); r = -1; goto out; } qemu_sglist_init(sglist, qbus->parent, (prdtl - off_idx), ad->hba->as); qemu_sglist_add(sglist, le64_to_cpu(tbl[off_idx].addr) + off_pos, prdt_tbl_entry_size(&tbl[off_idx]) - off_pos); for (i = off_idx + 1; i < prdtl; i++) { /* flags_size is zero-based */ qemu_sglist_add(sglist, le64_to_cpu(tbl[i].addr), prdt_tbl_entry_size(&tbl[i])); if (sglist->size > INT32_MAX) { error_report("AHCI Physical Region Descriptor Table describes " "more than 2 GiB.\n"); qemu_sglist_destroy(sglist); r = -1; goto out; } } } out: dma_memory_unmap(ad->hba->as, prdt, prdt_len, DMA_DIRECTION_TO_DEVICE, prdt_len); return r; }
true
qemu
a718978ed58abc1ad92567a9c17525136be02a71
static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGList *sglist, int32_t offset) { AHCICmdHdr *cmd = ad->cur_cmd; uint16_t opts = le16_to_cpu(cmd->opts); uint16_t prdtl = le16_to_cpu(cmd->prdtl); uint64_t cfis_addr = le64_to_cpu(cmd->tbl_addr); uint64_t prdt_addr = cfis_addr + 0x80; dma_addr_t prdt_len = (prdtl * sizeof(AHCI_SG)); dma_addr_t real_prdt_len = prdt_len; uint8_t *prdt; int i; int r = 0; uint64_t sum = 0; int off_idx = -1; int64_t off_pos = -1; int tbl_entry_size; IDEBus *bus = &ad->port; BusState *qbus = BUS(bus); if (!prdtl) { DPRINTF(ad->port_no, "no sg list given by guest: 0x%08x\n", opts); return -1; } if (!(prdt = dma_memory_map(ad->hba->as, prdt_addr, &prdt_len, DMA_DIRECTION_TO_DEVICE))){ DPRINTF(ad->port_no, "map failed\n"); return -1; } if (prdt_len < real_prdt_len) { DPRINTF(ad->port_no, "mapped less than expected\n"); r = -1; goto out; } if (prdtl > 0) { AHCI_SG *tbl = (AHCI_SG *)prdt; sum = 0; for (i = 0; i < prdtl; i++) { tbl_entry_size = prdt_tbl_entry_size(&tbl[i]); if (offset <= (sum + tbl_entry_size)) { off_idx = i; off_pos = offset - sum; break; } sum += tbl_entry_size; } if ((off_idx == -1) || (off_pos < 0) || (off_pos > tbl_entry_size)) { DPRINTF(ad->port_no, "%s: Incorrect offset! " "off_idx: %d, off_pos: %"PRId64"\n", __func__, off_idx, off_pos); r = -1; goto out; } qemu_sglist_init(sglist, qbus->parent, (prdtl - off_idx), ad->hba->as); qemu_sglist_add(sglist, le64_to_cpu(tbl[off_idx].addr) + off_pos, prdt_tbl_entry_size(&tbl[off_idx]) - off_pos); for (i = off_idx + 1; i < prdtl; i++) { qemu_sglist_add(sglist, le64_to_cpu(tbl[i].addr), prdt_tbl_entry_size(&tbl[i])); if (sglist->size > INT32_MAX) { error_report("AHCI Physical Region Descriptor Table describes " "more than 2 GiB.\n"); qemu_sglist_destroy(sglist); r = -1; goto out; } } } out: dma_memory_unmap(ad->hba->as, prdt, prdt_len, DMA_DIRECTION_TO_DEVICE, prdt_len); return r; }
{ "code": [ " int32_t offset)", " if (offset <= (sum + tbl_entry_size)) {", " prdt_tbl_entry_size(&tbl[off_idx]) - off_pos);", " for (i = off_idx + 1; i < prdtl; i++) {", " prdt_tbl_entry_size(&tbl[i]));" ], "line_no": [ 3, 107, 143, 147, 153 ] }
static int FUNC_0(AHCIDevice *VAR_0, QEMUSGList *VAR_1, int32_t VAR_2) { AHCICmdHdr *cmd = VAR_0->cur_cmd; uint16_t opts = le16_to_cpu(cmd->opts); uint16_t prdtl = le16_to_cpu(cmd->prdtl); uint64_t cfis_addr = le64_to_cpu(cmd->tbl_addr); uint64_t prdt_addr = cfis_addr + 0x80; dma_addr_t prdt_len = (prdtl * sizeof(AHCI_SG)); dma_addr_t real_prdt_len = prdt_len; uint8_t *prdt; int VAR_3; int VAR_4 = 0; uint64_t sum = 0; int VAR_5 = -1; int64_t off_pos = -1; int VAR_6; IDEBus *bus = &VAR_0->port; BusState *qbus = BUS(bus); if (!prdtl) { DPRINTF(VAR_0->port_no, "no sg list given by guest: 0x%08x\n", opts); return -1; } if (!(prdt = dma_memory_map(VAR_0->hba->as, prdt_addr, &prdt_len, DMA_DIRECTION_TO_DEVICE))){ DPRINTF(VAR_0->port_no, "map failed\n"); return -1; } if (prdt_len < real_prdt_len) { DPRINTF(VAR_0->port_no, "mapped less than expected\n"); VAR_4 = -1; goto out; } if (prdtl > 0) { AHCI_SG *tbl = (AHCI_SG *)prdt; sum = 0; for (VAR_3 = 0; VAR_3 < prdtl; VAR_3++) { VAR_6 = prdt_tbl_entry_size(&tbl[VAR_3]); if (VAR_2 <= (sum + VAR_6)) { VAR_5 = VAR_3; off_pos = VAR_2 - sum; break; } sum += VAR_6; } if ((VAR_5 == -1) || (off_pos < 0) || (off_pos > VAR_6)) { DPRINTF(VAR_0->port_no, "%s: Incorrect VAR_2! " "VAR_5: %d, off_pos: %"PRId64"\n", __func__, VAR_5, off_pos); VAR_4 = -1; goto out; } qemu_sglist_init(VAR_1, qbus->parent, (prdtl - VAR_5), VAR_0->hba->as); qemu_sglist_add(VAR_1, le64_to_cpu(tbl[VAR_5].addr) + off_pos, prdt_tbl_entry_size(&tbl[VAR_5]) - off_pos); for (VAR_3 = VAR_5 + 1; VAR_3 < prdtl; VAR_3++) { qemu_sglist_add(VAR_1, le64_to_cpu(tbl[VAR_3].addr), prdt_tbl_entry_size(&tbl[VAR_3])); if (VAR_1->size > INT32_MAX) { error_report("AHCI Physical Region Descriptor Table describes " "more than 2 GiB.\n"); qemu_sglist_destroy(VAR_1); VAR_4 = -1; goto out; } } } out: dma_memory_unmap(VAR_0->hba->as, prdt, prdt_len, DMA_DIRECTION_TO_DEVICE, prdt_len); return VAR_4; }
[ "static int FUNC_0(AHCIDevice *VAR_0, QEMUSGList *VAR_1,\nint32_t VAR_2)\n{", "AHCICmdHdr *cmd = VAR_0->cur_cmd;", "uint16_t opts = le16_to_cpu(cmd->opts);", "uint16_t prdtl = le16_to_cpu(cmd->prdtl);", "uint64_t cfis_addr = le64_to_cpu(cmd->tbl_addr);", "uint64_t prdt_addr = cfis_addr + 0x80;", "dma_addr_t prdt_len = (prdtl * sizeof(AHCI_SG));", "dma_addr_t real_prdt_len = prdt_len;", "uint8_t *prdt;", "int VAR_3;", "int VAR_4 = 0;", "uint64_t sum = 0;", "int VAR_5 = -1;", "int64_t off_pos = -1;", "int VAR_6;", "IDEBus *bus = &VAR_0->port;", "BusState *qbus = BUS(bus);", "if (!prdtl) {", "DPRINTF(VAR_0->port_no, \"no sg list given by guest: 0x%08x\\n\", opts);", "return -1;", "}", "if (!(prdt = dma_memory_map(VAR_0->hba->as, prdt_addr, &prdt_len,\nDMA_DIRECTION_TO_DEVICE))){", "DPRINTF(VAR_0->port_no, \"map failed\\n\");", "return -1;", "}", "if (prdt_len < real_prdt_len) {", "DPRINTF(VAR_0->port_no, \"mapped less than expected\\n\");", "VAR_4 = -1;", "goto out;", "}", "if (prdtl > 0) {", "AHCI_SG *tbl = (AHCI_SG *)prdt;", "sum = 0;", "for (VAR_3 = 0; VAR_3 < prdtl; VAR_3++) {", "VAR_6 = prdt_tbl_entry_size(&tbl[VAR_3]);", "if (VAR_2 <= (sum + VAR_6)) {", "VAR_5 = VAR_3;", "off_pos = VAR_2 - sum;", "break;", "}", "sum += VAR_6;", "}", "if ((VAR_5 == -1) || (off_pos < 0) || (off_pos > VAR_6)) {", "DPRINTF(VAR_0->port_no, \"%s: Incorrect VAR_2! \"\n\"VAR_5: %d, off_pos: %\"PRId64\"\\n\",\n__func__, VAR_5, off_pos);", "VAR_4 = -1;", "goto out;", "}", "qemu_sglist_init(VAR_1, qbus->parent, (prdtl - VAR_5),\nVAR_0->hba->as);", "qemu_sglist_add(VAR_1, le64_to_cpu(tbl[VAR_5].addr) + off_pos,\nprdt_tbl_entry_size(&tbl[VAR_5]) - off_pos);", "for (VAR_3 = VAR_5 + 1; VAR_3 < prdtl; VAR_3++) {", "qemu_sglist_add(VAR_1, le64_to_cpu(tbl[VAR_3].addr),\nprdt_tbl_entry_size(&tbl[VAR_3]));", "if (VAR_1->size > INT32_MAX) {", "error_report(\"AHCI Physical Region Descriptor Table describes \"\n\"more than 2 GiB.\\n\");", "qemu_sglist_destroy(VAR_1);", "VAR_4 = -1;", "goto out;", "}", "}", "}", "out:\ndma_memory_unmap(VAR_0->hba->as, prdt, prdt_len,\nDMA_DIRECTION_TO_DEVICE, prdt_len);", "return VAR_4;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137, 139 ], [ 141, 143 ], [ 147 ], [ 151, 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175, 177, 179 ], [ 181 ], [ 183 ] ]
4,980
static void simple_varargs(void) { QObject *embedded_obj; QObject *obj; LiteralQObject decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(1), QLIT_QINT(2), QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(32), QLIT_QINT(42), {}})), {}})); embedded_obj = qobject_from_json("[32, 42]", NULL); g_assert(embedded_obj != NULL); obj = qobject_from_jsonf("[%d, 2, %p]", 1, embedded_obj); g_assert(compare_litqobj_to_qobj(&decoded, obj) == 1); qobject_decref(obj); }
true
qemu
aec4b054ea36c53c8b887da99f20010133b84378
static void simple_varargs(void) { QObject *embedded_obj; QObject *obj; LiteralQObject decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(1), QLIT_QINT(2), QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(32), QLIT_QINT(42), {}})), {}})); embedded_obj = qobject_from_json("[32, 42]", NULL); g_assert(embedded_obj != NULL); obj = qobject_from_jsonf("[%d, 2, %p]", 1, embedded_obj); g_assert(compare_litqobj_to_qobj(&decoded, obj) == 1); qobject_decref(obj); }
{ "code": [ " embedded_obj = qobject_from_json(\"[32, 42]\", NULL);" ], "line_no": [ 27 ] }
static void FUNC_0(void) { QObject *embedded_obj; QObject *obj; LiteralQObject decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(1), QLIT_QINT(2), QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(32), QLIT_QINT(42), {}})), {}})); embedded_obj = qobject_from_json("[32, 42]", NULL); g_assert(embedded_obj != NULL); obj = qobject_from_jsonf("[%d, 2, %p]", 1, embedded_obj); g_assert(compare_litqobj_to_qobj(&decoded, obj) == 1); qobject_decref(obj); }
[ "static void FUNC_0(void)\n{", "QObject *embedded_obj;", "QObject *obj;", "LiteralQObject decoded = QLIT_QLIST(((LiteralQObject[]){", "QLIT_QINT(1),\nQLIT_QINT(2),\nQLIT_QLIST(((LiteralQObject[]){", "QLIT_QINT(32),\nQLIT_QINT(42),\n{}})),", "{}}));", "embedded_obj = qobject_from_json(\"[32, 42]\", NULL);", "g_assert(embedded_obj != NULL);", "obj = qobject_from_jsonf(\"[%d, 2, %p]\", 1, embedded_obj);", "g_assert(compare_litqobj_to_qobj(&decoded, obj) == 1);", "qobject_decref(obj);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 17, 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
4,981
static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp) { RAMBlock *block; RAMBlock *last_block = NULL; ram_addr_t old_ram_size, new_ram_size; old_ram_size = last_ram_offset() >> TARGET_PAGE_BITS; qemu_mutex_lock_ramlist(); new_block->offset = find_ram_offset(new_block->max_length); if (!new_block->host) { if (xen_enabled()) { xen_ram_alloc(new_block->offset, new_block->max_length, new_block->mr); } else { new_block->host = phys_mem_alloc(new_block->max_length, &new_block->mr->align); if (!new_block->host) { error_setg_errno(errp, errno, "cannot set up guest memory '%s'", memory_region_name(new_block->mr)); qemu_mutex_unlock_ramlist(); return -1; memory_try_enable_merging(new_block->host, new_block->max_length); /* Keep the list sorted from biggest to smallest block. Unlike QTAILQ, * QLIST (which has an RCU-friendly variant) does not have insertion at * tail, so save the last element in last_block. */ QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { last_block = block; if (block->max_length < new_block->max_length) { break; if (block) { QLIST_INSERT_BEFORE_RCU(block, new_block, next); } else if (last_block) { QLIST_INSERT_AFTER_RCU(last_block, new_block, next); } else { /* list is empty */ QLIST_INSERT_HEAD_RCU(&ram_list.blocks, new_block, next); ram_list.mru_block = NULL; /* Write list before version */ smp_wmb(); ram_list.version++; qemu_mutex_unlock_ramlist(); new_ram_size = last_ram_offset() >> TARGET_PAGE_BITS; int i; /* ram_list.dirty_memory[] is protected by the iothread lock. */ for (i = 0; i < DIRTY_MEMORY_NUM; i++) { ram_list.dirty_memory[i] = bitmap_zero_extend(ram_list.dirty_memory[i], old_ram_size, new_ram_size); cpu_physical_memory_set_dirty_range(new_block->offset, new_block->used_length, DIRTY_CLIENTS_ALL); if (new_block->host) { qemu_ram_setup_dump(new_block->host, new_block->max_length); qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE); qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK); if (kvm_enabled()) { kvm_setup_guest_memory(new_block->host, new_block->max_length); return new_block->offset;
true
qemu
dd63169766abd2b8dc33f4451dac5e778458a47c
static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp) { RAMBlock *block; RAMBlock *last_block = NULL; ram_addr_t old_ram_size, new_ram_size; old_ram_size = last_ram_offset() >> TARGET_PAGE_BITS; qemu_mutex_lock_ramlist(); new_block->offset = find_ram_offset(new_block->max_length); if (!new_block->host) { if (xen_enabled()) { xen_ram_alloc(new_block->offset, new_block->max_length, new_block->mr); } else { new_block->host = phys_mem_alloc(new_block->max_length, &new_block->mr->align); if (!new_block->host) { error_setg_errno(errp, errno, "cannot set up guest memory '%s'", memory_region_name(new_block->mr)); qemu_mutex_unlock_ramlist(); return -1; memory_try_enable_merging(new_block->host, new_block->max_length); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { last_block = block; if (block->max_length < new_block->max_length) { break; if (block) { QLIST_INSERT_BEFORE_RCU(block, new_block, next); } else if (last_block) { QLIST_INSERT_AFTER_RCU(last_block, new_block, next); } else { QLIST_INSERT_HEAD_RCU(&ram_list.blocks, new_block, next); ram_list.mru_block = NULL; smp_wmb(); ram_list.version++; qemu_mutex_unlock_ramlist(); new_ram_size = last_ram_offset() >> TARGET_PAGE_BITS; int i; for (i = 0; i < DIRTY_MEMORY_NUM; i++) { ram_list.dirty_memory[i] = bitmap_zero_extend(ram_list.dirty_memory[i], old_ram_size, new_ram_size); cpu_physical_memory_set_dirty_range(new_block->offset, new_block->used_length, DIRTY_CLIENTS_ALL); if (new_block->host) { qemu_ram_setup_dump(new_block->host, new_block->max_length); qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE); qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK); if (kvm_enabled()) { kvm_setup_guest_memory(new_block->host, new_block->max_length); return new_block->offset;
{ "code": [], "line_no": [] }
static ram_addr_t FUNC_0(RAMBlock *new_block, Error **errp) { RAMBlock *block; RAMBlock *last_block = NULL; ram_addr_t old_ram_size, new_ram_size; old_ram_size = last_ram_offset() >> TARGET_PAGE_BITS; qemu_mutex_lock_ramlist(); new_block->offset = find_ram_offset(new_block->max_length); if (!new_block->host) { if (xen_enabled()) { xen_ram_alloc(new_block->offset, new_block->max_length, new_block->mr); } else { new_block->host = phys_mem_alloc(new_block->max_length, &new_block->mr->align); if (!new_block->host) { error_setg_errno(errp, errno, "cannot set up guest memory '%s'", memory_region_name(new_block->mr)); qemu_mutex_unlock_ramlist(); return -1; memory_try_enable_merging(new_block->host, new_block->max_length); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { last_block = block; if (block->max_length < new_block->max_length) { break; if (block) { QLIST_INSERT_BEFORE_RCU(block, new_block, next); } else if (last_block) { QLIST_INSERT_AFTER_RCU(last_block, new_block, next); } else { QLIST_INSERT_HEAD_RCU(&ram_list.blocks, new_block, next); ram_list.mru_block = NULL; smp_wmb(); ram_list.version++; qemu_mutex_unlock_ramlist(); new_ram_size = last_ram_offset() >> TARGET_PAGE_BITS; int i; for (i = 0; i < DIRTY_MEMORY_NUM; i++) { ram_list.dirty_memory[i] = bitmap_zero_extend(ram_list.dirty_memory[i], old_ram_size, new_ram_size); cpu_physical_memory_set_dirty_range(new_block->offset, new_block->used_length, DIRTY_CLIENTS_ALL); if (new_block->host) { qemu_ram_setup_dump(new_block->host, new_block->max_length); qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE); qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK); if (kvm_enabled()) { kvm_setup_guest_memory(new_block->host, new_block->max_length); return new_block->offset;
[ "static ram_addr_t FUNC_0(RAMBlock *new_block, Error **errp)\n{", "RAMBlock *block;", "RAMBlock *last_block = NULL;", "ram_addr_t old_ram_size, new_ram_size;", "old_ram_size = last_ram_offset() >> TARGET_PAGE_BITS;", "qemu_mutex_lock_ramlist();", "new_block->offset = find_ram_offset(new_block->max_length);", "if (!new_block->host) {", "if (xen_enabled()) {", "xen_ram_alloc(new_block->offset, new_block->max_length,\nnew_block->mr);", "} else {", "new_block->host = phys_mem_alloc(new_block->max_length,\n&new_block->mr->align);", "if (!new_block->host) {", "error_setg_errno(errp, errno,\n\"cannot set up guest memory '%s'\",\nmemory_region_name(new_block->mr));", "qemu_mutex_unlock_ramlist();", "return -1;", "memory_try_enable_merging(new_block->host, new_block->max_length);", "QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {", "last_block = block;", "if (block->max_length < new_block->max_length) {", "break;", "if (block) {", "QLIST_INSERT_BEFORE_RCU(block, new_block, next);", "} else if (last_block) {", "QLIST_INSERT_AFTER_RCU(last_block, new_block, next);", "} else {", "QLIST_INSERT_HEAD_RCU(&ram_list.blocks, new_block, next);", "ram_list.mru_block = NULL;", "smp_wmb();", "ram_list.version++;", "qemu_mutex_unlock_ramlist();", "new_ram_size = last_ram_offset() >> TARGET_PAGE_BITS;", "int i;", "for (i = 0; i < DIRTY_MEMORY_NUM; i++) {", "ram_list.dirty_memory[i] =\nbitmap_zero_extend(ram_list.dirty_memory[i],\nold_ram_size, new_ram_size);", "cpu_physical_memory_set_dirty_range(new_block->offset,\nnew_block->used_length,\nDIRTY_CLIENTS_ALL);", "if (new_block->host) {", "qemu_ram_setup_dump(new_block->host, new_block->max_length);", "qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);", "qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);", "if (kvm_enabled()) {", "kvm_setup_guest_memory(new_block->host, new_block->max_length);", "return new_block->offset;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 50 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 92 ], [ 98 ], [ 100 ], [ 102 ], [ 106 ], [ 111 ], [ 117 ], [ 119, 121, 123 ], [ 127, 129, 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 151 ] ]
4,982
void qemu_set_log(int log_flags, bool use_own_buffers) { qemu_loglevel = log_flags; if (qemu_loglevel && !qemu_logfile) { qemu_logfile = fopen(logfilename, log_append ? "a" : "w"); if (!qemu_logfile) { perror(logfilename); _exit(1); } /* must avoid mmap() usage of glibc by setting a buffer "by hand" */ if (use_own_buffers) { static char logfile_buf[4096]; setvbuf(qemu_logfile, logfile_buf, _IOLBF, sizeof(logfile_buf)); } else { #if defined(_WIN32) /* Win32 doesn't support line-buffering, so use unbuffered output. */ setvbuf(qemu_logfile, NULL, _IONBF, 0); #else setvbuf(qemu_logfile, NULL, _IOLBF, 0); #endif log_append = 1; } } if (!qemu_loglevel && qemu_logfile) { fclose(qemu_logfile); qemu_logfile = NULL; } }
true
qemu
40a50b0a73d185c85cf62023f07e3091861081bb
void qemu_set_log(int log_flags, bool use_own_buffers) { qemu_loglevel = log_flags; if (qemu_loglevel && !qemu_logfile) { qemu_logfile = fopen(logfilename, log_append ? "a" : "w"); if (!qemu_logfile) { perror(logfilename); _exit(1); } if (use_own_buffers) { static char logfile_buf[4096]; setvbuf(qemu_logfile, logfile_buf, _IOLBF, sizeof(logfile_buf)); } else { #if defined(_WIN32) setvbuf(qemu_logfile, NULL, _IONBF, 0); #else setvbuf(qemu_logfile, NULL, _IOLBF, 0); #endif log_append = 1; } } if (!qemu_loglevel && qemu_logfile) { fclose(qemu_logfile); qemu_logfile = NULL; } }
{ "code": [ " qemu_logfile = fopen(logfilename, log_append ? \"a\" : \"w\");", " perror(logfilename);" ], "line_no": [ 9, 13 ] }
void FUNC_0(int VAR_0, bool VAR_1) { qemu_loglevel = VAR_0; if (qemu_loglevel && !qemu_logfile) { qemu_logfile = fopen(logfilename, log_append ? "a" : "w"); if (!qemu_logfile) { perror(logfilename); _exit(1); } if (VAR_1) { static char VAR_2[4096]; setvbuf(qemu_logfile, VAR_2, _IOLBF, sizeof(VAR_2)); } else { #if defined(_WIN32) setvbuf(qemu_logfile, NULL, _IONBF, 0); #else setvbuf(qemu_logfile, NULL, _IOLBF, 0); #endif log_append = 1; } } if (!qemu_loglevel && qemu_logfile) { fclose(qemu_logfile); qemu_logfile = NULL; } }
[ "void FUNC_0(int VAR_0, bool VAR_1)\n{", "qemu_loglevel = VAR_0;", "if (qemu_loglevel && !qemu_logfile) {", "qemu_logfile = fopen(logfilename, log_append ? \"a\" : \"w\");", "if (!qemu_logfile) {", "perror(logfilename);", "_exit(1);", "}", "if (VAR_1) {", "static char VAR_2[4096];", "setvbuf(qemu_logfile, VAR_2, _IOLBF, sizeof(VAR_2));", "} else {", "#if defined(_WIN32)\nsetvbuf(qemu_logfile, NULL, _IONBF, 0);", "#else\nsetvbuf(qemu_logfile, NULL, _IOLBF, 0);", "#endif\nlog_append = 1;", "}", "}", "if (!qemu_loglevel && qemu_logfile) {", "fclose(qemu_logfile);", "qemu_logfile = NULL;", "}", "}" ]
[ 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
4,983
static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { const uint32_t ddts_size = 20; AVStream *st = NULL; uint8_t *buf = NULL; uint32_t frame_duration_code = 0; uint32_t channel_layout_code = 0; GetBitContext gb; buf = av_malloc(ddts_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!buf) { return AVERROR(ENOMEM); } if (avio_read(pb, buf, ddts_size) < ddts_size) { return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf, 8*ddts_size); if (c->fc->nb_streams < 1) { return 0; } st = c->fc->streams[c->fc->nb_streams-1]; st->codecpar->sample_rate = get_bits_long(&gb, 32); if (st->codecpar->sample_rate <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate); return AVERROR_INVALIDDATA; } skip_bits_long(&gb, 32); /* max bitrate */ st->codecpar->bit_rate = get_bits_long(&gb, 32); st->codecpar->bits_per_coded_sample = get_bits(&gb, 8); frame_duration_code = get_bits(&gb, 2); skip_bits(&gb, 30); /* various fields */ channel_layout_code = get_bits(&gb, 16); st->codecpar->frame_size = (frame_duration_code == 0) ? 512 : (frame_duration_code == 1) ? 1024 : (frame_duration_code == 2) ? 2048 : (frame_duration_code == 3) ? 4096 : 0; if (channel_layout_code > 0xff) { av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel layout"); } st->codecpar->channel_layout = ((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_LEFT : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_RIGHT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_LEFT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_RIGHT : 0) | ((channel_layout_code & 0x8) ? AV_CH_LOW_FREQUENCY : 0); st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout); return 0; }
true
FFmpeg
4b54d5a721cc55288093417b098382bbb27a8d3f
static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { const uint32_t ddts_size = 20; AVStream *st = NULL; uint8_t *buf = NULL; uint32_t frame_duration_code = 0; uint32_t channel_layout_code = 0; GetBitContext gb; buf = av_malloc(ddts_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!buf) { return AVERROR(ENOMEM); } if (avio_read(pb, buf, ddts_size) < ddts_size) { return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf, 8*ddts_size); if (c->fc->nb_streams < 1) { return 0; } st = c->fc->streams[c->fc->nb_streams-1]; st->codecpar->sample_rate = get_bits_long(&gb, 32); if (st->codecpar->sample_rate <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate); return AVERROR_INVALIDDATA; } skip_bits_long(&gb, 32); st->codecpar->bit_rate = get_bits_long(&gb, 32); st->codecpar->bits_per_coded_sample = get_bits(&gb, 8); frame_duration_code = get_bits(&gb, 2); skip_bits(&gb, 30); channel_layout_code = get_bits(&gb, 16); st->codecpar->frame_size = (frame_duration_code == 0) ? 512 : (frame_duration_code == 1) ? 1024 : (frame_duration_code == 2) ? 2048 : (frame_duration_code == 3) ? 4096 : 0; if (channel_layout_code > 0xff) { av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel layout"); } st->codecpar->channel_layout = ((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_LEFT : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_RIGHT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_LEFT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_RIGHT : 0) | ((channel_layout_code & 0x8) ? AV_CH_LOW_FREQUENCY : 0); st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { const uint32_t VAR_3 = 20; AVStream *st = NULL; uint8_t *buf = NULL; uint32_t frame_duration_code = 0; uint32_t channel_layout_code = 0; GetBitContext gb; buf = av_malloc(VAR_3 + AV_INPUT_BUFFER_PADDING_SIZE); if (!buf) { return AVERROR(ENOMEM); } if (avio_read(VAR_1, buf, VAR_3) < VAR_3) { return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf, 8*VAR_3); if (VAR_0->fc->nb_streams < 1) { return 0; } st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; st->codecpar->sample_rate = get_bits_long(&gb, 32); if (st->codecpar->sample_rate <= 0) { av_log(VAR_0->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate); return AVERROR_INVALIDDATA; } skip_bits_long(&gb, 32); st->codecpar->bit_rate = get_bits_long(&gb, 32); st->codecpar->bits_per_coded_sample = get_bits(&gb, 8); frame_duration_code = get_bits(&gb, 2); skip_bits(&gb, 30); channel_layout_code = get_bits(&gb, 16); st->codecpar->frame_size = (frame_duration_code == 0) ? 512 : (frame_duration_code == 1) ? 1024 : (frame_duration_code == 2) ? 2048 : (frame_duration_code == 3) ? 4096 : 0; if (channel_layout_code > 0xff) { av_log(VAR_0->fc, AV_LOG_WARNING, "Unsupported DTS audio channel layout"); } st->codecpar->channel_layout = ((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_LEFT : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_RIGHT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_LEFT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_RIGHT : 0) | ((channel_layout_code & 0x8) ? AV_CH_LOW_FREQUENCY : 0); st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "const uint32_t VAR_3 = 20;", "AVStream *st = NULL;", "uint8_t *buf = NULL;", "uint32_t frame_duration_code = 0;", "uint32_t channel_layout_code = 0;", "GetBitContext gb;", "buf = av_malloc(VAR_3 + AV_INPUT_BUFFER_PADDING_SIZE);", "if (!buf) {", "return AVERROR(ENOMEM);", "}", "if (avio_read(VAR_1, buf, VAR_3) < VAR_3) {", "return AVERROR_INVALIDDATA;", "}", "init_get_bits(&gb, buf, 8*VAR_3);", "if (VAR_0->fc->nb_streams < 1) {", "return 0;", "}", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "st->codecpar->sample_rate = get_bits_long(&gb, 32);", "if (st->codecpar->sample_rate <= 0) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Invalid sample rate %d\\n\", st->codecpar->sample_rate);", "return AVERROR_INVALIDDATA;", "}", "skip_bits_long(&gb, 32);", "st->codecpar->bit_rate = get_bits_long(&gb, 32);", "st->codecpar->bits_per_coded_sample = get_bits(&gb, 8);", "frame_duration_code = get_bits(&gb, 2);", "skip_bits(&gb, 30);", "channel_layout_code = get_bits(&gb, 16);", "st->codecpar->frame_size =\n(frame_duration_code == 0) ? 512 :\n(frame_duration_code == 1) ? 1024 :\n(frame_duration_code == 2) ? 2048 :\n(frame_duration_code == 3) ? 4096 : 0;", "if (channel_layout_code > 0xff) {", "av_log(VAR_0->fc, AV_LOG_WARNING, \"Unsupported DTS audio channel layout\");", "}", "st->codecpar->channel_layout =\n((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) |\n((channel_layout_code & 0x2) ? AV_CH_FRONT_LEFT : 0) |\n((channel_layout_code & 0x2) ? AV_CH_FRONT_RIGHT : 0) |\n((channel_layout_code & 0x4) ? AV_CH_SIDE_LEFT : 0) |\n((channel_layout_code & 0x4) ? AV_CH_SIDE_RIGHT : 0) |\n((channel_layout_code & 0x8) ? AV_CH_LOW_FREQUENCY : 0);", "st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 30 ], [ 32 ], [ 36 ], [ 40 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 76, 78, 80, 82, 84 ], [ 88 ], [ 90 ], [ 92 ], [ 94, 96, 98, 100, 102, 104, 106 ], [ 110 ], [ 115 ], [ 117 ] ]
4,984
void OPPROTO op_check_subfo_64 (void) { if (likely(!(((uint64_t)(~T2) ^ (uint64_t)T1 ^ UINT64_MAX) & ((uint64_t)(~T2) ^ (uint64_t)T0) & (1ULL << 63)))) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } RETURN(); }
true
qemu
c3e10c7b4377c1cbc0a4fbc12312c2cf41c0cda7
void OPPROTO op_check_subfo_64 (void) { if (likely(!(((uint64_t)(~T2) ^ (uint64_t)T1 ^ UINT64_MAX) & ((uint64_t)(~T2) ^ (uint64_t)T0) & (1ULL << 63)))) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } RETURN(); }
{ "code": [ " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " RETURN();", "void OPPROTO op_check_subfo_64 (void)", " if (likely(!(((uint64_t)(~T2) ^ (uint64_t)T1 ^ UINT64_MAX) &", " ((uint64_t)(~T2) ^ (uint64_t)T0) & (1ULL << 63)))) {", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " RETURN();", " RETURN();", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;" ], "line_no": [ 9, 11, 13, 15, 9, 11, 13, 15, 9, 11, 13, 15, 19, 1, 5, 7, 9, 11, 13, 15, 19, 19, 9, 11, 13, 15, 9, 11, 13, 15, 9, 11, 13, 15, 9, 11, 13, 15, 9, 11, 13, 15, 9, 11, 13, 15, 9, 11, 13, 15 ] }
void VAR_0 op_check_subfo_64 (void) { if (likely(!(((uint64_t)(~T2) ^ (uint64_t)T1 ^ UINT64_MAX) & ((uint64_t)(~T2) ^ (uint64_t)T0) & (1ULL << 63)))) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } RETURN(); }
[ "void VAR_0 op_check_subfo_64 (void)\n{", "if (likely(!(((uint64_t)(~T2) ^ (uint64_t)T1 ^ UINT64_MAX) &\n((uint64_t)(~T2) ^ (uint64_t)T0) & (1ULL << 63)))) {", "xer_ov = 0;", "} else {", "xer_ov = 1;", "xer_so = 1;", "}", "RETURN();", "}" ]
[ 1, 1, 1, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
4,985
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len) { PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr); uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1); if (!pci_dev) return; PCI_DPRINTF("%s: %s: addr=%02" PRIx32 " val=%08" PRIx32 " len=%d\n", __func__, pci_dev->name, config_addr, val, len); pci_dev->config_write(pci_dev, config_addr, val, len); }
true
qemu
42e4126b793d15ec40f3a84017e1d8afecda1b6d
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len) { PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr); uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1); if (!pci_dev) return; PCI_DPRINTF("%s: %s: addr=%02" PRIx32 " val=%08" PRIx32 " len=%d\n", __func__, pci_dev->name, config_addr, val, len); pci_dev->config_write(pci_dev, config_addr, val, len); }
{ "code": [ " if (!pci_dev)", " pci_dev->config_write(pci_dev, config_addr, val, len);", " if (!pci_dev)" ], "line_no": [ 11, 21, 11 ] }
void FUNC_0(PCIBus *VAR_0, uint32_t VAR_1, uint32_t VAR_2, int VAR_3) { PCIDevice *pci_dev = pci_dev_find_by_addr(VAR_0, VAR_1); uint32_t config_addr = VAR_1 & (PCI_CONFIG_SPACE_SIZE - 1); if (!pci_dev) return; PCI_DPRINTF("%VAR_0: %VAR_0: VAR_1=%02" PRIx32 " VAR_2=%08" PRIx32 " VAR_3=%d\n", __func__, pci_dev->name, config_addr, VAR_2, VAR_3); pci_dev->config_write(pci_dev, config_addr, VAR_2, VAR_3); }
[ "void FUNC_0(PCIBus *VAR_0, uint32_t VAR_1, uint32_t VAR_2, int VAR_3)\n{", "PCIDevice *pci_dev = pci_dev_find_by_addr(VAR_0, VAR_1);", "uint32_t config_addr = VAR_1 & (PCI_CONFIG_SPACE_SIZE - 1);", "if (!pci_dev)\nreturn;", "PCI_DPRINTF(\"%VAR_0: %VAR_0: VAR_1=%02\" PRIx32 \" VAR_2=%08\" PRIx32 \" VAR_3=%d\\n\",\n__func__, pci_dev->name, config_addr, VAR_2, VAR_3);", "pci_dev->config_write(pci_dev, config_addr, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17, 19 ], [ 21 ], [ 23 ] ]
4,986
static int mkv_write_tags(AVFormatContext *s) { ebml_master tags = {0}; int i, ret; ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); if (av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); if (ret < 0) return ret; } for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (!av_dict_get(st->metadata, "", 0, AV_DICT_IGNORE_SUFFIX)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags); if (ret < 0) return ret; } for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; if (!av_dict_get(ch->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) continue; ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags); if (ret < 0) return ret; } if (tags.pos) end_ebml_master(s->pb, tags); return 0; }
false
FFmpeg
088ed5314694031e07e02e9d364c9d486a60e704
static int mkv_write_tags(AVFormatContext *s) { ebml_master tags = {0}; int i, ret; ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); if (av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); if (ret < 0) return ret; } for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (!av_dict_get(st->metadata, "", 0, AV_DICT_IGNORE_SUFFIX)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags); if (ret < 0) return ret; } for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; if (!av_dict_get(ch->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) continue; ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags); if (ret < 0) return ret; } if (tags.pos) end_ebml_master(s->pb, tags); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { ebml_master tags = {0}; int VAR_1, VAR_2; ff_metadata_conv_ctx(VAR_0, ff_mkv_metadata_conv, NULL); if (av_dict_get(VAR_0->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { VAR_2 = mkv_write_tag(VAR_0, VAR_0->metadata, 0, 0, &tags); if (VAR_2 < 0) return VAR_2; } for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st = VAR_0->streams[VAR_1]; if (!av_dict_get(st->metadata, "", 0, AV_DICT_IGNORE_SUFFIX)) continue; VAR_2 = mkv_write_tag(VAR_0, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, VAR_1 + 1, &tags); if (VAR_2 < 0) return VAR_2; } for (VAR_1 = 0; VAR_1 < VAR_0->nb_chapters; VAR_1++) { AVChapter *ch = VAR_0->chapters[VAR_1]; if (!av_dict_get(ch->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) continue; VAR_2 = mkv_write_tag(VAR_0, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags); if (VAR_2 < 0) return VAR_2; } if (tags.pos) end_ebml_master(VAR_0->pb, tags); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "ebml_master tags = {0};", "int VAR_1, VAR_2;", "ff_metadata_conv_ctx(VAR_0, ff_mkv_metadata_conv, NULL);", "if (av_dict_get(VAR_0->metadata, \"\", NULL, AV_DICT_IGNORE_SUFFIX)) {", "VAR_2 = mkv_write_tag(VAR_0, VAR_0->metadata, 0, 0, &tags);", "if (VAR_2 < 0) return VAR_2;", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st = VAR_0->streams[VAR_1];", "if (!av_dict_get(st->metadata, \"\", 0, AV_DICT_IGNORE_SUFFIX))\ncontinue;", "VAR_2 = mkv_write_tag(VAR_0, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, VAR_1 + 1, &tags);", "if (VAR_2 < 0) return VAR_2;", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_chapters; VAR_1++) {", "AVChapter *ch = VAR_0->chapters[VAR_1];", "if (!av_dict_get(ch->metadata, \"\", NULL, AV_DICT_IGNORE_SUFFIX))\ncontinue;", "VAR_2 = mkv_write_tag(VAR_0, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags);", "if (VAR_2 < 0) return VAR_2;", "}", "if (tags.pos)\nend_ebml_master(VAR_0->pb, tags);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ] ]
4,987
static av_always_inline void mc_chroma_dir(VP9Context *s, vp9_mc_func(*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, int bw, int bh, int w, int h) { int mx = mv->x, my = mv->y; int th; y += my >> 4; x += mx >> 4; ref_u += y * src_stride_u + x; ref_v += y * src_stride_v + x; mx &= 15; my &= 15; // we use +7 because the last 7 pixels of each sbrow can be changed in // the longest loopfilter of the next sbrow th = (y + bh + 4 * !!my + 7) >> 5; ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0); // FIXME bilinear filter only needs 0/1 pixels, not 3/4 if (x < !!mx * 3 || y < !!my * 3 || x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_u - !!my * 3 * src_stride_u - !!mx * 3, 80, src_stride_u, bw + !!mx * 7, bh + !!my * 7, x - !!mx * 3, y - !!my * 3, w, h); ref_u = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3; mc[!!mx][!!my](dst_u, dst_stride, ref_u, 80, bh, mx, my); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_v - !!my * 3 * src_stride_v - !!mx * 3, 80, src_stride_v, bw + !!mx * 7, bh + !!my * 7, x - !!mx * 3, y - !!my * 3, w, h); ref_v = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3; mc[!!mx][!!my](dst_v, dst_stride, ref_v, 80, bh, mx, my); } else { mc[!!mx][!!my](dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my); mc[!!mx][!!my](dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my); } }
true
FFmpeg
ffbd1d2b0002576ef0d976a41ff959c635373fdc
static av_always_inline void mc_chroma_dir(VP9Context *s, vp9_mc_func(*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, int bw, int bh, int w, int h) { int mx = mv->x, my = mv->y; int th; y += my >> 4; x += mx >> 4; ref_u += y * src_stride_u + x; ref_v += y * src_stride_v + x; mx &= 15; my &= 15; th = (y + bh + 4 * !!my + 7) >> 5; ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0); if (x < !!mx * 3 || y < !!my * 3 || x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_u - !!my * 3 * src_stride_u - !!mx * 3, 80, src_stride_u, bw + !!mx * 7, bh + !!my * 7, x - !!mx * 3, y - !!my * 3, w, h); ref_u = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3; mc[!!mx][!!my](dst_u, dst_stride, ref_u, 80, bh, mx, my); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_v - !!my * 3 * src_stride_v - !!mx * 3, 80, src_stride_v, bw + !!mx * 7, bh + !!my * 7, x - !!mx * 3, y - !!my * 3, w, h); ref_v = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3; mc[!!mx][!!my](dst_v, dst_stride, ref_v, 80, bh, mx, my); } else { mc[!!mx][!!my](dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my); mc[!!mx][!!my](dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my); } }
{ "code": [ " x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) {", " x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) {" ], "line_no": [ 59, 59 ] }
static av_always_inline void FUNC_0(VP9Context *s, vp9_mc_func(*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, int bw, int bh, int w, int h) { int VAR_0 = mv->x, VAR_1 = mv->y; int VAR_2; y += VAR_1 >> 4; x += VAR_0 >> 4; ref_u += y * src_stride_u + x; ref_v += y * src_stride_v + x; VAR_0 &= 15; VAR_1 &= 15; VAR_2 = (y + bh + 4 * !!VAR_1 + 7) >> 5; ff_thread_await_progress(ref_frame, FFMAX(VAR_2, 0), 0); if (x < !!VAR_0 * 3 || y < !!VAR_1 * 3 || x + !!VAR_0 * 4 > w - bw || y + !!VAR_1 * 4 > h - bh) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_u - !!VAR_1 * 3 * src_stride_u - !!VAR_0 * 3, 80, src_stride_u, bw + !!VAR_0 * 7, bh + !!VAR_1 * 7, x - !!VAR_0 * 3, y - !!VAR_1 * 3, w, h); ref_u = s->edge_emu_buffer + !!VAR_1 * 3 * 80 + !!VAR_0 * 3; mc[!!VAR_0][!!VAR_1](dst_u, dst_stride, ref_u, 80, bh, VAR_0, VAR_1); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_v - !!VAR_1 * 3 * src_stride_v - !!VAR_0 * 3, 80, src_stride_v, bw + !!VAR_0 * 7, bh + !!VAR_1 * 7, x - !!VAR_0 * 3, y - !!VAR_1 * 3, w, h); ref_v = s->edge_emu_buffer + !!VAR_1 * 3 * 80 + !!VAR_0 * 3; mc[!!VAR_0][!!VAR_1](dst_v, dst_stride, ref_v, 80, bh, VAR_0, VAR_1); } else { mc[!!VAR_0][!!VAR_1](dst_u, dst_stride, ref_u, src_stride_u, bh, VAR_0, VAR_1); mc[!!VAR_0][!!VAR_1](dst_v, dst_stride, ref_v, src_stride_v, bh, VAR_0, VAR_1); } }
[ "static av_always_inline void FUNC_0(VP9Context *s, vp9_mc_func(*mc)[2],\nuint8_t *dst_u, uint8_t *dst_v,\nptrdiff_t dst_stride,\nconst uint8_t *ref_u,\nptrdiff_t src_stride_u,\nconst uint8_t *ref_v,\nptrdiff_t src_stride_v,\nThreadFrame *ref_frame,\nptrdiff_t y, ptrdiff_t x,\nconst VP56mv *mv,\nint bw, int bh, int w, int h)\n{", "int VAR_0 = mv->x, VAR_1 = mv->y;", "int VAR_2;", "y += VAR_1 >> 4;", "x += VAR_0 >> 4;", "ref_u += y * src_stride_u + x;", "ref_v += y * src_stride_v + x;", "VAR_0 &= 15;", "VAR_1 &= 15;", "VAR_2 = (y + bh + 4 * !!VAR_1 + 7) >> 5;", "ff_thread_await_progress(ref_frame, FFMAX(VAR_2, 0), 0);", "if (x < !!VAR_0 * 3 || y < !!VAR_1 * 3 ||\nx + !!VAR_0 * 4 > w - bw || y + !!VAR_1 * 4 > h - bh) {", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer,\nref_u - !!VAR_1 * 3 * src_stride_u - !!VAR_0 * 3,\n80,\nsrc_stride_u,\nbw + !!VAR_0 * 7, bh + !!VAR_1 * 7,\nx - !!VAR_0 * 3, y - !!VAR_1 * 3, w, h);", "ref_u = s->edge_emu_buffer + !!VAR_1 * 3 * 80 + !!VAR_0 * 3;", "mc[!!VAR_0][!!VAR_1](dst_u, dst_stride, ref_u, 80, bh, VAR_0, VAR_1);", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer,\nref_v - !!VAR_1 * 3 * src_stride_v - !!VAR_0 * 3,\n80,\nsrc_stride_v,\nbw + !!VAR_0 * 7, bh + !!VAR_1 * 7,\nx - !!VAR_0 * 3, y - !!VAR_1 * 3, w, h);", "ref_v = s->edge_emu_buffer + !!VAR_1 * 3 * 80 + !!VAR_0 * 3;", "mc[!!VAR_0][!!VAR_1](dst_v, dst_stride, ref_v, 80, bh, VAR_0, VAR_1);", "} else {", "mc[!!VAR_0][!!VAR_1](dst_u, dst_stride, ref_u, src_stride_u, bh, VAR_0, VAR_1);", "mc[!!VAR_0][!!VAR_1](dst_v, dst_stride, ref_v, src_stride_v, bh, VAR_0, VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 49 ], [ 51 ], [ 57, 59 ], [ 61, 63, 65, 67, 69, 71 ], [ 73 ], [ 75 ], [ 79, 81, 83, 85, 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ] ]
4,988
void qmp_drive_mirror(DriveMirror *arg, Error **errp) { BlockDriverState *bs; BlockDriverState *source, *target_bs; AioContext *aio_context; BlockMirrorBackingMode backing_mode; Error *local_err = NULL; QDict *options = NULL; int flags; int64_t size; const char *format = arg->format; bs = qmp_get_root_bs(arg->device, errp); if (!bs) { return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (!arg->has_mode) { arg->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } if (!arg->has_format) { format = (arg->mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name); } flags = bs->open_flags | BDRV_O_RDWR; source = backing_bs(bs); if (!source && arg->sync == MIRROR_SYNC_MODE_TOP) { arg->sync = MIRROR_SYNC_MODE_FULL; } if (arg->sync == MIRROR_SYNC_MODE_NONE) { source = bs; } size = bdrv_getlength(bs); if (size < 0) { error_setg_errno(errp, -size, "bdrv_getlength failed"); goto out; } if (arg->has_replaces) { BlockDriverState *to_replace_bs; AioContext *replace_aio_context; int64_t replace_size; if (!arg->has_node_name) { error_setg(errp, "a node-name must be provided when replacing a" " named node of the graph"); goto out; } to_replace_bs = check_to_replace_node(bs, arg->replaces, &local_err); if (!to_replace_bs) { error_propagate(errp, local_err); goto out; } replace_aio_context = bdrv_get_aio_context(to_replace_bs); aio_context_acquire(replace_aio_context); replace_size = bdrv_getlength(to_replace_bs); aio_context_release(replace_aio_context); if (size != replace_size) { error_setg(errp, "cannot replace image with a mirror image of " "different size"); goto out; } } if (arg->mode == NEW_IMAGE_MODE_ABSOLUTE_PATHS) { backing_mode = MIRROR_SOURCE_BACKING_CHAIN; } else { backing_mode = MIRROR_OPEN_BACKING_CHAIN; } if ((arg->sync == MIRROR_SYNC_MODE_FULL || !source) && arg->mode != NEW_IMAGE_MODE_EXISTING) { /* create new image w/o backing file */ assert(format); bdrv_img_create(arg->target, format, NULL, NULL, NULL, size, flags, false, &local_err); } else { switch (arg->mode) { case NEW_IMAGE_MODE_EXISTING: break; case NEW_IMAGE_MODE_ABSOLUTE_PATHS: /* create new image with backing file */ bdrv_img_create(arg->target, format, source->filename, source->drv->format_name, NULL, size, flags, false, &local_err); break; default: abort(); } } if (local_err) { error_propagate(errp, local_err); goto out; } options = qdict_new(); if (arg->has_node_name) { qdict_put_str(options, "node-name", arg->node_name); } if (format) { qdict_put_str(options, "driver", format); } /* Mirroring takes care of copy-on-write using the source's backing * file. */ target_bs = bdrv_open(arg->target, NULL, options, flags | BDRV_O_NO_BACKING, errp); if (!target_bs) { goto out; } bdrv_set_aio_context(target_bs, aio_context); blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs, arg->has_replaces, arg->replaces, arg->sync, backing_mode, arg->has_speed, arg->speed, arg->has_granularity, arg->granularity, arg->has_buf_size, arg->buf_size, arg->has_on_source_error, arg->on_source_error, arg->has_on_target_error, arg->on_target_error, arg->has_unmap, arg->unmap, false, NULL, &local_err); bdrv_unref(target_bs); error_propagate(errp, local_err); out: aio_context_release(aio_context); }
true
qemu
2a32c6e82ed24d837ce7af346ffc93113f0164b5
void qmp_drive_mirror(DriveMirror *arg, Error **errp) { BlockDriverState *bs; BlockDriverState *source, *target_bs; AioContext *aio_context; BlockMirrorBackingMode backing_mode; Error *local_err = NULL; QDict *options = NULL; int flags; int64_t size; const char *format = arg->format; bs = qmp_get_root_bs(arg->device, errp); if (!bs) { return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (!arg->has_mode) { arg->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } if (!arg->has_format) { format = (arg->mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name); } flags = bs->open_flags | BDRV_O_RDWR; source = backing_bs(bs); if (!source && arg->sync == MIRROR_SYNC_MODE_TOP) { arg->sync = MIRROR_SYNC_MODE_FULL; } if (arg->sync == MIRROR_SYNC_MODE_NONE) { source = bs; } size = bdrv_getlength(bs); if (size < 0) { error_setg_errno(errp, -size, "bdrv_getlength failed"); goto out; } if (arg->has_replaces) { BlockDriverState *to_replace_bs; AioContext *replace_aio_context; int64_t replace_size; if (!arg->has_node_name) { error_setg(errp, "a node-name must be provided when replacing a" " named node of the graph"); goto out; } to_replace_bs = check_to_replace_node(bs, arg->replaces, &local_err); if (!to_replace_bs) { error_propagate(errp, local_err); goto out; } replace_aio_context = bdrv_get_aio_context(to_replace_bs); aio_context_acquire(replace_aio_context); replace_size = bdrv_getlength(to_replace_bs); aio_context_release(replace_aio_context); if (size != replace_size) { error_setg(errp, "cannot replace image with a mirror image of " "different size"); goto out; } } if (arg->mode == NEW_IMAGE_MODE_ABSOLUTE_PATHS) { backing_mode = MIRROR_SOURCE_BACKING_CHAIN; } else { backing_mode = MIRROR_OPEN_BACKING_CHAIN; } if ((arg->sync == MIRROR_SYNC_MODE_FULL || !source) && arg->mode != NEW_IMAGE_MODE_EXISTING) { assert(format); bdrv_img_create(arg->target, format, NULL, NULL, NULL, size, flags, false, &local_err); } else { switch (arg->mode) { case NEW_IMAGE_MODE_EXISTING: break; case NEW_IMAGE_MODE_ABSOLUTE_PATHS: bdrv_img_create(arg->target, format, source->filename, source->drv->format_name, NULL, size, flags, false, &local_err); break; default: abort(); } } if (local_err) { error_propagate(errp, local_err); goto out; } options = qdict_new(); if (arg->has_node_name) { qdict_put_str(options, "node-name", arg->node_name); } if (format) { qdict_put_str(options, "driver", format); } target_bs = bdrv_open(arg->target, NULL, options, flags | BDRV_O_NO_BACKING, errp); if (!target_bs) { goto out; } bdrv_set_aio_context(target_bs, aio_context); blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs, arg->has_replaces, arg->replaces, arg->sync, backing_mode, arg->has_speed, arg->speed, arg->has_granularity, arg->granularity, arg->has_buf_size, arg->buf_size, arg->has_on_source_error, arg->on_source_error, arg->has_on_target_error, arg->on_target_error, arg->has_unmap, arg->unmap, false, NULL, &local_err); bdrv_unref(target_bs); error_propagate(errp, local_err); out: aio_context_release(aio_context); }
{ "code": [ " target_bs = bdrv_open(arg->target, NULL, options,", " flags | BDRV_O_NO_BACKING, errp);" ], "line_no": [ 239, 241 ] }
void FUNC_0(DriveMirror *VAR_0, Error **VAR_1) { BlockDriverState *bs; BlockDriverState *source, *target_bs; AioContext *aio_context; BlockMirrorBackingMode backing_mode; Error *local_err = NULL; QDict *options = NULL; int VAR_2; int64_t size; const char *VAR_3 = VAR_0->VAR_3; bs = qmp_get_root_bs(VAR_0->device, VAR_1); if (!bs) { return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (!VAR_0->has_mode) { VAR_0->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } if (!VAR_0->has_format) { VAR_3 = (VAR_0->mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name); } VAR_2 = bs->open_flags | BDRV_O_RDWR; source = backing_bs(bs); if (!source && VAR_0->sync == MIRROR_SYNC_MODE_TOP) { VAR_0->sync = MIRROR_SYNC_MODE_FULL; } if (VAR_0->sync == MIRROR_SYNC_MODE_NONE) { source = bs; } size = bdrv_getlength(bs); if (size < 0) { error_setg_errno(VAR_1, -size, "bdrv_getlength failed"); goto out; } if (VAR_0->has_replaces) { BlockDriverState *to_replace_bs; AioContext *replace_aio_context; int64_t replace_size; if (!VAR_0->has_node_name) { error_setg(VAR_1, "a node-name must be provided when replacing a" " named node of the graph"); goto out; } to_replace_bs = check_to_replace_node(bs, VAR_0->replaces, &local_err); if (!to_replace_bs) { error_propagate(VAR_1, local_err); goto out; } replace_aio_context = bdrv_get_aio_context(to_replace_bs); aio_context_acquire(replace_aio_context); replace_size = bdrv_getlength(to_replace_bs); aio_context_release(replace_aio_context); if (size != replace_size) { error_setg(VAR_1, "cannot replace image with a mirror image of " "different size"); goto out; } } if (VAR_0->mode == NEW_IMAGE_MODE_ABSOLUTE_PATHS) { backing_mode = MIRROR_SOURCE_BACKING_CHAIN; } else { backing_mode = MIRROR_OPEN_BACKING_CHAIN; } if ((VAR_0->sync == MIRROR_SYNC_MODE_FULL || !source) && VAR_0->mode != NEW_IMAGE_MODE_EXISTING) { assert(VAR_3); bdrv_img_create(VAR_0->target, VAR_3, NULL, NULL, NULL, size, VAR_2, false, &local_err); } else { switch (VAR_0->mode) { case NEW_IMAGE_MODE_EXISTING: break; case NEW_IMAGE_MODE_ABSOLUTE_PATHS: bdrv_img_create(VAR_0->target, VAR_3, source->filename, source->drv->format_name, NULL, size, VAR_2, false, &local_err); break; default: abort(); } } if (local_err) { error_propagate(VAR_1, local_err); goto out; } options = qdict_new(); if (VAR_0->has_node_name) { qdict_put_str(options, "node-name", VAR_0->node_name); } if (VAR_3) { qdict_put_str(options, "driver", VAR_3); } target_bs = bdrv_open(VAR_0->target, NULL, options, VAR_2 | BDRV_O_NO_BACKING, VAR_1); if (!target_bs) { goto out; } bdrv_set_aio_context(target_bs, aio_context); blockdev_mirror_common(VAR_0->has_job_id ? VAR_0->job_id : NULL, bs, target_bs, VAR_0->has_replaces, VAR_0->replaces, VAR_0->sync, backing_mode, VAR_0->has_speed, VAR_0->speed, VAR_0->has_granularity, VAR_0->granularity, VAR_0->has_buf_size, VAR_0->buf_size, VAR_0->has_on_source_error, VAR_0->on_source_error, VAR_0->has_on_target_error, VAR_0->on_target_error, VAR_0->has_unmap, VAR_0->unmap, false, NULL, &local_err); bdrv_unref(target_bs); error_propagate(VAR_1, local_err); out: aio_context_release(aio_context); }
[ "void FUNC_0(DriveMirror *VAR_0, Error **VAR_1)\n{", "BlockDriverState *bs;", "BlockDriverState *source, *target_bs;", "AioContext *aio_context;", "BlockMirrorBackingMode backing_mode;", "Error *local_err = NULL;", "QDict *options = NULL;", "int VAR_2;", "int64_t size;", "const char *VAR_3 = VAR_0->VAR_3;", "bs = qmp_get_root_bs(VAR_0->device, VAR_1);", "if (!bs) {", "return;", "}", "aio_context = bdrv_get_aio_context(bs);", "aio_context_acquire(aio_context);", "if (!VAR_0->has_mode) {", "VAR_0->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;", "}", "if (!VAR_0->has_format) {", "VAR_3 = (VAR_0->mode == NEW_IMAGE_MODE_EXISTING\n? NULL : bs->drv->format_name);", "}", "VAR_2 = bs->open_flags | BDRV_O_RDWR;", "source = backing_bs(bs);", "if (!source && VAR_0->sync == MIRROR_SYNC_MODE_TOP) {", "VAR_0->sync = MIRROR_SYNC_MODE_FULL;", "}", "if (VAR_0->sync == MIRROR_SYNC_MODE_NONE) {", "source = bs;", "}", "size = bdrv_getlength(bs);", "if (size < 0) {", "error_setg_errno(VAR_1, -size, \"bdrv_getlength failed\");", "goto out;", "}", "if (VAR_0->has_replaces) {", "BlockDriverState *to_replace_bs;", "AioContext *replace_aio_context;", "int64_t replace_size;", "if (!VAR_0->has_node_name) {", "error_setg(VAR_1, \"a node-name must be provided when replacing a\"\n\" named node of the graph\");", "goto out;", "}", "to_replace_bs = check_to_replace_node(bs, VAR_0->replaces, &local_err);", "if (!to_replace_bs) {", "error_propagate(VAR_1, local_err);", "goto out;", "}", "replace_aio_context = bdrv_get_aio_context(to_replace_bs);", "aio_context_acquire(replace_aio_context);", "replace_size = bdrv_getlength(to_replace_bs);", "aio_context_release(replace_aio_context);", "if (size != replace_size) {", "error_setg(VAR_1, \"cannot replace image with a mirror image of \"\n\"different size\");", "goto out;", "}", "}", "if (VAR_0->mode == NEW_IMAGE_MODE_ABSOLUTE_PATHS) {", "backing_mode = MIRROR_SOURCE_BACKING_CHAIN;", "} else {", "backing_mode = MIRROR_OPEN_BACKING_CHAIN;", "}", "if ((VAR_0->sync == MIRROR_SYNC_MODE_FULL || !source)\n&& VAR_0->mode != NEW_IMAGE_MODE_EXISTING)\n{", "assert(VAR_3);", "bdrv_img_create(VAR_0->target, VAR_3,\nNULL, NULL, NULL, size, VAR_2, false, &local_err);", "} else {", "switch (VAR_0->mode) {", "case NEW_IMAGE_MODE_EXISTING:\nbreak;", "case NEW_IMAGE_MODE_ABSOLUTE_PATHS:\nbdrv_img_create(VAR_0->target, VAR_3,\nsource->filename,\nsource->drv->format_name,\nNULL, size, VAR_2, false, &local_err);", "break;", "default:\nabort();", "}", "}", "if (local_err) {", "error_propagate(VAR_1, local_err);", "goto out;", "}", "options = qdict_new();", "if (VAR_0->has_node_name) {", "qdict_put_str(options, \"node-name\", VAR_0->node_name);", "}", "if (VAR_3) {", "qdict_put_str(options, \"driver\", VAR_3);", "}", "target_bs = bdrv_open(VAR_0->target, NULL, options,\nVAR_2 | BDRV_O_NO_BACKING, VAR_1);", "if (!target_bs) {", "goto out;", "}", "bdrv_set_aio_context(target_bs, aio_context);", "blockdev_mirror_common(VAR_0->has_job_id ? VAR_0->job_id : NULL, bs, target_bs,\nVAR_0->has_replaces, VAR_0->replaces, VAR_0->sync,\nbacking_mode, VAR_0->has_speed, VAR_0->speed,\nVAR_0->has_granularity, VAR_0->granularity,\nVAR_0->has_buf_size, VAR_0->buf_size,\nVAR_0->has_on_source_error, VAR_0->on_source_error,\nVAR_0->has_on_target_error, VAR_0->on_target_error,\nVAR_0->has_unmap, VAR_0->unmap,\nfalse, NULL,\n&local_err);", "bdrv_unref(target_bs);", "error_propagate(VAR_1, local_err);", "out:\naio_context_release(aio_context);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161, 163, 165 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183, 187, 189, 191, 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 255, 257, 259, 261, 263, 265, 267, 269, 271, 273 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283 ] ]
4,989
void ff_thread_report_progress(ThreadFrame *f, int n, int field) { PerThreadContext *p; atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL; if (!progress || atomic_load_explicit(&progress[field], memory_order_relaxed) >= n) return; p = f->owner[field]->internal->thread_ctx; if (f->owner[field]->debug&FF_DEBUG_THREADS) av_log(f->owner[field], AV_LOG_DEBUG, "%p finished %d field %d\n", progress, n, field); pthread_mutex_lock(&p->progress_mutex); atomic_store_explicit(&progress[field], n, memory_order_release); pthread_cond_broadcast(&p->progress_cond); pthread_mutex_unlock(&p->progress_mutex); }
true
FFmpeg
2e664b9c1e73c80aab91070c1eb7676f04bdd12d
void ff_thread_report_progress(ThreadFrame *f, int n, int field) { PerThreadContext *p; atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL; if (!progress || atomic_load_explicit(&progress[field], memory_order_relaxed) >= n) return; p = f->owner[field]->internal->thread_ctx; if (f->owner[field]->debug&FF_DEBUG_THREADS) av_log(f->owner[field], AV_LOG_DEBUG, "%p finished %d field %d\n", progress, n, field); pthread_mutex_lock(&p->progress_mutex); atomic_store_explicit(&progress[field], n, memory_order_release); pthread_cond_broadcast(&p->progress_cond); pthread_mutex_unlock(&p->progress_mutex); }
{ "code": [ " pthread_mutex_lock(&p->progress_mutex);", " pthread_mutex_lock(&p->progress_mutex);" ], "line_no": [ 31, 31 ] }
void FUNC_0(ThreadFrame *VAR_0, int VAR_1, int VAR_2) { PerThreadContext *p; atomic_int *progress = VAR_0->progress ? (atomic_int*)VAR_0->progress->data : NULL; if (!progress || atomic_load_explicit(&progress[VAR_2], memory_order_relaxed) >= VAR_1) return; p = VAR_0->owner[VAR_2]->internal->thread_ctx; if (VAR_0->owner[VAR_2]->debug&FF_DEBUG_THREADS) av_log(VAR_0->owner[VAR_2], AV_LOG_DEBUG, "%p finished %d VAR_2 %d\VAR_1", progress, VAR_1, VAR_2); pthread_mutex_lock(&p->progress_mutex); atomic_store_explicit(&progress[VAR_2], VAR_1, memory_order_release); pthread_cond_broadcast(&p->progress_cond); pthread_mutex_unlock(&p->progress_mutex); }
[ "void FUNC_0(ThreadFrame *VAR_0, int VAR_1, int VAR_2)\n{", "PerThreadContext *p;", "atomic_int *progress = VAR_0->progress ? (atomic_int*)VAR_0->progress->data : NULL;", "if (!progress ||\natomic_load_explicit(&progress[VAR_2], memory_order_relaxed) >= VAR_1)\nreturn;", "p = VAR_0->owner[VAR_2]->internal->thread_ctx;", "if (VAR_0->owner[VAR_2]->debug&FF_DEBUG_THREADS)\nav_log(VAR_0->owner[VAR_2], AV_LOG_DEBUG,\n\"%p finished %d VAR_2 %d\\VAR_1\", progress, VAR_1, VAR_2);", "pthread_mutex_lock(&p->progress_mutex);", "atomic_store_explicit(&progress[VAR_2], VAR_1, memory_order_release);", "pthread_cond_broadcast(&p->progress_cond);", "pthread_mutex_unlock(&p->progress_mutex);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13, 15 ], [ 19 ], [ 23, 25, 27 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ] ]
4,990
static inline int64_t bs_get_v(const uint8_t **bs) { int64_t v = 0; int br = 0; int c; do { c = **bs; (*bs)++; v <<= 7; v |= c & 0x7F; br++; if (br > 10) return -1; } while (c & 0x80); return v - br; }
true
FFmpeg
05e161952954acf247e0fd1fdef00559675c4d4d
static inline int64_t bs_get_v(const uint8_t **bs) { int64_t v = 0; int br = 0; int c; do { c = **bs; (*bs)++; v <<= 7; v |= c & 0x7F; br++; if (br > 10) return -1; } while (c & 0x80); return v - br; }
{ "code": [ " int64_t v = 0;", " int64_t v = 0;" ], "line_no": [ 5, 5 ] }
static inline int64_t FUNC_0(const uint8_t **bs) { int64_t v = 0; int VAR_0 = 0; int VAR_1; do { VAR_1 = **bs; (*bs)++; v <<= 7; v |= VAR_1 & 0x7F; VAR_0++; if (VAR_0 > 10) return -1; } while (VAR_1 & 0x80); return v - VAR_0; }
[ "static inline int64_t FUNC_0(const uint8_t **bs)\n{", "int64_t v = 0;", "int VAR_0 = 0;", "int VAR_1;", "do {", "VAR_1 = **bs; (*bs)++;", "v <<= 7;", "v |= VAR_1 & 0x7F;", "VAR_0++;", "if (VAR_0 > 10)\nreturn -1;", "} while (VAR_1 & 0x80);", "return v - VAR_0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ] ]
4,993
static int nbd_receive_request(int csock, struct nbd_request *request) { uint8_t buf[4 + 4 + 8 + 8 + 4]; uint32_t magic; if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } /* Request [ 0 .. 3] magic (NBD_REQUEST_MAGIC) [ 4 .. 7] type (0 == READ, 1 == WRITE) [ 8 .. 15] handle [16 .. 23] from [24 .. 27] len */ magic = be32_to_cpup((uint32_t*)buf); request->type = be32_to_cpup((uint32_t*)(buf + 4)); request->handle = be64_to_cpup((uint64_t*)(buf + 8)); request->from = be64_to_cpup((uint64_t*)(buf + 16)); request->len = be32_to_cpup((uint32_t*)(buf + 24)); TRACE("Got request: " "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }", magic, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
true
qemu
94e7340b5db8bce7866e44e700ffa8fd26585c7e
static int nbd_receive_request(int csock, struct nbd_request *request) { uint8_t buf[4 + 4 + 8 + 8 + 4]; uint32_t magic; if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } magic = be32_to_cpup((uint32_t*)buf); request->type = be32_to_cpup((uint32_t*)(buf + 4)); request->handle = be64_to_cpup((uint64_t*)(buf + 8)); request->from = be64_to_cpup((uint64_t*)(buf + 16)); request->len = be32_to_cpup((uint32_t*)(buf + 24)); TRACE("Got request: " "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }", magic, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
{ "code": [ "static int nbd_receive_request(int csock, struct nbd_request *request)" ], "line_no": [ 1 ] }
static int FUNC_0(int VAR_0, struct nbd_request *VAR_1) { uint8_t buf[4 + 4 + 8 + 8 + 4]; uint32_t magic; if (read_sync(VAR_0, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } magic = be32_to_cpup((uint32_t*)buf); VAR_1->type = be32_to_cpup((uint32_t*)(buf + 4)); VAR_1->handle = be64_to_cpup((uint64_t*)(buf + 8)); VAR_1->from = be64_to_cpup((uint64_t*)(buf + 16)); VAR_1->len = be32_to_cpup((uint32_t*)(buf + 24)); TRACE("Got VAR_1: " "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }", magic, VAR_1->type, VAR_1->from, VAR_1->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
[ "static int FUNC_0(int VAR_0, struct nbd_request *VAR_1)\n{", "uint8_t buf[4 + 4 + 8 + 8 + 4];", "uint32_t magic;", "if (read_sync(VAR_0, buf, sizeof(buf)) != sizeof(buf)) {", "LOG(\"read failed\");", "errno = EINVAL;", "return -1;", "}", "magic = be32_to_cpup((uint32_t*)buf);", "VAR_1->type = be32_to_cpup((uint32_t*)(buf + 4));", "VAR_1->handle = be64_to_cpup((uint64_t*)(buf + 8));", "VAR_1->from = be64_to_cpup((uint64_t*)(buf + 16));", "VAR_1->len = be32_to_cpup((uint32_t*)(buf + 24));", "TRACE(\"Got VAR_1: \"\n\"{ magic = 0x%x, .type = %d, from = %\" PRIu64\" , len = %u }\",", "magic, VAR_1->type, VAR_1->from, VAR_1->len);", "if (magic != NBD_REQUEST_MAGIC) {", "LOG(\"invalid magic (got 0x%x)\", magic);", "errno = EINVAL;", "return -1;", "}", "return 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 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
4,994
static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) { VP56RangeCoder *c = &s->c; int parse_filter_info = 0; int coeff_offset = 0; int vrt_shift = 0; int sub_version; int rows, cols; int res = 0; int ret; int separated_coeff = buf[0] & 1; s->frames[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80); ff_vp56_init_dequant(s, (buf[0] >> 1) & 0x3F); if (s->frames[VP56_FRAME_CURRENT]->key_frame) { sub_version = buf[1] >> 3; if (sub_version > 8) return AVERROR_INVALIDDATA; s->filter_header = buf[1] & 0x06; if (buf[1] & 1) { avpriv_report_missing_feature(s->avctx, "Interlacing"); return AVERROR_PATCHWELCOME; } if (separated_coeff || !s->filter_header) { coeff_offset = AV_RB16(buf+2) - 2; buf += 2; buf_size -= 2; } rows = buf[2]; /* number of stored macroblock rows */ cols = buf[3]; /* number of stored macroblock cols */ /* buf[4] is number of displayed macroblock rows */ /* buf[5] is number of displayed macroblock cols */ if (!rows || !cols) { av_log(s->avctx, AV_LOG_ERROR, "Invalid size %dx%d\n", cols << 4, rows << 4); return AVERROR_INVALIDDATA; } if (!s->macroblocks || /* first frame */ 16*cols != s->avctx->coded_width || 16*rows != s->avctx->coded_height) { if (s->avctx->extradata_size == 0 && FFALIGN(s->avctx->width, 16) == 16 * cols && FFALIGN(s->avctx->height, 16) == 16 * rows) { // We assume this is properly signalled container cropping, // in an F4V file. Just set the coded_width/height, don't // touch the cropped ones. s->avctx->coded_width = 16 * cols; s->avctx->coded_height = 16 * rows; } else { ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows); if (ret < 0) return ret; if (s->avctx->extradata_size == 1) { s->avctx->width -= s->avctx->extradata[0] >> 4; s->avctx->height -= s->avctx->extradata[0] & 0x0F; } } res = VP56_SIZE_CHANGE; } ret = ff_vp56_init_range_decoder(c, buf+6, buf_size-6); if (ret < 0) return ret; vp56_rac_gets(c, 2); parse_filter_info = s->filter_header; if (sub_version < 8) vrt_shift = 5; s->sub_version = sub_version; s->golden_frame = 0; } else { if (!s->sub_version || !s->avctx->coded_width || !s->avctx->coded_height) return AVERROR_INVALIDDATA; if (separated_coeff || !s->filter_header) { coeff_offset = AV_RB16(buf+1) - 2; buf += 2; buf_size -= 2; } ret = ff_vp56_init_range_decoder(c, buf+1, buf_size-1); if (ret < 0) return ret; s->golden_frame = vp56_rac_get(c); if (s->filter_header) { s->deblock_filtering = vp56_rac_get(c); if (s->deblock_filtering) vp56_rac_get(c); if (s->sub_version > 7) parse_filter_info = vp56_rac_get(c); } } if (parse_filter_info) { if (vp56_rac_get(c)) { s->filter_mode = 2; s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift; s->max_vector_length = 2 << vp56_rac_gets(c, 3); } else if (vp56_rac_get(c)) { s->filter_mode = 1; } else { s->filter_mode = 0; } if (s->sub_version > 7) s->filter_selection = vp56_rac_gets(c, 4); else s->filter_selection = 16; } s->use_huffman = vp56_rac_get(c); s->parse_coeff = vp6_parse_coeff; if (coeff_offset) { buf += coeff_offset; buf_size -= coeff_offset; if (buf_size < 0) { if (s->frames[VP56_FRAME_CURRENT]->key_frame) ff_set_dimensions(s->avctx, 0, 0); return AVERROR_INVALIDDATA; } if (s->use_huffman) { s->parse_coeff = vp6_parse_coeff_huffman; init_get_bits(&s->gb, buf, buf_size<<3); } else { ret = ff_vp56_init_range_decoder(&s->cc, buf, buf_size); if (ret < 0) return ret; s->ccp = &s->cc; } } else { s->ccp = &s->c; } return res; }
true
FFmpeg
967feea5ebb744dce97ab327d33502b43fca0c7f
static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) { VP56RangeCoder *c = &s->c; int parse_filter_info = 0; int coeff_offset = 0; int vrt_shift = 0; int sub_version; int rows, cols; int res = 0; int ret; int separated_coeff = buf[0] & 1; s->frames[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80); ff_vp56_init_dequant(s, (buf[0] >> 1) & 0x3F); if (s->frames[VP56_FRAME_CURRENT]->key_frame) { sub_version = buf[1] >> 3; if (sub_version > 8) return AVERROR_INVALIDDATA; s->filter_header = buf[1] & 0x06; if (buf[1] & 1) { avpriv_report_missing_feature(s->avctx, "Interlacing"); return AVERROR_PATCHWELCOME; } if (separated_coeff || !s->filter_header) { coeff_offset = AV_RB16(buf+2) - 2; buf += 2; buf_size -= 2; } rows = buf[2]; cols = buf[3]; if (!rows || !cols) { av_log(s->avctx, AV_LOG_ERROR, "Invalid size %dx%d\n", cols << 4, rows << 4); return AVERROR_INVALIDDATA; } if (!s->macroblocks || 16*cols != s->avctx->coded_width || 16*rows != s->avctx->coded_height) { if (s->avctx->extradata_size == 0 && FFALIGN(s->avctx->width, 16) == 16 * cols && FFALIGN(s->avctx->height, 16) == 16 * rows) { s->avctx->coded_width = 16 * cols; s->avctx->coded_height = 16 * rows; } else { ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows); if (ret < 0) return ret; if (s->avctx->extradata_size == 1) { s->avctx->width -= s->avctx->extradata[0] >> 4; s->avctx->height -= s->avctx->extradata[0] & 0x0F; } } res = VP56_SIZE_CHANGE; } ret = ff_vp56_init_range_decoder(c, buf+6, buf_size-6); if (ret < 0) return ret; vp56_rac_gets(c, 2); parse_filter_info = s->filter_header; if (sub_version < 8) vrt_shift = 5; s->sub_version = sub_version; s->golden_frame = 0; } else { if (!s->sub_version || !s->avctx->coded_width || !s->avctx->coded_height) return AVERROR_INVALIDDATA; if (separated_coeff || !s->filter_header) { coeff_offset = AV_RB16(buf+1) - 2; buf += 2; buf_size -= 2; } ret = ff_vp56_init_range_decoder(c, buf+1, buf_size-1); if (ret < 0) return ret; s->golden_frame = vp56_rac_get(c); if (s->filter_header) { s->deblock_filtering = vp56_rac_get(c); if (s->deblock_filtering) vp56_rac_get(c); if (s->sub_version > 7) parse_filter_info = vp56_rac_get(c); } } if (parse_filter_info) { if (vp56_rac_get(c)) { s->filter_mode = 2; s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift; s->max_vector_length = 2 << vp56_rac_gets(c, 3); } else if (vp56_rac_get(c)) { s->filter_mode = 1; } else { s->filter_mode = 0; } if (s->sub_version > 7) s->filter_selection = vp56_rac_gets(c, 4); else s->filter_selection = 16; } s->use_huffman = vp56_rac_get(c); s->parse_coeff = vp6_parse_coeff; if (coeff_offset) { buf += coeff_offset; buf_size -= coeff_offset; if (buf_size < 0) { if (s->frames[VP56_FRAME_CURRENT]->key_frame) ff_set_dimensions(s->avctx, 0, 0); return AVERROR_INVALIDDATA; } if (s->use_huffman) { s->parse_coeff = vp6_parse_coeff_huffman; init_get_bits(&s->gb, buf, buf_size<<3); } else { ret = ff_vp56_init_range_decoder(&s->cc, buf, buf_size); if (ret < 0) return ret; s->ccp = &s->cc; } } else { s->ccp = &s->c; } return res; }
{ "code": [ " return ret;", " if (s->frames[VP56_FRAME_CURRENT]->key_frame)", " ff_set_dimensions(s->avctx, 0, 0);", " return AVERROR_INVALIDDATA;", " return ret;" ], "line_no": [ 131, 239, 241, 37, 259 ] }
static int FUNC_0(VP56Context *VAR_0, const uint8_t *VAR_1, int VAR_2) { VP56RangeCoder *c = &VAR_0->c; int VAR_3 = 0; int VAR_4 = 0; int VAR_5 = 0; int VAR_6; int VAR_7, VAR_8; int VAR_9 = 0; int VAR_10; int VAR_11 = VAR_1[0] & 1; VAR_0->frames[VP56_FRAME_CURRENT]->key_frame = !(VAR_1[0] & 0x80); ff_vp56_init_dequant(VAR_0, (VAR_1[0] >> 1) & 0x3F); if (VAR_0->frames[VP56_FRAME_CURRENT]->key_frame) { VAR_6 = VAR_1[1] >> 3; if (VAR_6 > 8) return AVERROR_INVALIDDATA; VAR_0->filter_header = VAR_1[1] & 0x06; if (VAR_1[1] & 1) { avpriv_report_missing_feature(VAR_0->avctx, "Interlacing"); return AVERROR_PATCHWELCOME; } if (VAR_11 || !VAR_0->filter_header) { VAR_4 = AV_RB16(VAR_1+2) - 2; VAR_1 += 2; VAR_2 -= 2; } VAR_7 = VAR_1[2]; VAR_8 = VAR_1[3]; if (!VAR_7 || !VAR_8) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid size %dx%d\n", VAR_8 << 4, VAR_7 << 4); return AVERROR_INVALIDDATA; } if (!VAR_0->macroblocks || 16*VAR_8 != VAR_0->avctx->coded_width || 16*VAR_7 != VAR_0->avctx->coded_height) { if (VAR_0->avctx->extradata_size == 0 && FFALIGN(VAR_0->avctx->width, 16) == 16 * VAR_8 && FFALIGN(VAR_0->avctx->height, 16) == 16 * VAR_7) { VAR_0->avctx->coded_width = 16 * VAR_8; VAR_0->avctx->coded_height = 16 * VAR_7; } else { VAR_10 = ff_set_dimensions(VAR_0->avctx, 16 * VAR_8, 16 * VAR_7); if (VAR_10 < 0) return VAR_10; if (VAR_0->avctx->extradata_size == 1) { VAR_0->avctx->width -= VAR_0->avctx->extradata[0] >> 4; VAR_0->avctx->height -= VAR_0->avctx->extradata[0] & 0x0F; } } VAR_9 = VP56_SIZE_CHANGE; } VAR_10 = ff_vp56_init_range_decoder(c, VAR_1+6, VAR_2-6); if (VAR_10 < 0) return VAR_10; vp56_rac_gets(c, 2); VAR_3 = VAR_0->filter_header; if (VAR_6 < 8) VAR_5 = 5; VAR_0->VAR_6 = VAR_6; VAR_0->golden_frame = 0; } else { if (!VAR_0->VAR_6 || !VAR_0->avctx->coded_width || !VAR_0->avctx->coded_height) return AVERROR_INVALIDDATA; if (VAR_11 || !VAR_0->filter_header) { VAR_4 = AV_RB16(VAR_1+1) - 2; VAR_1 += 2; VAR_2 -= 2; } VAR_10 = ff_vp56_init_range_decoder(c, VAR_1+1, VAR_2-1); if (VAR_10 < 0) return VAR_10; VAR_0->golden_frame = vp56_rac_get(c); if (VAR_0->filter_header) { VAR_0->deblock_filtering = vp56_rac_get(c); if (VAR_0->deblock_filtering) vp56_rac_get(c); if (VAR_0->VAR_6 > 7) VAR_3 = vp56_rac_get(c); } } if (VAR_3) { if (vp56_rac_get(c)) { VAR_0->filter_mode = 2; VAR_0->sample_variance_threshold = vp56_rac_gets(c, 5) << VAR_5; VAR_0->max_vector_length = 2 << vp56_rac_gets(c, 3); } else if (vp56_rac_get(c)) { VAR_0->filter_mode = 1; } else { VAR_0->filter_mode = 0; } if (VAR_0->VAR_6 > 7) VAR_0->filter_selection = vp56_rac_gets(c, 4); else VAR_0->filter_selection = 16; } VAR_0->use_huffman = vp56_rac_get(c); VAR_0->parse_coeff = vp6_parse_coeff; if (VAR_4) { VAR_1 += VAR_4; VAR_2 -= VAR_4; if (VAR_2 < 0) { if (VAR_0->frames[VP56_FRAME_CURRENT]->key_frame) ff_set_dimensions(VAR_0->avctx, 0, 0); return AVERROR_INVALIDDATA; } if (VAR_0->use_huffman) { VAR_0->parse_coeff = vp6_parse_coeff_huffman; init_get_bits(&VAR_0->gb, VAR_1, VAR_2<<3); } else { VAR_10 = ff_vp56_init_range_decoder(&VAR_0->cc, VAR_1, VAR_2); if (VAR_10 < 0) return VAR_10; VAR_0->ccp = &VAR_0->cc; } } else { VAR_0->ccp = &VAR_0->c; } return VAR_9; }
[ "static int FUNC_0(VP56Context *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "VP56RangeCoder *c = &VAR_0->c;", "int VAR_3 = 0;", "int VAR_4 = 0;", "int VAR_5 = 0;", "int VAR_6;", "int VAR_7, VAR_8;", "int VAR_9 = 0;", "int VAR_10;", "int VAR_11 = VAR_1[0] & 1;", "VAR_0->frames[VP56_FRAME_CURRENT]->key_frame = !(VAR_1[0] & 0x80);", "ff_vp56_init_dequant(VAR_0, (VAR_1[0] >> 1) & 0x3F);", "if (VAR_0->frames[VP56_FRAME_CURRENT]->key_frame) {", "VAR_6 = VAR_1[1] >> 3;", "if (VAR_6 > 8)\nreturn AVERROR_INVALIDDATA;", "VAR_0->filter_header = VAR_1[1] & 0x06;", "if (VAR_1[1] & 1) {", "avpriv_report_missing_feature(VAR_0->avctx, \"Interlacing\");", "return AVERROR_PATCHWELCOME;", "}", "if (VAR_11 || !VAR_0->filter_header) {", "VAR_4 = AV_RB16(VAR_1+2) - 2;", "VAR_1 += 2;", "VAR_2 -= 2;", "}", "VAR_7 = VAR_1[2];", "VAR_8 = VAR_1[3];", "if (!VAR_7 || !VAR_8) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid size %dx%d\\n\", VAR_8 << 4, VAR_7 << 4);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_0->macroblocks ||\n16*VAR_8 != VAR_0->avctx->coded_width ||\n16*VAR_7 != VAR_0->avctx->coded_height) {", "if (VAR_0->avctx->extradata_size == 0 &&\nFFALIGN(VAR_0->avctx->width, 16) == 16 * VAR_8 &&\nFFALIGN(VAR_0->avctx->height, 16) == 16 * VAR_7) {", "VAR_0->avctx->coded_width = 16 * VAR_8;", "VAR_0->avctx->coded_height = 16 * VAR_7;", "} else {", "VAR_10 = ff_set_dimensions(VAR_0->avctx, 16 * VAR_8, 16 * VAR_7);", "if (VAR_10 < 0)\nreturn VAR_10;", "if (VAR_0->avctx->extradata_size == 1) {", "VAR_0->avctx->width -= VAR_0->avctx->extradata[0] >> 4;", "VAR_0->avctx->height -= VAR_0->avctx->extradata[0] & 0x0F;", "}", "}", "VAR_9 = VP56_SIZE_CHANGE;", "}", "VAR_10 = ff_vp56_init_range_decoder(c, VAR_1+6, VAR_2-6);", "if (VAR_10 < 0)\nreturn VAR_10;", "vp56_rac_gets(c, 2);", "VAR_3 = VAR_0->filter_header;", "if (VAR_6 < 8)\nVAR_5 = 5;", "VAR_0->VAR_6 = VAR_6;", "VAR_0->golden_frame = 0;", "} else {", "if (!VAR_0->VAR_6 || !VAR_0->avctx->coded_width || !VAR_0->avctx->coded_height)\nreturn AVERROR_INVALIDDATA;", "if (VAR_11 || !VAR_0->filter_header) {", "VAR_4 = AV_RB16(VAR_1+1) - 2;", "VAR_1 += 2;", "VAR_2 -= 2;", "}", "VAR_10 = ff_vp56_init_range_decoder(c, VAR_1+1, VAR_2-1);", "if (VAR_10 < 0)\nreturn VAR_10;", "VAR_0->golden_frame = vp56_rac_get(c);", "if (VAR_0->filter_header) {", "VAR_0->deblock_filtering = vp56_rac_get(c);", "if (VAR_0->deblock_filtering)\nvp56_rac_get(c);", "if (VAR_0->VAR_6 > 7)\nVAR_3 = vp56_rac_get(c);", "}", "}", "if (VAR_3) {", "if (vp56_rac_get(c)) {", "VAR_0->filter_mode = 2;", "VAR_0->sample_variance_threshold = vp56_rac_gets(c, 5) << VAR_5;", "VAR_0->max_vector_length = 2 << vp56_rac_gets(c, 3);", "} else if (vp56_rac_get(c)) {", "VAR_0->filter_mode = 1;", "} else {", "VAR_0->filter_mode = 0;", "}", "if (VAR_0->VAR_6 > 7)\nVAR_0->filter_selection = vp56_rac_gets(c, 4);", "else\nVAR_0->filter_selection = 16;", "}", "VAR_0->use_huffman = vp56_rac_get(c);", "VAR_0->parse_coeff = vp6_parse_coeff;", "if (VAR_4) {", "VAR_1 += VAR_4;", "VAR_2 -= VAR_4;", "if (VAR_2 < 0) {", "if (VAR_0->frames[VP56_FRAME_CURRENT]->key_frame)\nff_set_dimensions(VAR_0->avctx, 0, 0);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_0->use_huffman) {", "VAR_0->parse_coeff = vp6_parse_coeff_huffman;", "init_get_bits(&VAR_0->gb, VAR_1, VAR_2<<3);", "} else {", "VAR_10 = ff_vp56_init_range_decoder(&VAR_0->cc, VAR_1, VAR_2);", "if (VAR_10 < 0)\nreturn VAR_10;", "VAR_0->ccp = &VAR_0->cc;", "}", "} else {", "VAR_0->ccp = &VAR_0->c;", "}", "return VAR_9;", "}" ]
[ 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, 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, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81, 83 ], [ 85, 87, 89 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213, 215 ], [ 217, 219 ], [ 221 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ] ]
4,997
static void find_best_state(uint8_t best_state[256][256], const uint8_t one_state[256]) { int i, j, k, m; double l2tab[256]; for (i = 1; i < 256; i++) l2tab[i] = log2(i / 256.0); for (i = 0; i < 256; i++) { double best_len[256]; double p = i / 256.0; for (j = 0; j < 256; j++) best_len[j] = 1 << 30; for (j = FFMAX(i - 10, 1); j < FFMIN(i + 11, 256); j++) { double occ[256] = { 0 }; double len = 0; occ[j] = 1.0; for (k = 0; k < 256; k++) { double newocc[256] = { 0 }; for (m = 1; m < 256; m++) if (occ[m]) { len -= occ[m] * (p * l2tab[m] + (1 - p) * l2tab[256 - m]); } if (len < best_len[k]) { best_len[k] = len; best_state[i][k] = j; } for (m = 0; m < 256; m++) if (occ[m]) { newocc[one_state[m]] += occ[m] * p; newocc[256 - one_state[256 - m]] += occ[m] * (1 - p); } memcpy(occ, newocc, sizeof(occ)); } } } }
true
FFmpeg
6abe7edabb7d57e82d7ea6312d30cf05d2192c5b
static void find_best_state(uint8_t best_state[256][256], const uint8_t one_state[256]) { int i, j, k, m; double l2tab[256]; for (i = 1; i < 256; i++) l2tab[i] = log2(i / 256.0); for (i = 0; i < 256; i++) { double best_len[256]; double p = i / 256.0; for (j = 0; j < 256; j++) best_len[j] = 1 << 30; for (j = FFMAX(i - 10, 1); j < FFMIN(i + 11, 256); j++) { double occ[256] = { 0 }; double len = 0; occ[j] = 1.0; for (k = 0; k < 256; k++) { double newocc[256] = { 0 }; for (m = 1; m < 256; m++) if (occ[m]) { len -= occ[m] * (p * l2tab[m] + (1 - p) * l2tab[256 - m]); } if (len < best_len[k]) { best_len[k] = len; best_state[i][k] = j; } for (m = 0; m < 256; m++) if (occ[m]) { newocc[one_state[m]] += occ[m] * p; newocc[256 - one_state[256 - m]] += occ[m] * (1 - p); } memcpy(occ, newocc, sizeof(occ)); } } } }
{ "code": [ " for (m = 0; m < 256; m++)" ], "line_no": [ 63 ] }
static void FUNC_0(uint8_t VAR_0[256][256], const uint8_t VAR_1[256]) { int VAR_2, VAR_3, VAR_4, VAR_5; double VAR_6[256]; for (VAR_2 = 1; VAR_2 < 256; VAR_2++) VAR_6[VAR_2] = log2(VAR_2 / 256.0); for (VAR_2 = 0; VAR_2 < 256; VAR_2++) { double VAR_7[256]; double VAR_8 = VAR_2 / 256.0; for (VAR_3 = 0; VAR_3 < 256; VAR_3++) VAR_7[VAR_3] = 1 << 30; for (VAR_3 = FFMAX(VAR_2 - 10, 1); VAR_3 < FFMIN(VAR_2 + 11, 256); VAR_3++) { double VAR_9[256] = { 0 }; double VAR_10 = 0; VAR_9[VAR_3] = 1.0; for (VAR_4 = 0; VAR_4 < 256; VAR_4++) { double VAR_11[256] = { 0 }; for (VAR_5 = 1; VAR_5 < 256; VAR_5++) if (VAR_9[VAR_5]) { VAR_10 -= VAR_9[VAR_5] * (VAR_8 * VAR_6[VAR_5] + (1 - VAR_8) * VAR_6[256 - VAR_5]); } if (VAR_10 < VAR_7[VAR_4]) { VAR_7[VAR_4] = VAR_10; VAR_0[VAR_2][VAR_4] = VAR_3; } for (VAR_5 = 0; VAR_5 < 256; VAR_5++) if (VAR_9[VAR_5]) { VAR_11[VAR_1[VAR_5]] += VAR_9[VAR_5] * VAR_8; VAR_11[256 - VAR_1[256 - VAR_5]] += VAR_9[VAR_5] * (1 - VAR_8); } memcpy(VAR_9, VAR_11, sizeof(VAR_9)); } } } }
[ "static void FUNC_0(uint8_t VAR_0[256][256],\nconst uint8_t VAR_1[256])\n{", "int VAR_2, VAR_3, VAR_4, VAR_5;", "double VAR_6[256];", "for (VAR_2 = 1; VAR_2 < 256; VAR_2++)", "VAR_6[VAR_2] = log2(VAR_2 / 256.0);", "for (VAR_2 = 0; VAR_2 < 256; VAR_2++) {", "double VAR_7[256];", "double VAR_8 = VAR_2 / 256.0;", "for (VAR_3 = 0; VAR_3 < 256; VAR_3++)", "VAR_7[VAR_3] = 1 << 30;", "for (VAR_3 = FFMAX(VAR_2 - 10, 1); VAR_3 < FFMIN(VAR_2 + 11, 256); VAR_3++) {", "double VAR_9[256] = { 0 };", "double VAR_10 = 0;", "VAR_9[VAR_3] = 1.0;", "for (VAR_4 = 0; VAR_4 < 256; VAR_4++) {", "double VAR_11[256] = { 0 };", "for (VAR_5 = 1; VAR_5 < 256; VAR_5++)", "if (VAR_9[VAR_5]) {", "VAR_10 -= VAR_9[VAR_5] * (VAR_8 * VAR_6[VAR_5] +\n(1 - VAR_8) * VAR_6[256 - VAR_5]);", "}", "if (VAR_10 < VAR_7[VAR_4]) {", "VAR_7[VAR_4] = VAR_10;", "VAR_0[VAR_2][VAR_4] = VAR_3;", "}", "for (VAR_5 = 0; VAR_5 < 256; VAR_5++)", "if (VAR_9[VAR_5]) {", "VAR_11[VAR_1[VAR_5]] += VAR_9[VAR_5] * VAR_8;", "VAR_11[256 - VAR_1[256 - VAR_5]] += VAR_9[VAR_5] * (1 - VAR_8);", "}", "memcpy(VAR_9, VAR_11, sizeof(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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
4,998
static ExitStatus gen_bcond(DisasContext *ctx, TCGCond cond, int ra, int32_t disp, int mask) { TCGv cmp_tmp; if (mask) { cmp_tmp = tcg_temp_new(); tcg_gen_andi_i64(cmp_tmp, load_gpr(ctx, ra), 1); } else { cmp_tmp = load_gpr(ctx, ra); } return gen_bcond_internal(ctx, cond, cmp_tmp, disp); }
true
qemu
22d716c28e95e4640e2cd80553eb3f662db3fd50
static ExitStatus gen_bcond(DisasContext *ctx, TCGCond cond, int ra, int32_t disp, int mask) { TCGv cmp_tmp; if (mask) { cmp_tmp = tcg_temp_new(); tcg_gen_andi_i64(cmp_tmp, load_gpr(ctx, ra), 1); } else { cmp_tmp = load_gpr(ctx, ra); } return gen_bcond_internal(ctx, cond, cmp_tmp, disp); }
{ "code": [ " TCGv cmp_tmp;", " cmp_tmp = tcg_temp_new();", " tcg_gen_andi_i64(cmp_tmp, load_gpr(ctx, ra), 1);", " } else {", " cmp_tmp = load_gpr(ctx, ra);", " return gen_bcond_internal(ctx, cond, cmp_tmp, disp);" ], "line_no": [ 7, 13, 15, 17, 19, 25 ] }
static ExitStatus FUNC_0(DisasContext *ctx, TCGCond cond, int ra, int32_t disp, int mask) { TCGv cmp_tmp; if (mask) { cmp_tmp = tcg_temp_new(); tcg_gen_andi_i64(cmp_tmp, load_gpr(ctx, ra), 1); } else { cmp_tmp = load_gpr(ctx, ra); } return gen_bcond_internal(ctx, cond, cmp_tmp, disp); }
[ "static ExitStatus FUNC_0(DisasContext *ctx, TCGCond cond, int ra,\nint32_t disp, int mask)\n{", "TCGv cmp_tmp;", "if (mask) {", "cmp_tmp = tcg_temp_new();", "tcg_gen_andi_i64(cmp_tmp, load_gpr(ctx, ra), 1);", "} else {", "cmp_tmp = load_gpr(ctx, ra);", "}", "return gen_bcond_internal(ctx, cond, cmp_tmp, disp);", "}" ]
[ 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
4,999
static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) { int addr_reg, r0, r1, data_reg, data_reg2, bswap, rbase; #ifdef CONFIG_SOFTMMU int mem_index, r2, addr_reg2; uint8_t *label_ptr; #endif data_reg = *args++; if (opc == 3) data_reg2 = *args++; else data_reg2 = 0; addr_reg = *args++; #ifdef CONFIG_SOFTMMU #if TARGET_LONG_BITS == 64 addr_reg2 = *args++; #else addr_reg2 = 0; #endif mem_index = *args; r0 = 3; r1 = 4; r2 = 0; rbase = 0; tcg_out_tlb_check ( s, r0, r1, r2, addr_reg, addr_reg2, opc & 3, offsetof (CPUArchState, tlb_table[mem_index][0].addr_write), offsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_write), &label_ptr ); #else /* !CONFIG_SOFTMMU */ r0 = addr_reg; r1 = 3; rbase = GUEST_BASE ? TCG_GUEST_BASE_REG : 0; #endif #ifdef TARGET_WORDS_BIGENDIAN bswap = 0; #else bswap = 1; #endif switch (opc) { case 0: tcg_out32 (s, STBX | SAB (data_reg, rbase, r0)); break; case 1: if (bswap) tcg_out32 (s, STHBRX | SAB (data_reg, rbase, r0)); else tcg_out32 (s, STHX | SAB (data_reg, rbase, r0)); break; case 2: if (bswap) tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0)); else tcg_out32 (s, STWX | SAB (data_reg, rbase, r0)); break; case 3: if (bswap) { tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0)); tcg_out32 (s, STWBRX | SAB (data_reg2, rbase, r1)); } else { #ifdef CONFIG_USE_GUEST_BASE tcg_out32 (s, STWX | SAB (data_reg2, rbase, r0)); tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); tcg_out32 (s, STWX | SAB (data_reg, rbase, r1)); #else tcg_out32 (s, STW | RS (data_reg2) | RA (r0)); tcg_out32 (s, STW | RS (data_reg) | RA (r0) | 4); #endif } break; } #ifdef CONFIG_SOFTMMU add_qemu_ldst_label (s, 0, opc, data_reg, data_reg2, addr_reg, addr_reg2, mem_index, s->code_ptr, label_ptr); #endif }
true
qemu
8f50c841b374dc90ea604888ca92c37f469c428a
static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) { int addr_reg, r0, r1, data_reg, data_reg2, bswap, rbase; #ifdef CONFIG_SOFTMMU int mem_index, r2, addr_reg2; uint8_t *label_ptr; #endif data_reg = *args++; if (opc == 3) data_reg2 = *args++; else data_reg2 = 0; addr_reg = *args++; #ifdef CONFIG_SOFTMMU #if TARGET_LONG_BITS == 64 addr_reg2 = *args++; #else addr_reg2 = 0; #endif mem_index = *args; r0 = 3; r1 = 4; r2 = 0; rbase = 0; tcg_out_tlb_check ( s, r0, r1, r2, addr_reg, addr_reg2, opc & 3, offsetof (CPUArchState, tlb_table[mem_index][0].addr_write), offsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_write), &label_ptr ); #else r0 = addr_reg; r1 = 3; rbase = GUEST_BASE ? TCG_GUEST_BASE_REG : 0; #endif #ifdef TARGET_WORDS_BIGENDIAN bswap = 0; #else bswap = 1; #endif switch (opc) { case 0: tcg_out32 (s, STBX | SAB (data_reg, rbase, r0)); break; case 1: if (bswap) tcg_out32 (s, STHBRX | SAB (data_reg, rbase, r0)); else tcg_out32 (s, STHX | SAB (data_reg, rbase, r0)); break; case 2: if (bswap) tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0)); else tcg_out32 (s, STWX | SAB (data_reg, rbase, r0)); break; case 3: if (bswap) { tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0)); tcg_out32 (s, STWBRX | SAB (data_reg2, rbase, r1)); } else { #ifdef CONFIG_USE_GUEST_BASE tcg_out32 (s, STWX | SAB (data_reg2, rbase, r0)); tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); tcg_out32 (s, STWX | SAB (data_reg, rbase, r1)); #else tcg_out32 (s, STW | RS (data_reg2) | RA (r0)); tcg_out32 (s, STW | RS (data_reg) | RA (r0) | 4); #endif } break; } #ifdef CONFIG_SOFTMMU add_qemu_ldst_label (s, 0, opc, data_reg, data_reg2, addr_reg, addr_reg2, mem_index, s->code_ptr, label_ptr); #endif }
{ "code": [ " );", " );", " );", "#if TARGET_LONG_BITS == 64", "#endif", " );", " data_reg = *args++;", " if (opc == 3)", " data_reg2 = *args++;", " data_reg2 = 0;", " addr_reg = *args++;", "#if TARGET_LONG_BITS == 64", " addr_reg2 = *args++;", "#else", " addr_reg2 = 0;", "#endif", " r0 = 3;", " r1 = 4;", " r2 = 0;", " rbase = 0;", " tcg_out_tlb_check (", " &label_ptr", " );", " r0 = addr_reg;", " r1 = 3;", " if (bswap)", " if (bswap)", " tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4);", " else {", "#ifdef CONFIG_USE_GUEST_BASE", " tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4);", "#else", "#endif", " add_qemu_ldst_label (s,", " opc,", " data_reg,", " data_reg2,", " addr_reg,", " addr_reg2,", " mem_index,", " s->code_ptr,", " label_ptr);", " int addr_reg, r0, r1, data_reg, data_reg2, bswap, rbase;", " int mem_index, r2, addr_reg2;", " data_reg = *args++;", " if (opc == 3)", " data_reg2 = *args++;", " data_reg2 = 0;", " addr_reg = *args++;", "#if TARGET_LONG_BITS == 64", " addr_reg2 = *args++;", "#else", " addr_reg2 = 0;", "#endif", " r0 = 3;", " r1 = 4;", " r2 = 0;", " rbase = 0;", " tcg_out_tlb_check (", " s, r0, r1, r2, addr_reg, addr_reg2, opc & 3,", " offsetof (CPUArchState, tlb_table[mem_index][0].addr_write),", " offsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_write),", " &label_ptr", " );", " r0 = addr_reg;", " r1 = 3;", " tcg_out32 (s, STBX | SAB (data_reg, rbase, r0));", " if (bswap)", " tcg_out32 (s, STHBRX | SAB (data_reg, rbase, r0));", " tcg_out32 (s, STHX | SAB (data_reg, rbase, r0));", " if (bswap)", " tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0));", " tcg_out32 (s, STWX | SAB (data_reg, rbase, r0));", " tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4);", " tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0));", " tcg_out32 (s, STWBRX | SAB (data_reg2, rbase, r1));", " else {", "#ifdef CONFIG_USE_GUEST_BASE", " tcg_out32 (s, STWX | SAB (data_reg2, rbase, r0));", " tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4);", " tcg_out32 (s, STWX | SAB (data_reg, rbase, r1));", "#else", " tcg_out32 (s, STW | RS (data_reg2) | RA (r0));", " tcg_out32 (s, STW | RS (data_reg) | RA (r0) | 4);", "#endif", " add_qemu_ldst_label (s,", " 0,", " opc,", " data_reg,", " data_reg2,", " addr_reg,", " addr_reg2,", " mem_index,", " s->code_ptr,", " label_ptr);" ], "line_no": [ 65, 65, 65, 33, 13, 65, 17, 19, 21, 25, 27, 33, 35, 37, 39, 13, 45, 47, 49, 51, 55, 63, 65, 69, 71, 99, 99, 125, 133, 135, 125, 37, 13, 161, 165, 167, 169, 171, 173, 175, 177, 179, 5, 9, 17, 19, 21, 25, 27, 33, 35, 37, 39, 13, 45, 47, 49, 51, 55, 57, 59, 61, 63, 65, 69, 71, 93, 99, 101, 105, 99, 113, 117, 125, 127, 129, 133, 135, 137, 125, 141, 37, 145, 147, 13, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179 ] }
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; #ifdef CONFIG_SOFTMMU int mem_index, r2, addr_reg2; uint8_t *label_ptr; #endif VAR_6 = *VAR_1++; if (VAR_2 == 3) VAR_7 = *VAR_1++; else VAR_7 = 0; VAR_3 = *VAR_1++; #ifdef CONFIG_SOFTMMU #if TARGET_LONG_BITS == 64 addr_reg2 = *VAR_1++; #else addr_reg2 = 0; #endif mem_index = *VAR_1; VAR_4 = 3; VAR_5 = 4; r2 = 0; VAR_9 = 0; tcg_out_tlb_check ( VAR_0, VAR_4, VAR_5, r2, VAR_3, addr_reg2, VAR_2 & 3, offsetof (CPUArchState, tlb_table[mem_index][0].addr_write), offsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_write), &label_ptr ); #else VAR_4 = VAR_3; VAR_5 = 3; VAR_9 = GUEST_BASE ? TCG_GUEST_BASE_REG : 0; #endif #ifdef TARGET_WORDS_BIGENDIAN VAR_8 = 0; #else VAR_8 = 1; #endif switch (VAR_2) { case 0: tcg_out32 (VAR_0, STBX | SAB (VAR_6, VAR_9, VAR_4)); break; case 1: if (VAR_8) tcg_out32 (VAR_0, STHBRX | SAB (VAR_6, VAR_9, VAR_4)); else tcg_out32 (VAR_0, STHX | SAB (VAR_6, VAR_9, VAR_4)); break; case 2: if (VAR_8) tcg_out32 (VAR_0, STWBRX | SAB (VAR_6, VAR_9, VAR_4)); else tcg_out32 (VAR_0, STWX | SAB (VAR_6, VAR_9, VAR_4)); break; case 3: if (VAR_8) { tcg_out32 (VAR_0, ADDI | RT (VAR_5) | RA (VAR_4) | 4); tcg_out32 (VAR_0, STWBRX | SAB (VAR_6, VAR_9, VAR_4)); tcg_out32 (VAR_0, STWBRX | SAB (VAR_7, VAR_9, VAR_5)); } else { #ifdef CONFIG_USE_GUEST_BASE tcg_out32 (VAR_0, STWX | SAB (VAR_7, VAR_9, VAR_4)); tcg_out32 (VAR_0, ADDI | RT (VAR_5) | RA (VAR_4) | 4); tcg_out32 (VAR_0, STWX | SAB (VAR_6, VAR_9, VAR_5)); #else tcg_out32 (VAR_0, STW | RS (VAR_7) | RA (VAR_4)); tcg_out32 (VAR_0, STW | RS (VAR_6) | RA (VAR_4) | 4); #endif } break; } #ifdef CONFIG_SOFTMMU add_qemu_ldst_label (VAR_0, 0, VAR_2, VAR_6, VAR_7, VAR_3, addr_reg2, mem_index, VAR_0->code_ptr, label_ptr); #endif }
[ "static void FUNC_0 (TCGContext *VAR_0, const TCGArg *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "#ifdef CONFIG_SOFTMMU\nint mem_index, r2, addr_reg2;", "uint8_t *label_ptr;", "#endif\nVAR_6 = *VAR_1++;", "if (VAR_2 == 3)\nVAR_7 = *VAR_1++;", "else\nVAR_7 = 0;", "VAR_3 = *VAR_1++;", "#ifdef CONFIG_SOFTMMU\n#if TARGET_LONG_BITS == 64\naddr_reg2 = *VAR_1++;", "#else\naddr_reg2 = 0;", "#endif\nmem_index = *VAR_1;", "VAR_4 = 3;", "VAR_5 = 4;", "r2 = 0;", "VAR_9 = 0;", "tcg_out_tlb_check (\nVAR_0, VAR_4, VAR_5, r2, VAR_3, addr_reg2, VAR_2 & 3,\noffsetof (CPUArchState, tlb_table[mem_index][0].addr_write),\noffsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_write),\n&label_ptr\n);", "#else\nVAR_4 = VAR_3;", "VAR_5 = 3;", "VAR_9 = GUEST_BASE ? TCG_GUEST_BASE_REG : 0;", "#endif\n#ifdef TARGET_WORDS_BIGENDIAN\nVAR_8 = 0;", "#else\nVAR_8 = 1;", "#endif\nswitch (VAR_2) {", "case 0:\ntcg_out32 (VAR_0, STBX | SAB (VAR_6, VAR_9, VAR_4));", "break;", "case 1:\nif (VAR_8)\ntcg_out32 (VAR_0, STHBRX | SAB (VAR_6, VAR_9, VAR_4));", "else\ntcg_out32 (VAR_0, STHX | SAB (VAR_6, VAR_9, VAR_4));", "break;", "case 2:\nif (VAR_8)\ntcg_out32 (VAR_0, STWBRX | SAB (VAR_6, VAR_9, VAR_4));", "else\ntcg_out32 (VAR_0, STWX | SAB (VAR_6, VAR_9, VAR_4));", "break;", "case 3:\nif (VAR_8) {", "tcg_out32 (VAR_0, ADDI | RT (VAR_5) | RA (VAR_4) | 4);", "tcg_out32 (VAR_0, STWBRX | SAB (VAR_6, VAR_9, VAR_4));", "tcg_out32 (VAR_0, STWBRX | SAB (VAR_7, VAR_9, VAR_5));", "}", "else {", "#ifdef CONFIG_USE_GUEST_BASE\ntcg_out32 (VAR_0, STWX | SAB (VAR_7, VAR_9, VAR_4));", "tcg_out32 (VAR_0, ADDI | RT (VAR_5) | RA (VAR_4) | 4);", "tcg_out32 (VAR_0, STWX | SAB (VAR_6, VAR_9, VAR_5));", "#else\ntcg_out32 (VAR_0, STW | RS (VAR_7) | RA (VAR_4));", "tcg_out32 (VAR_0, STW | RS (VAR_6) | RA (VAR_4) | 4);", "#endif\n}", "break;", "}", "#ifdef CONFIG_SOFTMMU\nadd_qemu_ldst_label (VAR_0,\n0,\nVAR_2,\nVAR_6,\nVAR_7,\nVAR_3,\naddr_reg2,\nmem_index,\nVAR_0->code_ptr,\nlabel_ptr);", "#endif\n}" ]
[ 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 31, 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59, 61, 63, 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 79, 81 ], [ 83, 85 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 97, 99, 101 ], [ 103, 105 ], [ 107 ], [ 109, 111, 113 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179 ], [ 181, 183 ] ]
5,000
int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, int abort_on_failure) { QemuOpts *opts; int rc = 0; QTAILQ_FOREACH(opts, &list->head, next) { rc = func(opts, opaque); if (abort_on_failure && rc != 0) break; } return rc; }
true
qemu
4a2594ddd35de7ae7c8cd9c6828cfe72245e6dc5
int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, int abort_on_failure) { QemuOpts *opts; int rc = 0; QTAILQ_FOREACH(opts, &list->head, next) { rc = func(opts, opaque); if (abort_on_failure && rc != 0) break; } return rc; }
{ "code": [ " rc = func(opts, opaque);" ], "line_no": [ 15 ] }
int FUNC_0(QemuOptsList *VAR_0, qemu_opts_loopfunc VAR_1, void *VAR_2, int VAR_3) { QemuOpts *opts; int VAR_4 = 0; QTAILQ_FOREACH(opts, &VAR_0->head, next) { VAR_4 = VAR_1(opts, VAR_2); if (VAR_3 && VAR_4 != 0) break; } return VAR_4; }
[ "int FUNC_0(QemuOptsList *VAR_0, qemu_opts_loopfunc VAR_1, void *VAR_2,\nint VAR_3)\n{", "QemuOpts *opts;", "int VAR_4 = 0;", "QTAILQ_FOREACH(opts, &VAR_0->head, next) {", "VAR_4 = VAR_1(opts, VAR_2);", "if (VAR_3 && VAR_4 != 0)\nbreak;", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ] ]
5,001
static void gen_tlbsx_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(!ctx->mem_idx)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } if (rA(ctx->opcode)) { t0 = tcg_temp_new(); tcg_gen_mov_tl(t0, cpu_gpr[rD(ctx->opcode)]); } else { t0 = tcg_const_tl(0); } tcg_gen_add_tl(t0, t0, cpu_gpr[rB(ctx->opcode)]); gen_helper_booke206_tlbsx(cpu_env, t0); #endif }
true
qemu
c80d1df5083846396ab5120731a76a9d62900fda
static void gen_tlbsx_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(!ctx->mem_idx)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } if (rA(ctx->opcode)) { t0 = tcg_temp_new(); tcg_gen_mov_tl(t0, cpu_gpr[rD(ctx->opcode)]); } else { t0 = tcg_const_tl(0); } tcg_gen_add_tl(t0, t0, cpu_gpr[rB(ctx->opcode)]); gen_helper_booke206_tlbsx(cpu_env, t0); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(!VAR_0->mem_idx)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); return; } if (rA(VAR_0->opcode)) { t0 = tcg_temp_new(); tcg_gen_mov_tl(t0, cpu_gpr[rD(VAR_0->opcode)]); } else { t0 = tcg_const_tl(0); } tcg_gen_add_tl(t0, t0, cpu_gpr[rB(VAR_0->opcode)]); gen_helper_booke206_tlbsx(cpu_env, t0); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "#else\nTCGv t0;", "if (unlikely(!VAR_0->mem_idx)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "return;", "}", "if (rA(VAR_0->opcode)) {", "t0 = tcg_temp_new();", "tcg_gen_mov_tl(t0, cpu_gpr[rD(VAR_0->opcode)]);", "} else {", "t0 = tcg_const_tl(0);", "}", "tcg_gen_add_tl(t0, t0, cpu_gpr[rB(VAR_0->opcode)]);", "gen_helper_booke206_tlbsx(cpu_env, t0);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 42, 44 ] ]
5,003
static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, int buf_size, AVCodecContext *avctx) { HEVCParserContext *ctx = s->priv_data; HEVCContext *h = &ctx->h; GetBitContext *gb; SliceHeader *sh = &h->sh; HEVCParamSets *ps = &h->ps; H2645Packet *pkt = &ctx->pkt; const uint8_t *buf_end = buf + buf_size; int state = -1, i; H2645NAL *nal; int is_global = buf == avctx->extradata; if (!h->HEVClc) h->HEVClc = av_mallocz(sizeof(HEVCLocalContext)); if (!h->HEVClc) return AVERROR(ENOMEM); gb = &h->HEVClc->gb; /* set some sane default values */ s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; if (!buf_size) return 0; if (pkt->nals_allocated < 1) { H2645NAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp)); if (!tmp) return AVERROR(ENOMEM); pkt->nals = tmp; memset(pkt->nals, 0, sizeof(*tmp)); pkt->nals_allocated = 1; } nal = &pkt->nals[0]; for (;;) { int src_length, consumed; int ret; buf = avpriv_find_start_code(buf, buf_end, &state); if (--buf + 2 >= buf_end) break; src_length = buf_end - buf; h->nal_unit_type = (*buf >> 1) & 0x3f; h->temporal_id = (*(buf + 1) & 0x07) - 1; if (h->nal_unit_type <= NAL_CRA_NUT) { // Do not walk the whole buffer just to decode slice segment header if (src_length > 20) src_length = 20; } consumed = ff_h2645_extract_rbsp(buf, src_length, nal); if (consumed < 0) return consumed; ret = init_get_bits8(gb, nal->data + 2, nal->size); if (ret < 0) return ret; switch (h->nal_unit_type) { case NAL_VPS: ff_hevc_decode_nal_vps(gb, avctx, ps); break; case NAL_SPS: ff_hevc_decode_nal_sps(gb, avctx, ps, 1); break; case NAL_PPS: ff_hevc_decode_nal_pps(gb, avctx, ps); break; case NAL_SEI_PREFIX: case NAL_SEI_SUFFIX: ff_hevc_decode_nal_sei(h); break; case NAL_TRAIL_N: case NAL_TRAIL_R: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: if (is_global) { av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", h->nal_unit_type); return AVERROR_INVALIDDATA; } sh->first_slice_in_pic_flag = get_bits1(gb); s->picture_structure = h->picture_struct; s->field_order = h->picture_struct; if (IS_IRAP(h)) { s->key_frame = 1; sh->no_output_of_prior_pics_flag = get_bits1(gb); } sh->pps_id = get_ue_golomb(gb); if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) { av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data; if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) { av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id); return AVERROR_INVALIDDATA; } if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) { ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data; ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data; } if (!sh->first_slice_in_pic_flag) { int slice_address_length; if (ps->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); else sh->dependent_slice_segment_flag = 0; slice_address_length = av_ceil_log2_c(ps->sps->ctb_width * ps->sps->ctb_height); sh->slice_segment_addr = get_bitsz(gb, slice_address_length); if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) { av_log(avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } } else sh->dependent_slice_segment_flag = 0; if (sh->dependent_slice_segment_flag) break; for (i = 0; i < ps->pps->num_extra_slice_header_bits; i++) skip_bits(gb, 1); // slice_reserved_undetermined_flag[] sh->slice_type = get_ue_golomb(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (ps->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (ps->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(h)) { sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb); s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb); } else s->output_picture_number = h->poc = 0; if (h->temporal_id == 0 && h->nal_unit_type != NAL_TRAIL_N && h->nal_unit_type != NAL_TSA_N && h->nal_unit_type != NAL_STSA_N && h->nal_unit_type != NAL_RADL_N && h->nal_unit_type != NAL_RASL_N && h->nal_unit_type != NAL_RADL_R && h->nal_unit_type != NAL_RASL_R) h->pocTid0 = h->poc; return 0; /* no need to evaluate the rest */ } buf += consumed; } /* didn't find a picture! */ if (!is_global) av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; }
true
FFmpeg
964f07f68e1cc4e2d585615e2b1a1fade269afb0
static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, int buf_size, AVCodecContext *avctx) { HEVCParserContext *ctx = s->priv_data; HEVCContext *h = &ctx->h; GetBitContext *gb; SliceHeader *sh = &h->sh; HEVCParamSets *ps = &h->ps; H2645Packet *pkt = &ctx->pkt; const uint8_t *buf_end = buf + buf_size; int state = -1, i; H2645NAL *nal; int is_global = buf == avctx->extradata; if (!h->HEVClc) h->HEVClc = av_mallocz(sizeof(HEVCLocalContext)); if (!h->HEVClc) return AVERROR(ENOMEM); gb = &h->HEVClc->gb; s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; if (!buf_size) return 0; if (pkt->nals_allocated < 1) { H2645NAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp)); if (!tmp) return AVERROR(ENOMEM); pkt->nals = tmp; memset(pkt->nals, 0, sizeof(*tmp)); pkt->nals_allocated = 1; } nal = &pkt->nals[0]; for (;;) { int src_length, consumed; int ret; buf = avpriv_find_start_code(buf, buf_end, &state); if (--buf + 2 >= buf_end) break; src_length = buf_end - buf; h->nal_unit_type = (*buf >> 1) & 0x3f; h->temporal_id = (*(buf + 1) & 0x07) - 1; if (h->nal_unit_type <= NAL_CRA_NUT) { if (src_length > 20) src_length = 20; } consumed = ff_h2645_extract_rbsp(buf, src_length, nal); if (consumed < 0) return consumed; ret = init_get_bits8(gb, nal->data + 2, nal->size); if (ret < 0) return ret; switch (h->nal_unit_type) { case NAL_VPS: ff_hevc_decode_nal_vps(gb, avctx, ps); break; case NAL_SPS: ff_hevc_decode_nal_sps(gb, avctx, ps, 1); break; case NAL_PPS: ff_hevc_decode_nal_pps(gb, avctx, ps); break; case NAL_SEI_PREFIX: case NAL_SEI_SUFFIX: ff_hevc_decode_nal_sei(h); break; case NAL_TRAIL_N: case NAL_TRAIL_R: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: if (is_global) { av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", h->nal_unit_type); return AVERROR_INVALIDDATA; } sh->first_slice_in_pic_flag = get_bits1(gb); s->picture_structure = h->picture_struct; s->field_order = h->picture_struct; if (IS_IRAP(h)) { s->key_frame = 1; sh->no_output_of_prior_pics_flag = get_bits1(gb); } sh->pps_id = get_ue_golomb(gb); if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) { av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data; if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) { av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id); return AVERROR_INVALIDDATA; } if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) { ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data; ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data; } if (!sh->first_slice_in_pic_flag) { int slice_address_length; if (ps->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); else sh->dependent_slice_segment_flag = 0; slice_address_length = av_ceil_log2_c(ps->sps->ctb_width * ps->sps->ctb_height); sh->slice_segment_addr = get_bitsz(gb, slice_address_length); if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) { av_log(avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } } else sh->dependent_slice_segment_flag = 0; if (sh->dependent_slice_segment_flag) break; for (i = 0; i < ps->pps->num_extra_slice_header_bits; i++) skip_bits(gb, 1); sh->slice_type = get_ue_golomb(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (ps->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (ps->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(h)) { sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb); s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb); } else s->output_picture_number = h->poc = 0; if (h->temporal_id == 0 && h->nal_unit_type != NAL_TRAIL_N && h->nal_unit_type != NAL_TSA_N && h->nal_unit_type != NAL_STSA_N && h->nal_unit_type != NAL_RADL_N && h->nal_unit_type != NAL_RASL_N && h->nal_unit_type != NAL_RADL_R && h->nal_unit_type != NAL_RASL_R) h->pocTid0 = h->poc; return 0; } buf += consumed; } if (!is_global) av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(AVCodecParserContext *VAR_0, const uint8_t *VAR_1, int VAR_2, AVCodecContext *VAR_3) { HEVCParserContext *ctx = VAR_0->priv_data; HEVCContext *h = &ctx->h; GetBitContext *gb; SliceHeader *sh = &h->sh; HEVCParamSets *ps = &h->ps; H2645Packet *pkt = &ctx->pkt; const uint8_t *VAR_4 = VAR_1 + VAR_2; int VAR_5 = -1, VAR_6; H2645NAL *nal; int VAR_7 = VAR_1 == VAR_3->extradata; if (!h->HEVClc) h->HEVClc = av_mallocz(sizeof(HEVCLocalContext)); if (!h->HEVClc) return AVERROR(ENOMEM); gb = &h->HEVClc->gb; VAR_0->pict_type = AV_PICTURE_TYPE_I; VAR_0->key_frame = 0; VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->VAR_3 = VAR_3; if (!VAR_2) return 0; if (pkt->nals_allocated < 1) { H2645NAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp)); if (!tmp) return AVERROR(ENOMEM); pkt->nals = tmp; memset(pkt->nals, 0, sizeof(*tmp)); pkt->nals_allocated = 1; } nal = &pkt->nals[0]; for (;;) { int VAR_8, VAR_9; int VAR_10; VAR_1 = avpriv_find_start_code(VAR_1, VAR_4, &VAR_5); if (--VAR_1 + 2 >= VAR_4) break; VAR_8 = VAR_4 - VAR_1; h->nal_unit_type = (*VAR_1 >> 1) & 0x3f; h->temporal_id = (*(VAR_1 + 1) & 0x07) - 1; if (h->nal_unit_type <= NAL_CRA_NUT) { if (VAR_8 > 20) VAR_8 = 20; } VAR_9 = ff_h2645_extract_rbsp(VAR_1, VAR_8, nal); if (VAR_9 < 0) return VAR_9; VAR_10 = init_get_bits8(gb, nal->data + 2, nal->size); if (VAR_10 < 0) return VAR_10; switch (h->nal_unit_type) { case NAL_VPS: ff_hevc_decode_nal_vps(gb, VAR_3, ps); break; case NAL_SPS: ff_hevc_decode_nal_sps(gb, VAR_3, ps, 1); break; case NAL_PPS: ff_hevc_decode_nal_pps(gb, VAR_3, ps); break; case NAL_SEI_PREFIX: case NAL_SEI_SUFFIX: ff_hevc_decode_nal_sei(h); break; case NAL_TRAIL_N: case NAL_TRAIL_R: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: if (VAR_7) { av_log(VAR_3, AV_LOG_ERROR, "Invalid NAL unit: %d\n", h->nal_unit_type); return AVERROR_INVALIDDATA; } sh->first_slice_in_pic_flag = get_bits1(gb); VAR_0->picture_structure = h->picture_struct; VAR_0->field_order = h->picture_struct; if (IS_IRAP(h)) { VAR_0->key_frame = 1; sh->no_output_of_prior_pics_flag = get_bits1(gb); } sh->pps_id = get_ue_golomb(gb); if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) { av_log(VAR_3, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data; if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) { av_log(VAR_3, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id); return AVERROR_INVALIDDATA; } if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) { ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data; ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data; } if (!sh->first_slice_in_pic_flag) { int VAR_11; if (ps->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); else sh->dependent_slice_segment_flag = 0; VAR_11 = av_ceil_log2_c(ps->sps->ctb_width * ps->sps->ctb_height); sh->slice_segment_addr = get_bitsz(gb, VAR_11); if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) { av_log(VAR_3, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } } else sh->dependent_slice_segment_flag = 0; if (sh->dependent_slice_segment_flag) break; for (VAR_6 = 0; VAR_6 < ps->pps->num_extra_slice_header_bits; VAR_6++) skip_bits(gb, 1); sh->slice_type = get_ue_golomb(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(VAR_3, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } VAR_0->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (ps->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (ps->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(h)) { sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb); VAR_0->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb); } else VAR_0->output_picture_number = h->poc = 0; if (h->temporal_id == 0 && h->nal_unit_type != NAL_TRAIL_N && h->nal_unit_type != NAL_TSA_N && h->nal_unit_type != NAL_STSA_N && h->nal_unit_type != NAL_RADL_N && h->nal_unit_type != NAL_RASL_N && h->nal_unit_type != NAL_RADL_R && h->nal_unit_type != NAL_RASL_R) h->pocTid0 = h->poc; return 0; } VAR_1 += VAR_9; } if (!VAR_7) av_log(h->VAR_3, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; }
[ "static inline int FUNC_0(AVCodecParserContext *VAR_0, const uint8_t *VAR_1,\nint VAR_2, AVCodecContext *VAR_3)\n{", "HEVCParserContext *ctx = VAR_0->priv_data;", "HEVCContext *h = &ctx->h;", "GetBitContext *gb;", "SliceHeader *sh = &h->sh;", "HEVCParamSets *ps = &h->ps;", "H2645Packet *pkt = &ctx->pkt;", "const uint8_t *VAR_4 = VAR_1 + VAR_2;", "int VAR_5 = -1, VAR_6;", "H2645NAL *nal;", "int VAR_7 = VAR_1 == VAR_3->extradata;", "if (!h->HEVClc)\nh->HEVClc = av_mallocz(sizeof(HEVCLocalContext));", "if (!h->HEVClc)\nreturn AVERROR(ENOMEM);", "gb = &h->HEVClc->gb;", "VAR_0->pict_type = AV_PICTURE_TYPE_I;", "VAR_0->key_frame = 0;", "VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;", "h->VAR_3 = VAR_3;", "if (!VAR_2)\nreturn 0;", "if (pkt->nals_allocated < 1) {", "H2645NAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp));", "if (!tmp)\nreturn AVERROR(ENOMEM);", "pkt->nals = tmp;", "memset(pkt->nals, 0, sizeof(*tmp));", "pkt->nals_allocated = 1;", "}", "nal = &pkt->nals[0];", "for (;;) {", "int VAR_8, VAR_9;", "int VAR_10;", "VAR_1 = avpriv_find_start_code(VAR_1, VAR_4, &VAR_5);", "if (--VAR_1 + 2 >= VAR_4)\nbreak;", "VAR_8 = VAR_4 - VAR_1;", "h->nal_unit_type = (*VAR_1 >> 1) & 0x3f;", "h->temporal_id = (*(VAR_1 + 1) & 0x07) - 1;", "if (h->nal_unit_type <= NAL_CRA_NUT) {", "if (VAR_8 > 20)\nVAR_8 = 20;", "}", "VAR_9 = ff_h2645_extract_rbsp(VAR_1, VAR_8, nal);", "if (VAR_9 < 0)\nreturn VAR_9;", "VAR_10 = init_get_bits8(gb, nal->data + 2, nal->size);", "if (VAR_10 < 0)\nreturn VAR_10;", "switch (h->nal_unit_type) {", "case NAL_VPS:\nff_hevc_decode_nal_vps(gb, VAR_3, ps);", "break;", "case NAL_SPS:\nff_hevc_decode_nal_sps(gb, VAR_3, ps, 1);", "break;", "case NAL_PPS:\nff_hevc_decode_nal_pps(gb, VAR_3, ps);", "break;", "case NAL_SEI_PREFIX:\ncase NAL_SEI_SUFFIX:\nff_hevc_decode_nal_sei(h);", "break;", "case NAL_TRAIL_N:\ncase NAL_TRAIL_R:\ncase NAL_TSA_N:\ncase NAL_TSA_R:\ncase NAL_STSA_N:\ncase NAL_STSA_R:\ncase NAL_RADL_N:\ncase NAL_RADL_R:\ncase NAL_RASL_N:\ncase NAL_RASL_R:\ncase NAL_BLA_W_LP:\ncase NAL_BLA_W_RADL:\ncase NAL_BLA_N_LP:\ncase NAL_IDR_W_RADL:\ncase NAL_IDR_N_LP:\ncase NAL_CRA_NUT:\nif (VAR_7) {", "av_log(VAR_3, AV_LOG_ERROR, \"Invalid NAL unit: %d\\n\", h->nal_unit_type);", "return AVERROR_INVALIDDATA;", "}", "sh->first_slice_in_pic_flag = get_bits1(gb);", "VAR_0->picture_structure = h->picture_struct;", "VAR_0->field_order = h->picture_struct;", "if (IS_IRAP(h)) {", "VAR_0->key_frame = 1;", "sh->no_output_of_prior_pics_flag = get_bits1(gb);", "}", "sh->pps_id = get_ue_golomb(gb);", "if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) {", "av_log(VAR_3, AV_LOG_ERROR, \"PPS id out of range: %d\\n\", sh->pps_id);", "return AVERROR_INVALIDDATA;", "}", "ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data;", "if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {", "av_log(VAR_3, AV_LOG_ERROR, \"SPS id out of range: %d\\n\", ps->pps->sps_id);", "return AVERROR_INVALIDDATA;", "}", "if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {", "ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;", "ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;", "}", "if (!sh->first_slice_in_pic_flag) {", "int VAR_11;", "if (ps->pps->dependent_slice_segments_enabled_flag)\nsh->dependent_slice_segment_flag = get_bits1(gb);", "else\nsh->dependent_slice_segment_flag = 0;", "VAR_11 = av_ceil_log2_c(ps->sps->ctb_width *\nps->sps->ctb_height);", "sh->slice_segment_addr = get_bitsz(gb, VAR_11);", "if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) {", "av_log(VAR_3, AV_LOG_ERROR, \"Invalid slice segment address: %u.\\n\",\nsh->slice_segment_addr);", "return AVERROR_INVALIDDATA;", "}", "} else", "sh->dependent_slice_segment_flag = 0;", "if (sh->dependent_slice_segment_flag)\nbreak;", "for (VAR_6 = 0; VAR_6 < ps->pps->num_extra_slice_header_bits; VAR_6++)", "skip_bits(gb, 1);", "sh->slice_type = get_ue_golomb(gb);", "if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE ||\nsh->slice_type == B_SLICE)) {", "av_log(VAR_3, AV_LOG_ERROR, \"Unknown slice type: %d.\\n\",\nsh->slice_type);", "return AVERROR_INVALIDDATA;", "}", "VAR_0->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B :\nsh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P :\nAV_PICTURE_TYPE_I;", "if (ps->pps->output_flag_present_flag)\nsh->pic_output_flag = get_bits1(gb);", "if (ps->sps->separate_colour_plane_flag)\nsh->colour_plane_id = get_bits(gb, 2);", "if (!IS_IDR(h)) {", "sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb);", "VAR_0->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb);", "} else", "VAR_0->output_picture_number = h->poc = 0;", "if (h->temporal_id == 0 &&\nh->nal_unit_type != NAL_TRAIL_N &&\nh->nal_unit_type != NAL_TSA_N &&\nh->nal_unit_type != NAL_STSA_N &&\nh->nal_unit_type != NAL_RADL_N &&\nh->nal_unit_type != NAL_RASL_N &&\nh->nal_unit_type != NAL_RADL_R &&\nh->nal_unit_type != NAL_RASL_R)\nh->pocTid0 = h->poc;", "return 0;", "}", "VAR_1 += VAR_9;", "}", "if (!VAR_7)\nav_log(h->VAR_3, AV_LOG_ERROR, \"missing picture in access unit\\n\");", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14, 15 ], [ 16, 17 ], [ 18 ], [ 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 ], [ 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, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110 ], [ 111 ], [ 112, 113 ], [ 114, 115 ], [ 116, 117 ], [ 118 ], [ 119 ], [ 120, 121 ], [ 122 ], [ 123 ], [ 124 ], [ 125 ], [ 126, 127 ], [ 128 ], [ 129 ], [ 130 ], [ 131, 132 ], [ 133, 134 ], [ 135 ], [ 136 ], [ 137, 138, 139 ], [ 140, 141 ], [ 142, 143 ], [ 144 ], [ 145 ], [ 146 ], [ 147 ], [ 148 ], [ 149, 150, 151, 152, 153, 154, 155, 156, 157 ], [ 158 ], [ 159 ], [ 160 ], [ 161 ], [ 163, 164 ], [ 165 ], [ 166 ] ]
5,004
static int afx_init1(SysBusDevice *dev) { AFXState *s = TCX_AFX(dev); memory_region_init_ram(&s->mem, OBJECT(s), "sun4m.afx", 4, &error_abort); vmstate_register_ram_global(&s->mem); sysbus_init_mmio(dev, &s->mem); return 0; }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static int afx_init1(SysBusDevice *dev) { AFXState *s = TCX_AFX(dev); memory_region_init_ram(&s->mem, OBJECT(s), "sun4m.afx", 4, &error_abort); vmstate_register_ram_global(&s->mem); sysbus_init_mmio(dev, &s->mem); return 0; }
{ "code": [ " memory_region_init_ram(&s->mem, OBJECT(s), \"sun4m.afx\", 4, &error_abort);" ], "line_no": [ 9 ] }
static int FUNC_0(SysBusDevice *VAR_0) { AFXState *s = TCX_AFX(VAR_0); memory_region_init_ram(&s->mem, OBJECT(s), "sun4m.afx", 4, &error_abort); vmstate_register_ram_global(&s->mem); sysbus_init_mmio(VAR_0, &s->mem); return 0; }
[ "static int FUNC_0(SysBusDevice *VAR_0)\n{", "AFXState *s = TCX_AFX(VAR_0);", "memory_region_init_ram(&s->mem, OBJECT(s), \"sun4m.afx\", 4, &error_abort);", "vmstate_register_ram_global(&s->mem);", "sysbus_init_mmio(VAR_0, &s->mem);", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
5,005
static float ssim_end4(int sum0[5][4], int sum1[5][4], int width) { float ssim = 0.0; int i; for (i = 0; i < width; i++) ssim += ssim_end1(sum0[i][0] + sum0[i + 1][0] + sum1[i][0] + sum1[i + 1][0], sum0[i][1] + sum0[i + 1][1] + sum1[i][1] + sum1[i + 1][1], sum0[i][2] + sum0[i + 1][2] + sum1[i][2] + sum1[i + 1][2], sum0[i][3] + sum0[i + 1][3] + sum1[i][3] + sum1[i + 1][3]); return ssim; }
false
FFmpeg
a1f48480497bb462c5d1d589ae393335f50b06e0
static float ssim_end4(int sum0[5][4], int sum1[5][4], int width) { float ssim = 0.0; int i; for (i = 0; i < width; i++) ssim += ssim_end1(sum0[i][0] + sum0[i + 1][0] + sum1[i][0] + sum1[i + 1][0], sum0[i][1] + sum0[i + 1][1] + sum1[i][1] + sum1[i + 1][1], sum0[i][2] + sum0[i + 1][2] + sum1[i][2] + sum1[i + 1][2], sum0[i][3] + sum0[i + 1][3] + sum1[i][3] + sum1[i + 1][3]); return ssim; }
{ "code": [], "line_no": [] }
static float FUNC_0(int VAR_0[5][4], int VAR_1[5][4], int VAR_2) { float VAR_3 = 0.0; int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) VAR_3 += ssim_end1(VAR_0[VAR_4][0] + VAR_0[VAR_4 + 1][0] + VAR_1[VAR_4][0] + VAR_1[VAR_4 + 1][0], VAR_0[VAR_4][1] + VAR_0[VAR_4 + 1][1] + VAR_1[VAR_4][1] + VAR_1[VAR_4 + 1][1], VAR_0[VAR_4][2] + VAR_0[VAR_4 + 1][2] + VAR_1[VAR_4][2] + VAR_1[VAR_4 + 1][2], VAR_0[VAR_4][3] + VAR_0[VAR_4 + 1][3] + VAR_1[VAR_4][3] + VAR_1[VAR_4 + 1][3]); return VAR_3; }
[ "static float FUNC_0(int VAR_0[5][4], int VAR_1[5][4], int VAR_2)\n{", "float VAR_3 = 0.0;", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++)", "VAR_3 += ssim_end1(VAR_0[VAR_4][0] + VAR_0[VAR_4 + 1][0] + VAR_1[VAR_4][0] + VAR_1[VAR_4 + 1][0],\nVAR_0[VAR_4][1] + VAR_0[VAR_4 + 1][1] + VAR_1[VAR_4][1] + VAR_1[VAR_4 + 1][1],\nVAR_0[VAR_4][2] + VAR_0[VAR_4 + 1][2] + VAR_1[VAR_4][2] + VAR_1[VAR_4 + 1][2],\nVAR_0[VAR_4][3] + VAR_0[VAR_4 + 1][3] + VAR_1[VAR_4][3] + VAR_1[VAR_4 + 1][3]);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15, 17, 19 ], [ 21 ], [ 23 ] ]
5,007
static void avc_loopfilter_luma_intra_edge_hor_msa(uint8_t *data, uint8_t alpha_in, uint8_t beta_in, uint32_t img_width) { v16u8 p2_asub_p0, q2_asub_q0, p0_asub_q0; v16u8 alpha, beta; v16u8 is_less_than, is_less_than_beta, negate_is_less_than_beta; v16u8 p2, p1, p0, q0, q1, q2; v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org; v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r; v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l; v8i16 p2_r = { 0 }; v8i16 p1_r = { 0 }; v8i16 p0_r = { 0 }; v8i16 q0_r = { 0 }; v8i16 q1_r = { 0 }; v8i16 q2_r = { 0 }; v8i16 p2_l = { 0 }; v8i16 p1_l = { 0 }; v8i16 p0_l = { 0 }; v8i16 q0_l = { 0 }; v8i16 q1_l = { 0 }; v8i16 q2_l = { 0 }; v16u8 tmp_flag; v16i8 zero = { 0 }; alpha = (v16u8) __msa_fill_b(alpha_in); beta = (v16u8) __msa_fill_b(beta_in); p1_org = LOAD_UB(data - (img_width << 1)); p0_org = LOAD_UB(data - img_width); q0_org = LOAD_UB(data); q1_org = LOAD_UB(data + img_width); { v16u8 p1_asub_p0, q1_asub_q0, is_less_than_alpha; p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org); p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org); q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org); is_less_than_alpha = (p0_asub_q0 < alpha); is_less_than_beta = (p1_asub_p0 < beta); is_less_than = is_less_than_beta & is_less_than_alpha; is_less_than_beta = (q1_asub_q0 < beta); is_less_than = is_less_than_beta & is_less_than; } if (!__msa_test_bz_v(is_less_than)) { q2_org = LOAD_UB(data + (2 * img_width)); p3_org = LOAD_UB(data - (img_width << 2)); p2_org = LOAD_UB(data - (3 * img_width)); p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org); p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org); q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org); p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org); p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org); q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org); tmp_flag = alpha >> 2; tmp_flag = tmp_flag + 2; tmp_flag = (p0_asub_q0 < tmp_flag); p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org); is_less_than_beta = (p2_asub_p0 < beta); is_less_than_beta = is_less_than_beta & tmp_flag; negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff); is_less_than_beta = is_less_than_beta & is_less_than; negate_is_less_than_beta = negate_is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_l, is_less_than_beta_r; q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org); is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { v8i16 p3_org_r; p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org); p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r, q0_org_r, p1_org_r, p2_r, q1_org_r, p0_r, p1_r, p2_r); } q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org); is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { v8i16 p3_org_l; p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org); p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l, q0_org_l, p1_org_l, p2_l, q1_org_l, p0_l, p1_l, p2_l); } } /* combine and store */ if (!__msa_test_bz_v(is_less_than_beta)) { p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r); p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r); p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta); p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta); p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta); STORE_UB(p1_org, data - (2 * img_width)); STORE_UB(p2_org, data - (3 * img_width)); } { v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l; negate_is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) { AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r); } negate_is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) { AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l); } } /* combine */ if (!__msa_test_bz_v(negate_is_less_than_beta)) { p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta); } STORE_UB(p0_org, data - img_width); /* if (tmpFlag && (unsigned)ABS(q2-q0) < thresholds->beta_in) */ q3_org = LOAD_UB(data + (3 * img_width)); q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org); is_less_than_beta = (q2_asub_q0 < beta); is_less_than_beta = is_less_than_beta & tmp_flag; negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff); is_less_than_beta = is_less_than_beta & is_less_than; negate_is_less_than_beta = negate_is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_l, is_less_than_beta_r; is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { v8i16 q3_org_r; q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org); q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r, p0_org_r, q1_org_r, q2_r, p1_org_r, q0_r, q1_r, q2_r); } is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { v8i16 q3_org_l; q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org); q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l, p0_org_l, q1_org_l, q2_l, p1_org_l, q0_l, q1_l, q2_l); } } /* combine and store */ if (!__msa_test_bz_v(is_less_than_beta)) { q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r); q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r); q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta); q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta); q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta); STORE_UB(q1_org, data + img_width); STORE_UB(q2_org, data + 2 * img_width); } { v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l; negate_is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) { AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r); } negate_is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) { AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l); } } /* combine */ if (!__msa_test_bz_v(negate_is_less_than_beta)) { q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta); } STORE_UB(q0_org, data); } }
false
FFmpeg
bcd7bf7eeb09a395cc01698842d1b8be9af483fc
static void avc_loopfilter_luma_intra_edge_hor_msa(uint8_t *data, uint8_t alpha_in, uint8_t beta_in, uint32_t img_width) { v16u8 p2_asub_p0, q2_asub_q0, p0_asub_q0; v16u8 alpha, beta; v16u8 is_less_than, is_less_than_beta, negate_is_less_than_beta; v16u8 p2, p1, p0, q0, q1, q2; v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org; v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r; v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l; v8i16 p2_r = { 0 }; v8i16 p1_r = { 0 }; v8i16 p0_r = { 0 }; v8i16 q0_r = { 0 }; v8i16 q1_r = { 0 }; v8i16 q2_r = { 0 }; v8i16 p2_l = { 0 }; v8i16 p1_l = { 0 }; v8i16 p0_l = { 0 }; v8i16 q0_l = { 0 }; v8i16 q1_l = { 0 }; v8i16 q2_l = { 0 }; v16u8 tmp_flag; v16i8 zero = { 0 }; alpha = (v16u8) __msa_fill_b(alpha_in); beta = (v16u8) __msa_fill_b(beta_in); p1_org = LOAD_UB(data - (img_width << 1)); p0_org = LOAD_UB(data - img_width); q0_org = LOAD_UB(data); q1_org = LOAD_UB(data + img_width); { v16u8 p1_asub_p0, q1_asub_q0, is_less_than_alpha; p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org); p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org); q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org); is_less_than_alpha = (p0_asub_q0 < alpha); is_less_than_beta = (p1_asub_p0 < beta); is_less_than = is_less_than_beta & is_less_than_alpha; is_less_than_beta = (q1_asub_q0 < beta); is_less_than = is_less_than_beta & is_less_than; } if (!__msa_test_bz_v(is_less_than)) { q2_org = LOAD_UB(data + (2 * img_width)); p3_org = LOAD_UB(data - (img_width << 2)); p2_org = LOAD_UB(data - (3 * img_width)); p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org); p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org); q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org); p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org); p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org); q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org); tmp_flag = alpha >> 2; tmp_flag = tmp_flag + 2; tmp_flag = (p0_asub_q0 < tmp_flag); p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org); is_less_than_beta = (p2_asub_p0 < beta); is_less_than_beta = is_less_than_beta & tmp_flag; negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff); is_less_than_beta = is_less_than_beta & is_less_than; negate_is_less_than_beta = negate_is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_l, is_less_than_beta_r; q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org); is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { v8i16 p3_org_r; p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org); p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r, q0_org_r, p1_org_r, p2_r, q1_org_r, p0_r, p1_r, p2_r); } q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org); is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { v8i16 p3_org_l; p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org); p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l, q0_org_l, p1_org_l, p2_l, q1_org_l, p0_l, p1_l, p2_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r); p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r); p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta); p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta); p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta); STORE_UB(p1_org, data - (2 * img_width)); STORE_UB(p2_org, data - (3 * img_width)); } { v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l; negate_is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) { AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r); } negate_is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) { AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l); } } if (!__msa_test_bz_v(negate_is_less_than_beta)) { p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta); } STORE_UB(p0_org, data - img_width); q3_org = LOAD_UB(data + (3 * img_width)); q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org); is_less_than_beta = (q2_asub_q0 < beta); is_less_than_beta = is_less_than_beta & tmp_flag; negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff); is_less_than_beta = is_less_than_beta & is_less_than; negate_is_less_than_beta = negate_is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_l, is_less_than_beta_r; is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { v8i16 q3_org_r; q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org); q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r, p0_org_r, q1_org_r, q2_r, p1_org_r, q0_r, q1_r, q2_r); } is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { v8i16 q3_org_l; q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org); q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l, p0_org_l, q1_org_l, q2_l, p1_org_l, q0_l, q1_l, q2_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r); q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r); q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta); q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta); q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta); STORE_UB(q1_org, data + img_width); STORE_UB(q2_org, data + 2 * img_width); } { v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l; negate_is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) { AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r); } negate_is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) { AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l); } } if (!__msa_test_bz_v(negate_is_less_than_beta)) { q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta); } STORE_UB(q0_org, data); } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, uint8_t VAR_1, uint8_t VAR_2, uint32_t VAR_3) { v16u8 p2_asub_p0, q2_asub_q0, p0_asub_q0; v16u8 alpha, beta; v16u8 is_less_than, is_less_than_beta, negate_is_less_than_beta; v16u8 p2, p1, p0, q0, q1, q2; v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org; v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r; v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l; v8i16 p2_r = { 0 }; v8i16 p1_r = { 0 }; v8i16 p0_r = { 0 }; v8i16 q0_r = { 0 }; v8i16 q1_r = { 0 }; v8i16 q2_r = { 0 }; v8i16 p2_l = { 0 }; v8i16 p1_l = { 0 }; v8i16 p0_l = { 0 }; v8i16 q0_l = { 0 }; v8i16 q1_l = { 0 }; v8i16 q2_l = { 0 }; v16u8 tmp_flag; v16i8 zero = { 0 }; alpha = (v16u8) __msa_fill_b(VAR_1); beta = (v16u8) __msa_fill_b(VAR_2); p1_org = LOAD_UB(VAR_0 - (VAR_3 << 1)); p0_org = LOAD_UB(VAR_0 - VAR_3); q0_org = LOAD_UB(VAR_0); q1_org = LOAD_UB(VAR_0 + VAR_3); { v16u8 p1_asub_p0, q1_asub_q0, is_less_than_alpha; p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org); p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org); q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org); is_less_than_alpha = (p0_asub_q0 < alpha); is_less_than_beta = (p1_asub_p0 < beta); is_less_than = is_less_than_beta & is_less_than_alpha; is_less_than_beta = (q1_asub_q0 < beta); is_less_than = is_less_than_beta & is_less_than; } if (!__msa_test_bz_v(is_less_than)) { q2_org = LOAD_UB(VAR_0 + (2 * VAR_3)); p3_org = LOAD_UB(VAR_0 - (VAR_3 << 2)); p2_org = LOAD_UB(VAR_0 - (3 * VAR_3)); p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org); p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org); q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org); p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org); p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org); q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org); tmp_flag = alpha >> 2; tmp_flag = tmp_flag + 2; tmp_flag = (p0_asub_q0 < tmp_flag); p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org); is_less_than_beta = (p2_asub_p0 < beta); is_less_than_beta = is_less_than_beta & tmp_flag; negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff); is_less_than_beta = is_less_than_beta & is_less_than; negate_is_less_than_beta = negate_is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_l, is_less_than_beta_r; q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org); is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { v8i16 p3_org_r; p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org); p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r, q0_org_r, p1_org_r, p2_r, q1_org_r, p0_r, p1_r, p2_r); } q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org); is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { v8i16 p3_org_l; p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org); p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l, q0_org_l, p1_org_l, p2_l, q1_org_l, p0_l, p1_l, p2_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r); p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r); p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta); p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta); p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta); STORE_UB(p1_org, VAR_0 - (2 * VAR_3)); STORE_UB(p2_org, VAR_0 - (3 * VAR_3)); } { v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l; negate_is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) { AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r); } negate_is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) { AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l); } } if (!__msa_test_bz_v(negate_is_less_than_beta)) { p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta); } STORE_UB(p0_org, VAR_0 - VAR_3); q3_org = LOAD_UB(VAR_0 + (3 * VAR_3)); q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org); is_less_than_beta = (q2_asub_q0 < beta); is_less_than_beta = is_less_than_beta & tmp_flag; negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff); is_less_than_beta = is_less_than_beta & is_less_than; negate_is_less_than_beta = negate_is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_l, is_less_than_beta_r; is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { v8i16 q3_org_r; q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org); q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r, p0_org_r, q1_org_r, q2_r, p1_org_r, q0_r, q1_r, q2_r); } is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { v8i16 q3_org_l; q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org); q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l, p0_org_l, q1_org_l, q2_l, p1_org_l, q0_l, q1_l, q2_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r); q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r); q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta); q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta); q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta); STORE_UB(q1_org, VAR_0 + VAR_3); STORE_UB(q2_org, VAR_0 + 2 * VAR_3); } { v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l; negate_is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) { AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r); } negate_is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) { AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l); } } if (!__msa_test_bz_v(negate_is_less_than_beta)) { q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta); } STORE_UB(q0_org, VAR_0); } }
[ "static void FUNC_0(uint8_t *VAR_0,\nuint8_t VAR_1,\nuint8_t VAR_2,\nuint32_t VAR_3)\n{", "v16u8 p2_asub_p0, q2_asub_q0, p0_asub_q0;", "v16u8 alpha, beta;", "v16u8 is_less_than, is_less_than_beta, negate_is_less_than_beta;", "v16u8 p2, p1, p0, q0, q1, q2;", "v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org;", "v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;", "v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l;", "v8i16 p2_r = { 0 };", "v8i16 p1_r = { 0 };", "v8i16 p0_r = { 0 };", "v8i16 q0_r = { 0 };", "v8i16 q1_r = { 0 };", "v8i16 q2_r = { 0 };", "v8i16 p2_l = { 0 };", "v8i16 p1_l = { 0 };", "v8i16 p0_l = { 0 };", "v8i16 q0_l = { 0 };", "v8i16 q1_l = { 0 };", "v8i16 q2_l = { 0 };", "v16u8 tmp_flag;", "v16i8 zero = { 0 };", "alpha = (v16u8) __msa_fill_b(VAR_1);", "beta = (v16u8) __msa_fill_b(VAR_2);", "p1_org = LOAD_UB(VAR_0 - (VAR_3 << 1));", "p0_org = LOAD_UB(VAR_0 - VAR_3);", "q0_org = LOAD_UB(VAR_0);", "q1_org = LOAD_UB(VAR_0 + VAR_3);", "{", "v16u8 p1_asub_p0, q1_asub_q0, is_less_than_alpha;", "p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);", "p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);", "q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);", "is_less_than_alpha = (p0_asub_q0 < alpha);", "is_less_than_beta = (p1_asub_p0 < beta);", "is_less_than = is_less_than_beta & is_less_than_alpha;", "is_less_than_beta = (q1_asub_q0 < beta);", "is_less_than = is_less_than_beta & is_less_than;", "}", "if (!__msa_test_bz_v(is_less_than)) {", "q2_org = LOAD_UB(VAR_0 + (2 * VAR_3));", "p3_org = LOAD_UB(VAR_0 - (VAR_3 << 2));", "p2_org = LOAD_UB(VAR_0 - (3 * VAR_3));", "p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);", "p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);", "q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);", "p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org);", "p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org);", "q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org);", "tmp_flag = alpha >> 2;", "tmp_flag = tmp_flag + 2;", "tmp_flag = (p0_asub_q0 < tmp_flag);", "p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org);", "is_less_than_beta = (p2_asub_p0 < beta);", "is_less_than_beta = is_less_than_beta & tmp_flag;", "negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);", "is_less_than_beta = is_less_than_beta & is_less_than;", "negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;", "{", "v8u16 is_less_than_beta_l, is_less_than_beta_r;", "q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);", "is_less_than_beta_r =\n(v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);", "if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) {", "v8i16 p3_org_r;", "p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org);", "p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org);", "AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r,\nq0_org_r, p1_org_r,\np2_r, q1_org_r,\np0_r, p1_r, p2_r);", "}", "q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org);", "is_less_than_beta_l =\n(v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);", "if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) {", "v8i16 p3_org_l;", "p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org);", "p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org);", "AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l,\nq0_org_l, p1_org_l,\np2_l, q1_org_l,\np0_l, p1_l, p2_l);", "}", "}", "if (!__msa_test_bz_v(is_less_than_beta)) {", "p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);", "p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r);", "p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r);", "p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta);", "p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta);", "p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta);", "STORE_UB(p1_org, VAR_0 - (2 * VAR_3));", "STORE_UB(p2_org, VAR_0 - (3 * VAR_3));", "}", "{", "v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l;", "negate_is_less_than_beta_r =\n(v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);", "if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) {", "AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r);", "}", "negate_is_less_than_beta_l =\n(v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);", "if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) {", "AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l);", "}", "}", "if (!__msa_test_bz_v(negate_is_less_than_beta)) {", "p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);", "p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta);", "}", "STORE_UB(p0_org, VAR_0 - VAR_3);", "q3_org = LOAD_UB(VAR_0 + (3 * VAR_3));", "q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org);", "is_less_than_beta = (q2_asub_q0 < beta);", "is_less_than_beta = is_less_than_beta & tmp_flag;", "negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);", "is_less_than_beta = is_less_than_beta & is_less_than;", "negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;", "{", "v8u16 is_less_than_beta_l, is_less_than_beta_r;", "is_less_than_beta_r =\n(v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);", "if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) {", "v8i16 q3_org_r;", "q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org);", "q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org);", "AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r,\np0_org_r, q1_org_r,\nq2_r, p1_org_r,\nq0_r, q1_r, q2_r);", "}", "is_less_than_beta_l =\n(v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);", "if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) {", "v8i16 q3_org_l;", "q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org);", "q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org);", "AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l,\np0_org_l, q1_org_l,\nq2_l, p1_org_l,\nq0_l, q1_l, q2_l);", "}", "}", "if (!__msa_test_bz_v(is_less_than_beta)) {", "q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);", "q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r);", "q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r);", "q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta);", "q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta);", "q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta);", "STORE_UB(q1_org, VAR_0 + VAR_3);", "STORE_UB(q2_org, VAR_0 + 2 * VAR_3);", "}", "{", "v8u16 negate_is_less_than_beta_r, negate_is_less_than_beta_l;", "negate_is_less_than_beta_r =\n(v8u16) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);", "if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_r)) {", "AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r);", "}", "negate_is_less_than_beta_l =\n(v8u16) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);", "if (!__msa_test_bz_v((v16u8) negate_is_less_than_beta_l)) {", "AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l);", "}", "}", "if (!__msa_test_bz_v(negate_is_less_than_beta)) {", "q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);", "q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta);", "}", "STORE_UB(q0_org, VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 155 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 175, 177, 179, 181 ], [ 183 ], [ 187 ], [ 191, 193 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 209, 211, 213, 215 ], [ 217 ], [ 219 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 337 ], [ 339 ], [ 343, 345, 347, 349 ], [ 351 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 365 ], [ 367 ], [ 371, 373, 375, 377 ], [ 379 ], [ 381 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 397 ], [ 399 ], [ 401 ], [ 405 ], [ 407 ], [ 409 ], [ 413 ], [ 415 ], [ 419, 421 ], [ 423 ], [ 425 ], [ 427 ], [ 431, 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 457 ], [ 459 ], [ 461 ] ]
5,009
struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, unsigned long sdram_size, const char *core) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) g_malloc0(sizeof(struct omap_mpu_state_s)); qemu_irq dma_irqs[4]; DriveInfo *dinfo; int i; SysBusDevice *busdev; struct omap_target_agent_s *ta; /* Core */ s->mpu_model = omap2420; s->cpu = cpu_arm_init(core ?: "arm1136-r2"); if (s->cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->sdram_size = sdram_size; s->sram_size = OMAP242X_SRAM_SIZE; s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0); /* Clocks */ omap_clk_init(s); /* Memory-mapped stuff */ memory_region_init_ram(&s->sdram, NULL, "omap2.dram", s->sdram_size, &error_abort); vmstate_register_ram_global(&s->sdram); memory_region_add_subregion(sysmem, OMAP2_Q2_BASE, &s->sdram); memory_region_init_ram(&s->sram, NULL, "omap2.sram", s->sram_size, &error_abort); vmstate_register_ram_global(&s->sram); memory_region_add_subregion(sysmem, OMAP2_SRAM_BASE, &s->sram); s->l4 = omap_l4_init(sysmem, OMAP2_L4_BASE, 54); /* Actually mapped at any 2K boundary in the ARM11 private-peripheral if */ s->ih[0] = qdev_create(NULL, "omap2-intc"); qdev_prop_set_uint8(s->ih[0], "revision", 0x21); qdev_prop_set_ptr(s->ih[0], "fclk", omap_findclk(s, "mpu_intc_fclk")); qdev_prop_set_ptr(s->ih[0], "iclk", omap_findclk(s, "mpu_intc_iclk")); qdev_init_nofail(s->ih[0]); busdev = SYS_BUS_DEVICE(s->ih[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(busdev, 1, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ)); sysbus_mmio_map(busdev, 0, 0x480fe000); s->prcm = omap_prcm_init(omap_l4tao(s->l4, 3), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_PRCM_MPU_IRQ), NULL, NULL, s); s->sysc = omap_sysctl_init(omap_l4tao(s->l4, 1), omap_findclk(s, "omapctrl_iclk"), s); for (i = 0; i < 4; i++) { dma_irqs[i] = qdev_get_gpio_in(s->ih[omap2_dma_irq_map[i].ih], omap2_dma_irq_map[i].intr); } s->dma = omap_dma4_init(0x48056000, dma_irqs, sysmem, s, 256, 32, omap_findclk(s, "sdma_iclk"), omap_findclk(s, "sdma_fclk")); s->port->addr_valid = omap2_validate_addr; /* Register SDRAM and SRAM ports for fast DMA transfers. */ soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sdram), OMAP2_Q2_BASE, s->sdram_size); soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sram), OMAP2_SRAM_BASE, s->sram_size); s->uart[0] = omap2_uart_init(sysmem, omap_l4ta(s->l4, 19), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_UART1_IRQ), omap_findclk(s, "uart1_fclk"), omap_findclk(s, "uart1_iclk"), s->drq[OMAP24XX_DMA_UART1_TX], s->drq[OMAP24XX_DMA_UART1_RX], "uart1", serial_hds[0]); s->uart[1] = omap2_uart_init(sysmem, omap_l4ta(s->l4, 20), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_UART2_IRQ), omap_findclk(s, "uart2_fclk"), omap_findclk(s, "uart2_iclk"), s->drq[OMAP24XX_DMA_UART2_TX], s->drq[OMAP24XX_DMA_UART2_RX], "uart2", serial_hds[0] ? serial_hds[1] : NULL); s->uart[2] = omap2_uart_init(sysmem, omap_l4ta(s->l4, 21), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_UART3_IRQ), omap_findclk(s, "uart3_fclk"), omap_findclk(s, "uart3_iclk"), s->drq[OMAP24XX_DMA_UART3_TX], s->drq[OMAP24XX_DMA_UART3_RX], "uart3", serial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL); s->gptimer[0] = omap_gp_timer_init(omap_l4ta(s->l4, 7), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER1), omap_findclk(s, "wu_gpt1_clk"), omap_findclk(s, "wu_l4_iclk")); s->gptimer[1] = omap_gp_timer_init(omap_l4ta(s->l4, 8), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER2), omap_findclk(s, "core_gpt2_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[2] = omap_gp_timer_init(omap_l4ta(s->l4, 22), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER3), omap_findclk(s, "core_gpt3_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[3] = omap_gp_timer_init(omap_l4ta(s->l4, 23), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER4), omap_findclk(s, "core_gpt4_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[4] = omap_gp_timer_init(omap_l4ta(s->l4, 24), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER5), omap_findclk(s, "core_gpt5_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[5] = omap_gp_timer_init(omap_l4ta(s->l4, 25), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER6), omap_findclk(s, "core_gpt6_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[6] = omap_gp_timer_init(omap_l4ta(s->l4, 26), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER7), omap_findclk(s, "core_gpt7_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[7] = omap_gp_timer_init(omap_l4ta(s->l4, 27), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER8), omap_findclk(s, "core_gpt8_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[8] = omap_gp_timer_init(omap_l4ta(s->l4, 28), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER9), omap_findclk(s, "core_gpt9_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[9] = omap_gp_timer_init(omap_l4ta(s->l4, 29), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER10), omap_findclk(s, "core_gpt10_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[10] = omap_gp_timer_init(omap_l4ta(s->l4, 30), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER11), omap_findclk(s, "core_gpt11_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[11] = omap_gp_timer_init(omap_l4ta(s->l4, 31), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER12), omap_findclk(s, "core_gpt12_clk"), omap_findclk(s, "core_l4_iclk")); omap_tap_init(omap_l4ta(s->l4, 2), s); s->synctimer = omap_synctimer_init(omap_l4tao(s->l4, 2), s, omap_findclk(s, "clk32-kHz"), omap_findclk(s, "core_l4_iclk")); s->i2c[0] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[0], "revision", 0x34); qdev_prop_set_ptr(s->i2c[0], "iclk", omap_findclk(s, "i2c1.iclk")); qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "i2c1.fclk")); qdev_init_nofail(s->i2c[0]); busdev = SYS_BUS_DEVICE(s->i2c[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_I2C1_IRQ)); sysbus_connect_irq(busdev, 1, s->drq[OMAP24XX_DMA_I2C1_TX]); sysbus_connect_irq(busdev, 2, s->drq[OMAP24XX_DMA_I2C1_RX]); sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(s->l4, 5), 0)); s->i2c[1] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[1], "revision", 0x34); qdev_prop_set_ptr(s->i2c[1], "iclk", omap_findclk(s, "i2c2.iclk")); qdev_prop_set_ptr(s->i2c[1], "fclk", omap_findclk(s, "i2c2.fclk")); qdev_init_nofail(s->i2c[1]); busdev = SYS_BUS_DEVICE(s->i2c[1]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_I2C2_IRQ)); sysbus_connect_irq(busdev, 1, s->drq[OMAP24XX_DMA_I2C2_TX]); sysbus_connect_irq(busdev, 2, s->drq[OMAP24XX_DMA_I2C2_RX]); sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(s->l4, 6), 0)); s->gpio = qdev_create(NULL, "omap2-gpio"); qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model); qdev_prop_set_ptr(s->gpio, "iclk", omap_findclk(s, "gpio_iclk")); qdev_prop_set_ptr(s->gpio, "fclk0", omap_findclk(s, "gpio1_dbclk")); qdev_prop_set_ptr(s->gpio, "fclk1", omap_findclk(s, "gpio2_dbclk")); qdev_prop_set_ptr(s->gpio, "fclk2", omap_findclk(s, "gpio3_dbclk")); qdev_prop_set_ptr(s->gpio, "fclk3", omap_findclk(s, "gpio4_dbclk")); if (s->mpu_model == omap2430) { qdev_prop_set_ptr(s->gpio, "fclk4", omap_findclk(s, "gpio5_dbclk")); } qdev_init_nofail(s->gpio); busdev = SYS_BUS_DEVICE(s->gpio); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK1)); sysbus_connect_irq(busdev, 3, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK2)); sysbus_connect_irq(busdev, 6, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK3)); sysbus_connect_irq(busdev, 9, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK4)); if (s->mpu_model == omap2430) { sysbus_connect_irq(busdev, 12, qdev_get_gpio_in(s->ih[0], OMAP_INT_243X_GPIO_BANK5)); } ta = omap_l4ta(s->l4, 3); sysbus_mmio_map(busdev, 0, omap_l4_region_base(ta, 1)); sysbus_mmio_map(busdev, 1, omap_l4_region_base(ta, 0)); sysbus_mmio_map(busdev, 2, omap_l4_region_base(ta, 2)); sysbus_mmio_map(busdev, 3, omap_l4_region_base(ta, 4)); sysbus_mmio_map(busdev, 4, omap_l4_region_base(ta, 5)); s->sdrc = omap_sdrc_init(sysmem, 0x68009000); s->gpmc = omap_gpmc_init(s, 0x6800a000, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPMC_IRQ), s->drq[OMAP24XX_DMA_GPMC]); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9), blk_bs(blk_by_legacy_dinfo(dinfo)), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_MMC_IRQ), &s->drq[OMAP24XX_DMA_MMC1_TX], omap_findclk(s, "mmc_fclk"), omap_findclk(s, "mmc_iclk")); s->mcspi[0] = omap_mcspi_init(omap_l4ta(s->l4, 35), 4, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_MCSPI1_IRQ), &s->drq[OMAP24XX_DMA_SPI1_TX0], omap_findclk(s, "spi1_fclk"), omap_findclk(s, "spi1_iclk")); s->mcspi[1] = omap_mcspi_init(omap_l4ta(s->l4, 36), 2, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_MCSPI2_IRQ), &s->drq[OMAP24XX_DMA_SPI2_TX0], omap_findclk(s, "spi2_fclk"), omap_findclk(s, "spi2_iclk")); s->dss = omap_dss_init(omap_l4ta(s->l4, 10), sysmem, 0x68000800, /* XXX wire M_IRQ_25, D_L2_IRQ_30 and I_IRQ_13 together */ qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_DSS_IRQ), s->drq[OMAP24XX_DMA_DSS], omap_findclk(s, "dss_clk1"), omap_findclk(s, "dss_clk2"), omap_findclk(s, "dss_54m_clk"), omap_findclk(s, "dss_l3_iclk"), omap_findclk(s, "dss_l4_iclk")); omap_sti_init(omap_l4ta(s->l4, 18), sysmem, 0x54000000, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_STI), omap_findclk(s, "emul_ck"), serial_hds[0] && serial_hds[1] && serial_hds[2] ? serial_hds[3] : NULL); s->eac = omap_eac_init(omap_l4ta(s->l4, 32), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_EAC_IRQ), /* Ten consecutive lines */ &s->drq[OMAP24XX_DMA_EAC_AC_RD], omap_findclk(s, "func_96m_clk"), omap_findclk(s, "core_l4_iclk")); /* All register mappings (includin those not currenlty implemented): * SystemControlMod 48000000 - 48000fff * SystemControlL4 48001000 - 48001fff * 32kHz Timer Mod 48004000 - 48004fff * 32kHz Timer L4 48005000 - 48005fff * PRCM ModA 48008000 - 480087ff * PRCM ModB 48008800 - 48008fff * PRCM L4 48009000 - 48009fff * TEST-BCM Mod 48012000 - 48012fff * TEST-BCM L4 48013000 - 48013fff * TEST-TAP Mod 48014000 - 48014fff * TEST-TAP L4 48015000 - 48015fff * GPIO1 Mod 48018000 - 48018fff * GPIO Top 48019000 - 48019fff * GPIO2 Mod 4801a000 - 4801afff * GPIO L4 4801b000 - 4801bfff * GPIO3 Mod 4801c000 - 4801cfff * GPIO4 Mod 4801e000 - 4801efff * WDTIMER1 Mod 48020000 - 48010fff * WDTIMER Top 48021000 - 48011fff * WDTIMER2 Mod 48022000 - 48012fff * WDTIMER L4 48023000 - 48013fff * WDTIMER3 Mod 48024000 - 48014fff * WDTIMER3 L4 48025000 - 48015fff * WDTIMER4 Mod 48026000 - 48016fff * WDTIMER4 L4 48027000 - 48017fff * GPTIMER1 Mod 48028000 - 48018fff * GPTIMER1 L4 48029000 - 48019fff * GPTIMER2 Mod 4802a000 - 4801afff * GPTIMER2 L4 4802b000 - 4801bfff * L4-Config AP 48040000 - 480407ff * L4-Config IP 48040800 - 48040fff * L4-Config LA 48041000 - 48041fff * ARM11ETB Mod 48048000 - 48049fff * ARM11ETB L4 4804a000 - 4804afff * DISPLAY Top 48050000 - 480503ff * DISPLAY DISPC 48050400 - 480507ff * DISPLAY RFBI 48050800 - 48050bff * DISPLAY VENC 48050c00 - 48050fff * DISPLAY L4 48051000 - 48051fff * CAMERA Top 48052000 - 480523ff * CAMERA core 48052400 - 480527ff * CAMERA DMA 48052800 - 48052bff * CAMERA MMU 48052c00 - 48052fff * CAMERA L4 48053000 - 48053fff * SDMA Mod 48056000 - 48056fff * SDMA L4 48057000 - 48057fff * SSI Top 48058000 - 48058fff * SSI GDD 48059000 - 48059fff * SSI Port1 4805a000 - 4805afff * SSI Port2 4805b000 - 4805bfff * SSI L4 4805c000 - 4805cfff * USB Mod 4805e000 - 480fefff * USB L4 4805f000 - 480fffff * WIN_TRACER1 Mod 48060000 - 48060fff * WIN_TRACER1 L4 48061000 - 48061fff * WIN_TRACER2 Mod 48062000 - 48062fff * WIN_TRACER2 L4 48063000 - 48063fff * WIN_TRACER3 Mod 48064000 - 48064fff * WIN_TRACER3 L4 48065000 - 48065fff * WIN_TRACER4 Top 48066000 - 480660ff * WIN_TRACER4 ETT 48066100 - 480661ff * WIN_TRACER4 WT 48066200 - 480662ff * WIN_TRACER4 L4 48067000 - 48067fff * XTI Mod 48068000 - 48068fff * XTI L4 48069000 - 48069fff * UART1 Mod 4806a000 - 4806afff * UART1 L4 4806b000 - 4806bfff * UART2 Mod 4806c000 - 4806cfff * UART2 L4 4806d000 - 4806dfff * UART3 Mod 4806e000 - 4806efff * UART3 L4 4806f000 - 4806ffff * I2C1 Mod 48070000 - 48070fff * I2C1 L4 48071000 - 48071fff * I2C2 Mod 48072000 - 48072fff * I2C2 L4 48073000 - 48073fff * McBSP1 Mod 48074000 - 48074fff * McBSP1 L4 48075000 - 48075fff * McBSP2 Mod 48076000 - 48076fff * McBSP2 L4 48077000 - 48077fff * GPTIMER3 Mod 48078000 - 48078fff * GPTIMER3 L4 48079000 - 48079fff * GPTIMER4 Mod 4807a000 - 4807afff * GPTIMER4 L4 4807b000 - 4807bfff * GPTIMER5 Mod 4807c000 - 4807cfff * GPTIMER5 L4 4807d000 - 4807dfff * GPTIMER6 Mod 4807e000 - 4807efff * GPTIMER6 L4 4807f000 - 4807ffff * GPTIMER7 Mod 48080000 - 48080fff * GPTIMER7 L4 48081000 - 48081fff * GPTIMER8 Mod 48082000 - 48082fff * GPTIMER8 L4 48083000 - 48083fff * GPTIMER9 Mod 48084000 - 48084fff * GPTIMER9 L4 48085000 - 48085fff * GPTIMER10 Mod 48086000 - 48086fff * GPTIMER10 L4 48087000 - 48087fff * GPTIMER11 Mod 48088000 - 48088fff * GPTIMER11 L4 48089000 - 48089fff * GPTIMER12 Mod 4808a000 - 4808afff * GPTIMER12 L4 4808b000 - 4808bfff * EAC Mod 48090000 - 48090fff * EAC L4 48091000 - 48091fff * FAC Mod 48092000 - 48092fff * FAC L4 48093000 - 48093fff * MAILBOX Mod 48094000 - 48094fff * MAILBOX L4 48095000 - 48095fff * SPI1 Mod 48098000 - 48098fff * SPI1 L4 48099000 - 48099fff * SPI2 Mod 4809a000 - 4809afff * SPI2 L4 4809b000 - 4809bfff * MMC/SDIO Mod 4809c000 - 4809cfff * MMC/SDIO L4 4809d000 - 4809dfff * MS_PRO Mod 4809e000 - 4809efff * MS_PRO L4 4809f000 - 4809ffff * RNG Mod 480a0000 - 480a0fff * RNG L4 480a1000 - 480a1fff * DES3DES Mod 480a2000 - 480a2fff * DES3DES L4 480a3000 - 480a3fff * SHA1MD5 Mod 480a4000 - 480a4fff * SHA1MD5 L4 480a5000 - 480a5fff * AES Mod 480a6000 - 480a6fff * AES L4 480a7000 - 480a7fff * PKA Mod 480a8000 - 480a9fff * PKA L4 480aa000 - 480aafff * MG Mod 480b0000 - 480b0fff * MG L4 480b1000 - 480b1fff * HDQ/1-wire Mod 480b2000 - 480b2fff * HDQ/1-wire L4 480b3000 - 480b3fff * MPU interrupt 480fe000 - 480fefff * STI channel base 54000000 - 5400ffff * IVA RAM 5c000000 - 5c01ffff * IVA ROM 5c020000 - 5c027fff * IMG_BUF_A 5c040000 - 5c040fff * IMG_BUF_B 5c042000 - 5c042fff * VLCDS 5c048000 - 5c0487ff * IMX_COEF 5c049000 - 5c04afff * IMX_CMD 5c051000 - 5c051fff * VLCDQ 5c053000 - 5c0533ff * VLCDH 5c054000 - 5c054fff * SEQ_CMD 5c055000 - 5c055fff * IMX_REG 5c056000 - 5c0560ff * VLCD_REG 5c056100 - 5c0561ff * SEQ_REG 5c056200 - 5c0562ff * IMG_BUF_REG 5c056300 - 5c0563ff * SEQIRQ_REG 5c056400 - 5c0564ff * OCP_REG 5c060000 - 5c060fff * SYSC_REG 5c070000 - 5c070fff * MMU_REG 5d000000 - 5d000fff * sDMA R 68000400 - 680005ff * sDMA W 68000600 - 680007ff * Display Control 68000800 - 680009ff * DSP subsystem 68000a00 - 68000bff * MPU subsystem 68000c00 - 68000dff * IVA subsystem 68001000 - 680011ff * USB 68001200 - 680013ff * Camera 68001400 - 680015ff * VLYNQ (firewall) 68001800 - 68001bff * VLYNQ 68001e00 - 68001fff * SSI 68002000 - 680021ff * L4 68002400 - 680025ff * DSP (firewall) 68002800 - 68002bff * DSP subsystem 68002e00 - 68002fff * IVA (firewall) 68003000 - 680033ff * IVA 68003600 - 680037ff * GFX 68003a00 - 68003bff * CMDWR emulation 68003c00 - 68003dff * SMS 68004000 - 680041ff * OCM 68004200 - 680043ff * GPMC 68004400 - 680045ff * RAM (firewall) 68005000 - 680053ff * RAM (err login) 68005400 - 680057ff * ROM (firewall) 68005800 - 68005bff * ROM (err login) 68005c00 - 68005fff * GPMC (firewall) 68006000 - 680063ff * GPMC (err login) 68006400 - 680067ff * SMS (err login) 68006c00 - 68006fff * SMS registers 68008000 - 68008fff * SDRC registers 68009000 - 68009fff * GPMC registers 6800a000 6800afff */ qemu_register_reset(omap2_mpu_reset, s); return s; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, unsigned long sdram_size, const char *core) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) g_malloc0(sizeof(struct omap_mpu_state_s)); qemu_irq dma_irqs[4]; DriveInfo *dinfo; int i; SysBusDevice *busdev; struct omap_target_agent_s *ta; s->mpu_model = omap2420; s->cpu = cpu_arm_init(core ?: "arm1136-r2"); if (s->cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->sdram_size = sdram_size; s->sram_size = OMAP242X_SRAM_SIZE; s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0); omap_clk_init(s); memory_region_init_ram(&s->sdram, NULL, "omap2.dram", s->sdram_size, &error_abort); vmstate_register_ram_global(&s->sdram); memory_region_add_subregion(sysmem, OMAP2_Q2_BASE, &s->sdram); memory_region_init_ram(&s->sram, NULL, "omap2.sram", s->sram_size, &error_abort); vmstate_register_ram_global(&s->sram); memory_region_add_subregion(sysmem, OMAP2_SRAM_BASE, &s->sram); s->l4 = omap_l4_init(sysmem, OMAP2_L4_BASE, 54); s->ih[0] = qdev_create(NULL, "omap2-intc"); qdev_prop_set_uint8(s->ih[0], "revision", 0x21); qdev_prop_set_ptr(s->ih[0], "fclk", omap_findclk(s, "mpu_intc_fclk")); qdev_prop_set_ptr(s->ih[0], "iclk", omap_findclk(s, "mpu_intc_iclk")); qdev_init_nofail(s->ih[0]); busdev = SYS_BUS_DEVICE(s->ih[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(busdev, 1, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ)); sysbus_mmio_map(busdev, 0, 0x480fe000); s->prcm = omap_prcm_init(omap_l4tao(s->l4, 3), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_PRCM_MPU_IRQ), NULL, NULL, s); s->sysc = omap_sysctl_init(omap_l4tao(s->l4, 1), omap_findclk(s, "omapctrl_iclk"), s); for (i = 0; i < 4; i++) { dma_irqs[i] = qdev_get_gpio_in(s->ih[omap2_dma_irq_map[i].ih], omap2_dma_irq_map[i].intr); } s->dma = omap_dma4_init(0x48056000, dma_irqs, sysmem, s, 256, 32, omap_findclk(s, "sdma_iclk"), omap_findclk(s, "sdma_fclk")); s->port->addr_valid = omap2_validate_addr; soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sdram), OMAP2_Q2_BASE, s->sdram_size); soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sram), OMAP2_SRAM_BASE, s->sram_size); s->uart[0] = omap2_uart_init(sysmem, omap_l4ta(s->l4, 19), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_UART1_IRQ), omap_findclk(s, "uart1_fclk"), omap_findclk(s, "uart1_iclk"), s->drq[OMAP24XX_DMA_UART1_TX], s->drq[OMAP24XX_DMA_UART1_RX], "uart1", serial_hds[0]); s->uart[1] = omap2_uart_init(sysmem, omap_l4ta(s->l4, 20), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_UART2_IRQ), omap_findclk(s, "uart2_fclk"), omap_findclk(s, "uart2_iclk"), s->drq[OMAP24XX_DMA_UART2_TX], s->drq[OMAP24XX_DMA_UART2_RX], "uart2", serial_hds[0] ? serial_hds[1] : NULL); s->uart[2] = omap2_uart_init(sysmem, omap_l4ta(s->l4, 21), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_UART3_IRQ), omap_findclk(s, "uart3_fclk"), omap_findclk(s, "uart3_iclk"), s->drq[OMAP24XX_DMA_UART3_TX], s->drq[OMAP24XX_DMA_UART3_RX], "uart3", serial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL); s->gptimer[0] = omap_gp_timer_init(omap_l4ta(s->l4, 7), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER1), omap_findclk(s, "wu_gpt1_clk"), omap_findclk(s, "wu_l4_iclk")); s->gptimer[1] = omap_gp_timer_init(omap_l4ta(s->l4, 8), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER2), omap_findclk(s, "core_gpt2_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[2] = omap_gp_timer_init(omap_l4ta(s->l4, 22), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER3), omap_findclk(s, "core_gpt3_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[3] = omap_gp_timer_init(omap_l4ta(s->l4, 23), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER4), omap_findclk(s, "core_gpt4_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[4] = omap_gp_timer_init(omap_l4ta(s->l4, 24), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER5), omap_findclk(s, "core_gpt5_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[5] = omap_gp_timer_init(omap_l4ta(s->l4, 25), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER6), omap_findclk(s, "core_gpt6_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[6] = omap_gp_timer_init(omap_l4ta(s->l4, 26), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER7), omap_findclk(s, "core_gpt7_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[7] = omap_gp_timer_init(omap_l4ta(s->l4, 27), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER8), omap_findclk(s, "core_gpt8_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[8] = omap_gp_timer_init(omap_l4ta(s->l4, 28), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER9), omap_findclk(s, "core_gpt9_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[9] = omap_gp_timer_init(omap_l4ta(s->l4, 29), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER10), omap_findclk(s, "core_gpt10_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[10] = omap_gp_timer_init(omap_l4ta(s->l4, 30), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER11), omap_findclk(s, "core_gpt11_clk"), omap_findclk(s, "core_l4_iclk")); s->gptimer[11] = omap_gp_timer_init(omap_l4ta(s->l4, 31), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPTIMER12), omap_findclk(s, "core_gpt12_clk"), omap_findclk(s, "core_l4_iclk")); omap_tap_init(omap_l4ta(s->l4, 2), s); s->synctimer = omap_synctimer_init(omap_l4tao(s->l4, 2), s, omap_findclk(s, "clk32-kHz"), omap_findclk(s, "core_l4_iclk")); s->i2c[0] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[0], "revision", 0x34); qdev_prop_set_ptr(s->i2c[0], "iclk", omap_findclk(s, "i2c1.iclk")); qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "i2c1.fclk")); qdev_init_nofail(s->i2c[0]); busdev = SYS_BUS_DEVICE(s->i2c[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_I2C1_IRQ)); sysbus_connect_irq(busdev, 1, s->drq[OMAP24XX_DMA_I2C1_TX]); sysbus_connect_irq(busdev, 2, s->drq[OMAP24XX_DMA_I2C1_RX]); sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(s->l4, 5), 0)); s->i2c[1] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[1], "revision", 0x34); qdev_prop_set_ptr(s->i2c[1], "iclk", omap_findclk(s, "i2c2.iclk")); qdev_prop_set_ptr(s->i2c[1], "fclk", omap_findclk(s, "i2c2.fclk")); qdev_init_nofail(s->i2c[1]); busdev = SYS_BUS_DEVICE(s->i2c[1]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_I2C2_IRQ)); sysbus_connect_irq(busdev, 1, s->drq[OMAP24XX_DMA_I2C2_TX]); sysbus_connect_irq(busdev, 2, s->drq[OMAP24XX_DMA_I2C2_RX]); sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(s->l4, 6), 0)); s->gpio = qdev_create(NULL, "omap2-gpio"); qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model); qdev_prop_set_ptr(s->gpio, "iclk", omap_findclk(s, "gpio_iclk")); qdev_prop_set_ptr(s->gpio, "fclk0", omap_findclk(s, "gpio1_dbclk")); qdev_prop_set_ptr(s->gpio, "fclk1", omap_findclk(s, "gpio2_dbclk")); qdev_prop_set_ptr(s->gpio, "fclk2", omap_findclk(s, "gpio3_dbclk")); qdev_prop_set_ptr(s->gpio, "fclk3", omap_findclk(s, "gpio4_dbclk")); if (s->mpu_model == omap2430) { qdev_prop_set_ptr(s->gpio, "fclk4", omap_findclk(s, "gpio5_dbclk")); } qdev_init_nofail(s->gpio); busdev = SYS_BUS_DEVICE(s->gpio); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK1)); sysbus_connect_irq(busdev, 3, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK2)); sysbus_connect_irq(busdev, 6, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK3)); sysbus_connect_irq(busdev, 9, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPIO_BANK4)); if (s->mpu_model == omap2430) { sysbus_connect_irq(busdev, 12, qdev_get_gpio_in(s->ih[0], OMAP_INT_243X_GPIO_BANK5)); } ta = omap_l4ta(s->l4, 3); sysbus_mmio_map(busdev, 0, omap_l4_region_base(ta, 1)); sysbus_mmio_map(busdev, 1, omap_l4_region_base(ta, 0)); sysbus_mmio_map(busdev, 2, omap_l4_region_base(ta, 2)); sysbus_mmio_map(busdev, 3, omap_l4_region_base(ta, 4)); sysbus_mmio_map(busdev, 4, omap_l4_region_base(ta, 5)); s->sdrc = omap_sdrc_init(sysmem, 0x68009000); s->gpmc = omap_gpmc_init(s, 0x6800a000, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_GPMC_IRQ), s->drq[OMAP24XX_DMA_GPMC]); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9), blk_bs(blk_by_legacy_dinfo(dinfo)), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_MMC_IRQ), &s->drq[OMAP24XX_DMA_MMC1_TX], omap_findclk(s, "mmc_fclk"), omap_findclk(s, "mmc_iclk")); s->mcspi[0] = omap_mcspi_init(omap_l4ta(s->l4, 35), 4, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_MCSPI1_IRQ), &s->drq[OMAP24XX_DMA_SPI1_TX0], omap_findclk(s, "spi1_fclk"), omap_findclk(s, "spi1_iclk")); s->mcspi[1] = omap_mcspi_init(omap_l4ta(s->l4, 36), 2, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_MCSPI2_IRQ), &s->drq[OMAP24XX_DMA_SPI2_TX0], omap_findclk(s, "spi2_fclk"), omap_findclk(s, "spi2_iclk")); s->dss = omap_dss_init(omap_l4ta(s->l4, 10), sysmem, 0x68000800, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_DSS_IRQ), s->drq[OMAP24XX_DMA_DSS], omap_findclk(s, "dss_clk1"), omap_findclk(s, "dss_clk2"), omap_findclk(s, "dss_54m_clk"), omap_findclk(s, "dss_l3_iclk"), omap_findclk(s, "dss_l4_iclk")); omap_sti_init(omap_l4ta(s->l4, 18), sysmem, 0x54000000, qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_STI), omap_findclk(s, "emul_ck"), serial_hds[0] && serial_hds[1] && serial_hds[2] ? serial_hds[3] : NULL); s->eac = omap_eac_init(omap_l4ta(s->l4, 32), qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_EAC_IRQ), &s->drq[OMAP24XX_DMA_EAC_AC_RD], omap_findclk(s, "func_96m_clk"), omap_findclk(s, "core_l4_iclk")); qemu_register_reset(omap2_mpu_reset, s); return s; }
{ "code": [], "line_no": [] }
struct omap_mpu_state_s *FUNC_0(MemoryRegion *VAR_0, unsigned long VAR_1, const char *VAR_2) { struct omap_mpu_state_s *VAR_3 = (struct omap_mpu_state_s *) g_malloc0(sizeof(struct omap_mpu_state_s)); qemu_irq dma_irqs[4]; DriveInfo *dinfo; int VAR_4; SysBusDevice *busdev; struct omap_target_agent_s *VAR_5; VAR_3->mpu_model = omap2420; VAR_3->cpu = cpu_arm_init(VAR_2 ?: "arm1136-r2"); if (VAR_3->cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } VAR_3->VAR_1 = VAR_1; VAR_3->sram_size = OMAP242X_SRAM_SIZE; VAR_3->wakeup = qemu_allocate_irq(omap_mpu_wakeup, VAR_3, 0); omap_clk_init(VAR_3); memory_region_init_ram(&VAR_3->sdram, NULL, "omap2.dram", VAR_3->VAR_1, &error_abort); vmstate_register_ram_global(&VAR_3->sdram); memory_region_add_subregion(VAR_0, OMAP2_Q2_BASE, &VAR_3->sdram); memory_region_init_ram(&VAR_3->sram, NULL, "omap2.sram", VAR_3->sram_size, &error_abort); vmstate_register_ram_global(&VAR_3->sram); memory_region_add_subregion(VAR_0, OMAP2_SRAM_BASE, &VAR_3->sram); VAR_3->l4 = omap_l4_init(VAR_0, OMAP2_L4_BASE, 54); VAR_3->ih[0] = qdev_create(NULL, "omap2-intc"); qdev_prop_set_uint8(VAR_3->ih[0], "revision", 0x21); qdev_prop_set_ptr(VAR_3->ih[0], "fclk", omap_findclk(VAR_3, "mpu_intc_fclk")); qdev_prop_set_ptr(VAR_3->ih[0], "iclk", omap_findclk(VAR_3, "mpu_intc_iclk")); qdev_init_nofail(VAR_3->ih[0]); busdev = SYS_BUS_DEVICE(VAR_3->ih[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(VAR_3->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(busdev, 1, qdev_get_gpio_in(DEVICE(VAR_3->cpu), ARM_CPU_FIQ)); sysbus_mmio_map(busdev, 0, 0x480fe000); VAR_3->prcm = omap_prcm_init(omap_l4tao(VAR_3->l4, 3), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_PRCM_MPU_IRQ), NULL, NULL, VAR_3); VAR_3->sysc = omap_sysctl_init(omap_l4tao(VAR_3->l4, 1), omap_findclk(VAR_3, "omapctrl_iclk"), VAR_3); for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { dma_irqs[VAR_4] = qdev_get_gpio_in(VAR_3->ih[omap2_dma_irq_map[VAR_4].ih], omap2_dma_irq_map[VAR_4].intr); } VAR_3->dma = omap_dma4_init(0x48056000, dma_irqs, VAR_0, VAR_3, 256, 32, omap_findclk(VAR_3, "sdma_iclk"), omap_findclk(VAR_3, "sdma_fclk")); VAR_3->port->addr_valid = omap2_validate_addr; soc_dma_port_add_mem(VAR_3->dma, memory_region_get_ram_ptr(&VAR_3->sdram), OMAP2_Q2_BASE, VAR_3->VAR_1); soc_dma_port_add_mem(VAR_3->dma, memory_region_get_ram_ptr(&VAR_3->sram), OMAP2_SRAM_BASE, VAR_3->sram_size); VAR_3->uart[0] = omap2_uart_init(VAR_0, omap_l4ta(VAR_3->l4, 19), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_UART1_IRQ), omap_findclk(VAR_3, "uart1_fclk"), omap_findclk(VAR_3, "uart1_iclk"), VAR_3->drq[OMAP24XX_DMA_UART1_TX], VAR_3->drq[OMAP24XX_DMA_UART1_RX], "uart1", serial_hds[0]); VAR_3->uart[1] = omap2_uart_init(VAR_0, omap_l4ta(VAR_3->l4, 20), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_UART2_IRQ), omap_findclk(VAR_3, "uart2_fclk"), omap_findclk(VAR_3, "uart2_iclk"), VAR_3->drq[OMAP24XX_DMA_UART2_TX], VAR_3->drq[OMAP24XX_DMA_UART2_RX], "uart2", serial_hds[0] ? serial_hds[1] : NULL); VAR_3->uart[2] = omap2_uart_init(VAR_0, omap_l4ta(VAR_3->l4, 21), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_UART3_IRQ), omap_findclk(VAR_3, "uart3_fclk"), omap_findclk(VAR_3, "uart3_iclk"), VAR_3->drq[OMAP24XX_DMA_UART3_TX], VAR_3->drq[OMAP24XX_DMA_UART3_RX], "uart3", serial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL); VAR_3->gptimer[0] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 7), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER1), omap_findclk(VAR_3, "wu_gpt1_clk"), omap_findclk(VAR_3, "wu_l4_iclk")); VAR_3->gptimer[1] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 8), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER2), omap_findclk(VAR_3, "core_gpt2_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[2] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 22), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER3), omap_findclk(VAR_3, "core_gpt3_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[3] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 23), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER4), omap_findclk(VAR_3, "core_gpt4_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[4] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 24), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER5), omap_findclk(VAR_3, "core_gpt5_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[5] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 25), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER6), omap_findclk(VAR_3, "core_gpt6_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[6] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 26), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER7), omap_findclk(VAR_3, "core_gpt7_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[7] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 27), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER8), omap_findclk(VAR_3, "core_gpt8_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[8] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 28), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER9), omap_findclk(VAR_3, "core_gpt9_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[9] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 29), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER10), omap_findclk(VAR_3, "core_gpt10_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[10] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 30), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER11), omap_findclk(VAR_3, "core_gpt11_clk"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->gptimer[11] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 31), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER12), omap_findclk(VAR_3, "core_gpt12_clk"), omap_findclk(VAR_3, "core_l4_iclk")); omap_tap_init(omap_l4ta(VAR_3->l4, 2), VAR_3); VAR_3->synctimer = omap_synctimer_init(omap_l4tao(VAR_3->l4, 2), VAR_3, omap_findclk(VAR_3, "clk32-kHz"), omap_findclk(VAR_3, "core_l4_iclk")); VAR_3->i2c[0] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(VAR_3->i2c[0], "revision", 0x34); qdev_prop_set_ptr(VAR_3->i2c[0], "iclk", omap_findclk(VAR_3, "i2c1.iclk")); qdev_prop_set_ptr(VAR_3->i2c[0], "fclk", omap_findclk(VAR_3, "i2c1.fclk")); qdev_init_nofail(VAR_3->i2c[0]); busdev = SYS_BUS_DEVICE(VAR_3->i2c[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_I2C1_IRQ)); sysbus_connect_irq(busdev, 1, VAR_3->drq[OMAP24XX_DMA_I2C1_TX]); sysbus_connect_irq(busdev, 2, VAR_3->drq[OMAP24XX_DMA_I2C1_RX]); sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(VAR_3->l4, 5), 0)); VAR_3->i2c[1] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(VAR_3->i2c[1], "revision", 0x34); qdev_prop_set_ptr(VAR_3->i2c[1], "iclk", omap_findclk(VAR_3, "i2c2.iclk")); qdev_prop_set_ptr(VAR_3->i2c[1], "fclk", omap_findclk(VAR_3, "i2c2.fclk")); qdev_init_nofail(VAR_3->i2c[1]); busdev = SYS_BUS_DEVICE(VAR_3->i2c[1]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_I2C2_IRQ)); sysbus_connect_irq(busdev, 1, VAR_3->drq[OMAP24XX_DMA_I2C2_TX]); sysbus_connect_irq(busdev, 2, VAR_3->drq[OMAP24XX_DMA_I2C2_RX]); sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(VAR_3->l4, 6), 0)); VAR_3->gpio = qdev_create(NULL, "omap2-gpio"); qdev_prop_set_int32(VAR_3->gpio, "mpu_model", VAR_3->mpu_model); qdev_prop_set_ptr(VAR_3->gpio, "iclk", omap_findclk(VAR_3, "gpio_iclk")); qdev_prop_set_ptr(VAR_3->gpio, "fclk0", omap_findclk(VAR_3, "gpio1_dbclk")); qdev_prop_set_ptr(VAR_3->gpio, "fclk1", omap_findclk(VAR_3, "gpio2_dbclk")); qdev_prop_set_ptr(VAR_3->gpio, "fclk2", omap_findclk(VAR_3, "gpio3_dbclk")); qdev_prop_set_ptr(VAR_3->gpio, "fclk3", omap_findclk(VAR_3, "gpio4_dbclk")); if (VAR_3->mpu_model == omap2430) { qdev_prop_set_ptr(VAR_3->gpio, "fclk4", omap_findclk(VAR_3, "gpio5_dbclk")); } qdev_init_nofail(VAR_3->gpio); busdev = SYS_BUS_DEVICE(VAR_3->gpio); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK1)); sysbus_connect_irq(busdev, 3, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK2)); sysbus_connect_irq(busdev, 6, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK3)); sysbus_connect_irq(busdev, 9, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK4)); if (VAR_3->mpu_model == omap2430) { sysbus_connect_irq(busdev, 12, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_243X_GPIO_BANK5)); } VAR_5 = omap_l4ta(VAR_3->l4, 3); sysbus_mmio_map(busdev, 0, omap_l4_region_base(VAR_5, 1)); sysbus_mmio_map(busdev, 1, omap_l4_region_base(VAR_5, 0)); sysbus_mmio_map(busdev, 2, omap_l4_region_base(VAR_5, 2)); sysbus_mmio_map(busdev, 3, omap_l4_region_base(VAR_5, 4)); sysbus_mmio_map(busdev, 4, omap_l4_region_base(VAR_5, 5)); VAR_3->sdrc = omap_sdrc_init(VAR_0, 0x68009000); VAR_3->gpmc = omap_gpmc_init(VAR_3, 0x6800a000, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPMC_IRQ), VAR_3->drq[OMAP24XX_DMA_GPMC]); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } VAR_3->mmc = omap2_mmc_init(omap_l4tao(VAR_3->l4, 9), blk_bs(blk_by_legacy_dinfo(dinfo)), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_MMC_IRQ), &VAR_3->drq[OMAP24XX_DMA_MMC1_TX], omap_findclk(VAR_3, "mmc_fclk"), omap_findclk(VAR_3, "mmc_iclk")); VAR_3->mcspi[0] = omap_mcspi_init(omap_l4ta(VAR_3->l4, 35), 4, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_MCSPI1_IRQ), &VAR_3->drq[OMAP24XX_DMA_SPI1_TX0], omap_findclk(VAR_3, "spi1_fclk"), omap_findclk(VAR_3, "spi1_iclk")); VAR_3->mcspi[1] = omap_mcspi_init(omap_l4ta(VAR_3->l4, 36), 2, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_MCSPI2_IRQ), &VAR_3->drq[OMAP24XX_DMA_SPI2_TX0], omap_findclk(VAR_3, "spi2_fclk"), omap_findclk(VAR_3, "spi2_iclk")); VAR_3->dss = omap_dss_init(omap_l4ta(VAR_3->l4, 10), VAR_0, 0x68000800, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_DSS_IRQ), VAR_3->drq[OMAP24XX_DMA_DSS], omap_findclk(VAR_3, "dss_clk1"), omap_findclk(VAR_3, "dss_clk2"), omap_findclk(VAR_3, "dss_54m_clk"), omap_findclk(VAR_3, "dss_l3_iclk"), omap_findclk(VAR_3, "dss_l4_iclk")); omap_sti_init(omap_l4ta(VAR_3->l4, 18), VAR_0, 0x54000000, qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_STI), omap_findclk(VAR_3, "emul_ck"), serial_hds[0] && serial_hds[1] && serial_hds[2] ? serial_hds[3] : NULL); VAR_3->eac = omap_eac_init(omap_l4ta(VAR_3->l4, 32), qdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_EAC_IRQ), &VAR_3->drq[OMAP24XX_DMA_EAC_AC_RD], omap_findclk(VAR_3, "func_96m_clk"), omap_findclk(VAR_3, "core_l4_iclk")); qemu_register_reset(omap2_mpu_reset, VAR_3); return VAR_3; }
[ "struct omap_mpu_state_s *FUNC_0(MemoryRegion *VAR_0,\nunsigned long VAR_1,\nconst char *VAR_2)\n{", "struct omap_mpu_state_s *VAR_3 = (struct omap_mpu_state_s *)\ng_malloc0(sizeof(struct omap_mpu_state_s));", "qemu_irq dma_irqs[4];", "DriveInfo *dinfo;", "int VAR_4;", "SysBusDevice *busdev;", "struct omap_target_agent_s *VAR_5;", "VAR_3->mpu_model = omap2420;", "VAR_3->cpu = cpu_arm_init(VAR_2 ?: \"arm1136-r2\");", "if (VAR_3->cpu == NULL) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "VAR_3->VAR_1 = VAR_1;", "VAR_3->sram_size = OMAP242X_SRAM_SIZE;", "VAR_3->wakeup = qemu_allocate_irq(omap_mpu_wakeup, VAR_3, 0);", "omap_clk_init(VAR_3);", "memory_region_init_ram(&VAR_3->sdram, NULL, \"omap2.dram\", VAR_3->VAR_1,\n&error_abort);", "vmstate_register_ram_global(&VAR_3->sdram);", "memory_region_add_subregion(VAR_0, OMAP2_Q2_BASE, &VAR_3->sdram);", "memory_region_init_ram(&VAR_3->sram, NULL, \"omap2.sram\", VAR_3->sram_size,\n&error_abort);", "vmstate_register_ram_global(&VAR_3->sram);", "memory_region_add_subregion(VAR_0, OMAP2_SRAM_BASE, &VAR_3->sram);", "VAR_3->l4 = omap_l4_init(VAR_0, OMAP2_L4_BASE, 54);", "VAR_3->ih[0] = qdev_create(NULL, \"omap2-intc\");", "qdev_prop_set_uint8(VAR_3->ih[0], \"revision\", 0x21);", "qdev_prop_set_ptr(VAR_3->ih[0], \"fclk\", omap_findclk(VAR_3, \"mpu_intc_fclk\"));", "qdev_prop_set_ptr(VAR_3->ih[0], \"iclk\", omap_findclk(VAR_3, \"mpu_intc_iclk\"));", "qdev_init_nofail(VAR_3->ih[0]);", "busdev = SYS_BUS_DEVICE(VAR_3->ih[0]);", "sysbus_connect_irq(busdev, 0,\nqdev_get_gpio_in(DEVICE(VAR_3->cpu), ARM_CPU_IRQ));", "sysbus_connect_irq(busdev, 1,\nqdev_get_gpio_in(DEVICE(VAR_3->cpu), ARM_CPU_FIQ));", "sysbus_mmio_map(busdev, 0, 0x480fe000);", "VAR_3->prcm = omap_prcm_init(omap_l4tao(VAR_3->l4, 3),\nqdev_get_gpio_in(VAR_3->ih[0],\nOMAP_INT_24XX_PRCM_MPU_IRQ),\nNULL, NULL, VAR_3);", "VAR_3->sysc = omap_sysctl_init(omap_l4tao(VAR_3->l4, 1),\nomap_findclk(VAR_3, \"omapctrl_iclk\"), VAR_3);", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++) {", "dma_irqs[VAR_4] = qdev_get_gpio_in(VAR_3->ih[omap2_dma_irq_map[VAR_4].ih],\nomap2_dma_irq_map[VAR_4].intr);", "}", "VAR_3->dma = omap_dma4_init(0x48056000, dma_irqs, VAR_0, VAR_3, 256, 32,\nomap_findclk(VAR_3, \"sdma_iclk\"),\nomap_findclk(VAR_3, \"sdma_fclk\"));", "VAR_3->port->addr_valid = omap2_validate_addr;", "soc_dma_port_add_mem(VAR_3->dma, memory_region_get_ram_ptr(&VAR_3->sdram),\nOMAP2_Q2_BASE, VAR_3->VAR_1);", "soc_dma_port_add_mem(VAR_3->dma, memory_region_get_ram_ptr(&VAR_3->sram),\nOMAP2_SRAM_BASE, VAR_3->sram_size);", "VAR_3->uart[0] = omap2_uart_init(VAR_0, omap_l4ta(VAR_3->l4, 19),\nqdev_get_gpio_in(VAR_3->ih[0],\nOMAP_INT_24XX_UART1_IRQ),\nomap_findclk(VAR_3, \"uart1_fclk\"),\nomap_findclk(VAR_3, \"uart1_iclk\"),\nVAR_3->drq[OMAP24XX_DMA_UART1_TX],\nVAR_3->drq[OMAP24XX_DMA_UART1_RX],\n\"uart1\",\nserial_hds[0]);", "VAR_3->uart[1] = omap2_uart_init(VAR_0, omap_l4ta(VAR_3->l4, 20),\nqdev_get_gpio_in(VAR_3->ih[0],\nOMAP_INT_24XX_UART2_IRQ),\nomap_findclk(VAR_3, \"uart2_fclk\"),\nomap_findclk(VAR_3, \"uart2_iclk\"),\nVAR_3->drq[OMAP24XX_DMA_UART2_TX],\nVAR_3->drq[OMAP24XX_DMA_UART2_RX],\n\"uart2\",\nserial_hds[0] ? serial_hds[1] : NULL);", "VAR_3->uart[2] = omap2_uart_init(VAR_0, omap_l4ta(VAR_3->l4, 21),\nqdev_get_gpio_in(VAR_3->ih[0],\nOMAP_INT_24XX_UART3_IRQ),\nomap_findclk(VAR_3, \"uart3_fclk\"),\nomap_findclk(VAR_3, \"uart3_iclk\"),\nVAR_3->drq[OMAP24XX_DMA_UART3_TX],\nVAR_3->drq[OMAP24XX_DMA_UART3_RX],\n\"uart3\",\nserial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL);", "VAR_3->gptimer[0] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 7),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER1),\nomap_findclk(VAR_3, \"wu_gpt1_clk\"),\nomap_findclk(VAR_3, \"wu_l4_iclk\"));", "VAR_3->gptimer[1] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 8),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER2),\nomap_findclk(VAR_3, \"core_gpt2_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[2] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 22),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER3),\nomap_findclk(VAR_3, \"core_gpt3_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[3] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 23),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER4),\nomap_findclk(VAR_3, \"core_gpt4_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[4] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 24),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER5),\nomap_findclk(VAR_3, \"core_gpt5_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[5] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 25),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER6),\nomap_findclk(VAR_3, \"core_gpt6_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[6] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 26),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER7),\nomap_findclk(VAR_3, \"core_gpt7_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[7] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 27),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER8),\nomap_findclk(VAR_3, \"core_gpt8_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[8] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 28),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER9),\nomap_findclk(VAR_3, \"core_gpt9_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[9] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 29),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER10),\nomap_findclk(VAR_3, \"core_gpt10_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[10] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 30),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER11),\nomap_findclk(VAR_3, \"core_gpt11_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->gptimer[11] = omap_gp_timer_init(omap_l4ta(VAR_3->l4, 31),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPTIMER12),\nomap_findclk(VAR_3, \"core_gpt12_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "omap_tap_init(omap_l4ta(VAR_3->l4, 2), VAR_3);", "VAR_3->synctimer = omap_synctimer_init(omap_l4tao(VAR_3->l4, 2), VAR_3,\nomap_findclk(VAR_3, \"clk32-kHz\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "VAR_3->i2c[0] = qdev_create(NULL, \"omap_i2c\");", "qdev_prop_set_uint8(VAR_3->i2c[0], \"revision\", 0x34);", "qdev_prop_set_ptr(VAR_3->i2c[0], \"iclk\", omap_findclk(VAR_3, \"i2c1.iclk\"));", "qdev_prop_set_ptr(VAR_3->i2c[0], \"fclk\", omap_findclk(VAR_3, \"i2c1.fclk\"));", "qdev_init_nofail(VAR_3->i2c[0]);", "busdev = SYS_BUS_DEVICE(VAR_3->i2c[0]);", "sysbus_connect_irq(busdev, 0,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_I2C1_IRQ));", "sysbus_connect_irq(busdev, 1, VAR_3->drq[OMAP24XX_DMA_I2C1_TX]);", "sysbus_connect_irq(busdev, 2, VAR_3->drq[OMAP24XX_DMA_I2C1_RX]);", "sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(VAR_3->l4, 5), 0));", "VAR_3->i2c[1] = qdev_create(NULL, \"omap_i2c\");", "qdev_prop_set_uint8(VAR_3->i2c[1], \"revision\", 0x34);", "qdev_prop_set_ptr(VAR_3->i2c[1], \"iclk\", omap_findclk(VAR_3, \"i2c2.iclk\"));", "qdev_prop_set_ptr(VAR_3->i2c[1], \"fclk\", omap_findclk(VAR_3, \"i2c2.fclk\"));", "qdev_init_nofail(VAR_3->i2c[1]);", "busdev = SYS_BUS_DEVICE(VAR_3->i2c[1]);", "sysbus_connect_irq(busdev, 0,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_I2C2_IRQ));", "sysbus_connect_irq(busdev, 1, VAR_3->drq[OMAP24XX_DMA_I2C2_TX]);", "sysbus_connect_irq(busdev, 2, VAR_3->drq[OMAP24XX_DMA_I2C2_RX]);", "sysbus_mmio_map(busdev, 0, omap_l4_region_base(omap_l4tao(VAR_3->l4, 6), 0));", "VAR_3->gpio = qdev_create(NULL, \"omap2-gpio\");", "qdev_prop_set_int32(VAR_3->gpio, \"mpu_model\", VAR_3->mpu_model);", "qdev_prop_set_ptr(VAR_3->gpio, \"iclk\", omap_findclk(VAR_3, \"gpio_iclk\"));", "qdev_prop_set_ptr(VAR_3->gpio, \"fclk0\", omap_findclk(VAR_3, \"gpio1_dbclk\"));", "qdev_prop_set_ptr(VAR_3->gpio, \"fclk1\", omap_findclk(VAR_3, \"gpio2_dbclk\"));", "qdev_prop_set_ptr(VAR_3->gpio, \"fclk2\", omap_findclk(VAR_3, \"gpio3_dbclk\"));", "qdev_prop_set_ptr(VAR_3->gpio, \"fclk3\", omap_findclk(VAR_3, \"gpio4_dbclk\"));", "if (VAR_3->mpu_model == omap2430) {", "qdev_prop_set_ptr(VAR_3->gpio, \"fclk4\", omap_findclk(VAR_3, \"gpio5_dbclk\"));", "}", "qdev_init_nofail(VAR_3->gpio);", "busdev = SYS_BUS_DEVICE(VAR_3->gpio);", "sysbus_connect_irq(busdev, 0,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK1));", "sysbus_connect_irq(busdev, 3,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK2));", "sysbus_connect_irq(busdev, 6,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK3));", "sysbus_connect_irq(busdev, 9,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPIO_BANK4));", "if (VAR_3->mpu_model == omap2430) {", "sysbus_connect_irq(busdev, 12,\nqdev_get_gpio_in(VAR_3->ih[0],\nOMAP_INT_243X_GPIO_BANK5));", "}", "VAR_5 = omap_l4ta(VAR_3->l4, 3);", "sysbus_mmio_map(busdev, 0, omap_l4_region_base(VAR_5, 1));", "sysbus_mmio_map(busdev, 1, omap_l4_region_base(VAR_5, 0));", "sysbus_mmio_map(busdev, 2, omap_l4_region_base(VAR_5, 2));", "sysbus_mmio_map(busdev, 3, omap_l4_region_base(VAR_5, 4));", "sysbus_mmio_map(busdev, 4, omap_l4_region_base(VAR_5, 5));", "VAR_3->sdrc = omap_sdrc_init(VAR_0, 0x68009000);", "VAR_3->gpmc = omap_gpmc_init(VAR_3, 0x6800a000,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_GPMC_IRQ),\nVAR_3->drq[OMAP24XX_DMA_GPMC]);", "dinfo = drive_get(IF_SD, 0, 0);", "if (!dinfo) {", "fprintf(stderr, \"qemu: missing SecureDigital device\\n\");", "exit(1);", "}", "VAR_3->mmc = omap2_mmc_init(omap_l4tao(VAR_3->l4, 9),\nblk_bs(blk_by_legacy_dinfo(dinfo)),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_MMC_IRQ),\n&VAR_3->drq[OMAP24XX_DMA_MMC1_TX],\nomap_findclk(VAR_3, \"mmc_fclk\"), omap_findclk(VAR_3, \"mmc_iclk\"));", "VAR_3->mcspi[0] = omap_mcspi_init(omap_l4ta(VAR_3->l4, 35), 4,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_MCSPI1_IRQ),\n&VAR_3->drq[OMAP24XX_DMA_SPI1_TX0],\nomap_findclk(VAR_3, \"spi1_fclk\"),\nomap_findclk(VAR_3, \"spi1_iclk\"));", "VAR_3->mcspi[1] = omap_mcspi_init(omap_l4ta(VAR_3->l4, 36), 2,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_MCSPI2_IRQ),\n&VAR_3->drq[OMAP24XX_DMA_SPI2_TX0],\nomap_findclk(VAR_3, \"spi2_fclk\"),\nomap_findclk(VAR_3, \"spi2_iclk\"));", "VAR_3->dss = omap_dss_init(omap_l4ta(VAR_3->l4, 10), VAR_0, 0x68000800,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_DSS_IRQ),\nVAR_3->drq[OMAP24XX_DMA_DSS],\nomap_findclk(VAR_3, \"dss_clk1\"), omap_findclk(VAR_3, \"dss_clk2\"),\nomap_findclk(VAR_3, \"dss_54m_clk\"),\nomap_findclk(VAR_3, \"dss_l3_iclk\"),\nomap_findclk(VAR_3, \"dss_l4_iclk\"));", "omap_sti_init(omap_l4ta(VAR_3->l4, 18), VAR_0, 0x54000000,\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_STI),\nomap_findclk(VAR_3, \"emul_ck\"),\nserial_hds[0] && serial_hds[1] && serial_hds[2] ?\nserial_hds[3] : NULL);", "VAR_3->eac = omap_eac_init(omap_l4ta(VAR_3->l4, 32),\nqdev_get_gpio_in(VAR_3->ih[0], OMAP_INT_24XX_EAC_IRQ),\n&VAR_3->drq[OMAP24XX_DMA_EAC_AC_RD],\nomap_findclk(VAR_3, \"func_96m_clk\"),\nomap_findclk(VAR_3, \"core_l4_iclk\"));", "qemu_register_reset(omap2_mpu_reset, VAR_3);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 51 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97, 99 ], [ 101 ], [ 103, 105, 107, 109 ], [ 113, 115 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127, 129, 131 ], [ 133 ], [ 139, 141 ], [ 143, 145 ], [ 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 ], [ 205, 207, 209, 211 ], [ 213, 215, 217, 219 ], [ 221, 223, 225, 227 ], [ 229, 231, 233, 235 ], [ 237, 239, 241, 243 ], [ 245, 247, 249, 251 ], [ 253, 255, 257, 259 ], [ 261, 263, 265, 267 ], [ 269, 271, 273, 275 ], [ 277, 279, 281, 283 ], [ 285, 287, 289, 291 ], [ 293, 295, 297, 299 ], [ 303 ], [ 307, 309, 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387, 389 ], [ 391, 393 ], [ 395, 397 ], [ 399, 401 ], [ 403 ], [ 405, 407, 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 427 ], [ 429, 431, 433 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447, 449, 451, 453, 455 ], [ 459, 461, 463, 465, 467 ], [ 469, 471, 473, 475, 477 ], [ 481, 485, 487, 489, 491, 493, 495 ], [ 499, 501, 503, 505, 507 ], [ 511, 513, 517, 519, 521 ], [ 887 ], [ 891 ], [ 893 ] ]
5,010
static void vfio_unmap_bars(VFIOPCIDevice *vdev) { int i; for (i = 0; i < PCI_ROM_SLOT; i++) { vfio_unmap_bar(vdev, i); } if (vdev->has_vga) { vfio_vga_quirk_teardown(vdev); pci_unregister_vga(&vdev->pdev); } }
false
qemu
ba5e6bfa1aee29a8f72c5538c565dfb9889cf273
static void vfio_unmap_bars(VFIOPCIDevice *vdev) { int i; for (i = 0; i < PCI_ROM_SLOT; i++) { vfio_unmap_bar(vdev, i); } if (vdev->has_vga) { vfio_vga_quirk_teardown(vdev); pci_unregister_vga(&vdev->pdev); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VFIOPCIDevice *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < PCI_ROM_SLOT; VAR_1++) { vfio_unmap_bar(VAR_0, VAR_1); } if (VAR_0->has_vga) { vfio_vga_quirk_teardown(VAR_0); pci_unregister_vga(&VAR_0->pdev); } }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < PCI_ROM_SLOT; VAR_1++) {", "vfio_unmap_bar(VAR_0, VAR_1);", "}", "if (VAR_0->has_vga) {", "vfio_vga_quirk_teardown(VAR_0);", "pci_unregister_vga(&VAR_0->pdev);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
5,011
static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) { PCIDevice *d = (PCIDevice *)dev; const pci_class_desc *desc; char ctxt[64]; PCIIORegion *r; int i, class; class = pci_get_word(d->config + PCI_CLASS_DEVICE); desc = pci_class_descriptions; while (desc->desc && class != desc->class) desc++; if (desc->desc) { snprintf(ctxt, sizeof(ctxt), "%s", desc->desc); } else { snprintf(ctxt, sizeof(ctxt), "Class %04x", class); } monitor_printf(mon, "%*sclass %s, addr %02x:%02x.%x, " "pci id %04x:%04x (sub %04x:%04x)\n", indent, "", ctxt, pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), pci_get_word(d->config + PCI_VENDOR_ID), pci_get_word(d->config + PCI_DEVICE_ID), pci_get_word(d->config + PCI_SUBSYSTEM_VENDOR_ID), pci_get_word(d->config + PCI_SUBSYSTEM_ID)); for (i = 0; i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; if (!r->size) continue; monitor_printf(mon, "%*sbar %d: %s at 0x%"FMT_PCIBUS " [0x%"FMT_PCIBUS"]\n", indent, "", i, r->type & PCI_BASE_ADDRESS_SPACE_IO ? "i/o" : "mem", r->addr, r->addr + r->size - 1); } }
false
qemu
fd56e0612b6454a282fa6a953fdb09281a98c589
static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) { PCIDevice *d = (PCIDevice *)dev; const pci_class_desc *desc; char ctxt[64]; PCIIORegion *r; int i, class; class = pci_get_word(d->config + PCI_CLASS_DEVICE); desc = pci_class_descriptions; while (desc->desc && class != desc->class) desc++; if (desc->desc) { snprintf(ctxt, sizeof(ctxt), "%s", desc->desc); } else { snprintf(ctxt, sizeof(ctxt), "Class %04x", class); } monitor_printf(mon, "%*sclass %s, addr %02x:%02x.%x, " "pci id %04x:%04x (sub %04x:%04x)\n", indent, "", ctxt, pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), pci_get_word(d->config + PCI_VENDOR_ID), pci_get_word(d->config + PCI_DEVICE_ID), pci_get_word(d->config + PCI_SUBSYSTEM_VENDOR_ID), pci_get_word(d->config + PCI_SUBSYSTEM_ID)); for (i = 0; i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; if (!r->size) continue; monitor_printf(mon, "%*sbar %d: %s at 0x%"FMT_PCIBUS " [0x%"FMT_PCIBUS"]\n", indent, "", i, r->type & PCI_BASE_ADDRESS_SPACE_IO ? "i/o" : "mem", r->addr, r->addr + r->size - 1); } }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, DeviceState *VAR_1, int VAR_2) { PCIDevice *d = (PCIDevice *)VAR_1; const pci_class_desc *VAR_3; char VAR_4[64]; PCIIORegion *r; int VAR_5, VAR_6; VAR_6 = pci_get_word(d->config + PCI_CLASS_DEVICE); VAR_3 = pci_class_descriptions; while (VAR_3->VAR_3 && VAR_6 != VAR_3->VAR_6) VAR_3++; if (VAR_3->VAR_3) { snprintf(VAR_4, sizeof(VAR_4), "%s", VAR_3->VAR_3); } else { snprintf(VAR_4, sizeof(VAR_4), "Class %04x", VAR_6); } monitor_printf(VAR_0, "%*sclass %s, addr %02x:%02x.%x, " "pci id %04x:%04x (sub %04x:%04x)\n", VAR_2, "", VAR_4, pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), pci_get_word(d->config + PCI_VENDOR_ID), pci_get_word(d->config + PCI_DEVICE_ID), pci_get_word(d->config + PCI_SUBSYSTEM_VENDOR_ID), pci_get_word(d->config + PCI_SUBSYSTEM_ID)); for (VAR_5 = 0; VAR_5 < PCI_NUM_REGIONS; VAR_5++) { r = &d->io_regions[VAR_5]; if (!r->size) continue; monitor_printf(VAR_0, "%*sbar %d: %s at 0x%"FMT_PCIBUS " [0x%"FMT_PCIBUS"]\n", VAR_2, "", VAR_5, r->type & PCI_BASE_ADDRESS_SPACE_IO ? "VAR_5/o" : "mem", r->addr, r->addr + r->size - 1); } }
[ "static void FUNC_0(Monitor *VAR_0, DeviceState *VAR_1, int VAR_2)\n{", "PCIDevice *d = (PCIDevice *)VAR_1;", "const pci_class_desc *VAR_3;", "char VAR_4[64];", "PCIIORegion *r;", "int VAR_5, VAR_6;", "VAR_6 = pci_get_word(d->config + PCI_CLASS_DEVICE);", "VAR_3 = pci_class_descriptions;", "while (VAR_3->VAR_3 && VAR_6 != VAR_3->VAR_6)\nVAR_3++;", "if (VAR_3->VAR_3) {", "snprintf(VAR_4, sizeof(VAR_4), \"%s\", VAR_3->VAR_3);", "} else {", "snprintf(VAR_4, sizeof(VAR_4), \"Class %04x\", VAR_6);", "}", "monitor_printf(VAR_0, \"%*sclass %s, addr %02x:%02x.%x, \"\n\"pci id %04x:%04x (sub %04x:%04x)\\n\",\nVAR_2, \"\", VAR_4, pci_bus_num(d->bus),\nPCI_SLOT(d->devfn), PCI_FUNC(d->devfn),\npci_get_word(d->config + PCI_VENDOR_ID),\npci_get_word(d->config + PCI_DEVICE_ID),\npci_get_word(d->config + PCI_SUBSYSTEM_VENDOR_ID),\npci_get_word(d->config + PCI_SUBSYSTEM_ID));", "for (VAR_5 = 0; VAR_5 < PCI_NUM_REGIONS; VAR_5++) {", "r = &d->io_regions[VAR_5];", "if (!r->size)\ncontinue;", "monitor_printf(VAR_0, \"%*sbar %d: %s at 0x%\"FMT_PCIBUS\n\" [0x%\"FMT_PCIBUS\"]\\n\",\nVAR_2, \"\",\nVAR_5, r->type & PCI_BASE_ADDRESS_SPACE_IO ? \"VAR_5/o\" : \"mem\",\nr->addr, r->addr + r->size - 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 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41, 43, 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63, 65, 67, 69 ], [ 71 ], [ 73 ] ]
5,012
ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class, const char *typename, const char *file, int line, const char *func) { ObjectClass *ret; trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)", typename, file, line, func); #ifdef CONFIG_QOM_CAST_DEBUG int i; for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) { if (class->cast_cache[i] == typename) { ret = class; goto out; } } #else if (!class->interfaces) { return class; } #endif ret = object_class_dynamic_cast(class, typename); if (!ret && class) { fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n", file, line, func, class, typename); abort(); } #ifdef CONFIG_QOM_CAST_DEBUG if (ret == class) { for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) { class->cast_cache[i - 1] = class->cast_cache[i]; } class->cast_cache[i - 1] = typename; } out: #endif return ret; }
false
qemu
9d6a3d58e4d1431ab3809ff621cfd1f9ec75eef5
ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class, const char *typename, const char *file, int line, const char *func) { ObjectClass *ret; trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)", typename, file, line, func); #ifdef CONFIG_QOM_CAST_DEBUG int i; for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) { if (class->cast_cache[i] == typename) { ret = class; goto out; } } #else if (!class->interfaces) { return class; } #endif ret = object_class_dynamic_cast(class, typename); if (!ret && class) { fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n", file, line, func, class, typename); abort(); } #ifdef CONFIG_QOM_CAST_DEBUG if (ret == class) { for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) { class->cast_cache[i - 1] = class->cast_cache[i]; } class->cast_cache[i - 1] = typename; } out: #endif return ret; }
{ "code": [], "line_no": [] }
ObjectClass *FUNC_0(ObjectClass *class, const char *typename, const char *file, int line, const char *func) { ObjectClass *ret; trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)", typename, file, line, func); #ifdef CONFIG_QOM_CAST_DEBUG int i; for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) { if (class->cast_cache[i] == typename) { ret = class; goto out; } } #else if (!class->interfaces) { return class; } #endif ret = object_class_dynamic_cast(class, typename); if (!ret && class) { fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n", file, line, func, class, typename); abort(); } #ifdef CONFIG_QOM_CAST_DEBUG if (ret == class) { for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) { class->cast_cache[i - 1] = class->cast_cache[i]; } class->cast_cache[i - 1] = typename; } out: #endif return ret; }
[ "ObjectClass *FUNC_0(ObjectClass *class,\nconst char *typename,\nconst char *file, int line,\nconst char *func)\n{", "ObjectClass *ret;", "trace_object_class_dynamic_cast_assert(class ? class->type->name : \"(null)\",\ntypename, file, line, func);", "#ifdef CONFIG_QOM_CAST_DEBUG\nint i;", "for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) {", "if (class->cast_cache[i] == typename) {", "ret = class;", "goto out;", "}", "}", "#else\nif (!class->interfaces) {", "return class;", "}", "#endif\nret = object_class_dynamic_cast(class, typename);", "if (!ret && class) {", "fprintf(stderr, \"%s:%d:%s: Object %p is not an instance of type %s\\n\",\nfile, line, func, class, typename);", "abort();", "}", "#ifdef CONFIG_QOM_CAST_DEBUG\nif (ret == class) {", "for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {", "class->cast_cache[i - 1] = class->cast_cache[i];", "}", "class->cast_cache[i - 1] = typename;", "}", "out:\n#endif\nreturn 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15, 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81, 83 ], [ 85 ] ]
5,013
static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) { #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \ CONFIG_H264_D3D11VA_HWACCEL + \ CONFIG_H264_VAAPI_HWACCEL + \ (CONFIG_H264_VDA_HWACCEL * 2) + \ CONFIG_H264_VIDEOTOOLBOX_HWACCEL + \ CONFIG_H264_VDPAU_HWACCEL) enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; const enum AVPixelFormat *choices = pix_fmts; int i; switch (h->ps.sps->bit_depth_luma) { case 9: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP9; } else *fmt++ = AV_PIX_FMT_YUV444P9; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P9; else *fmt++ = AV_PIX_FMT_YUV420P9; break; case 10: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP10; } else *fmt++ = AV_PIX_FMT_YUV444P10; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P10; else *fmt++ = AV_PIX_FMT_YUV420P10; break; case 12: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP12; } else *fmt++ = AV_PIX_FMT_YUV444P12; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P12; else *fmt++ = AV_PIX_FMT_YUV420P12; break; case 14: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP14; } else *fmt++ = AV_PIX_FMT_YUV444P14; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P14; else *fmt++ = AV_PIX_FMT_YUV420P14; break; case 8: #if CONFIG_H264_VDPAU_HWACCEL *fmt++ = AV_PIX_FMT_VDPAU; #endif if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) *fmt++ = AV_PIX_FMT_GBRP; else if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ444P; else *fmt++ = AV_PIX_FMT_YUV444P; } else if (CHROMA422(h)) { if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ422P; else *fmt++ = AV_PIX_FMT_YUV422P; } else { #if CONFIG_H264_DXVA2_HWACCEL *fmt++ = AV_PIX_FMT_DXVA2_VLD; #endif #if CONFIG_H264_D3D11VA_HWACCEL *fmt++ = AV_PIX_FMT_D3D11VA_VLD; #endif #if CONFIG_H264_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif #if CONFIG_H264_VDA_HWACCEL *fmt++ = AV_PIX_FMT_VDA_VLD; *fmt++ = AV_PIX_FMT_VDA; #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; #endif if (h->avctx->codec->pix_fmts) choices = h->avctx->codec->pix_fmts; else if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ420P; else *fmt++ = AV_PIX_FMT_YUV420P; } break; default: av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n", h->ps.sps->bit_depth_luma); return AVERROR_INVALIDDATA; } *fmt = AV_PIX_FMT_NONE; for (i=0; choices[i] != AV_PIX_FMT_NONE; i++) if (choices[i] == h->avctx->pix_fmt && !force_callback) return choices[i]; return ff_thread_get_format(h->avctx, choices); }
false
FFmpeg
70143a3954e1c4412efb2bf1a3a818adea2d3abf
static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) { #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \ CONFIG_H264_D3D11VA_HWACCEL + \ CONFIG_H264_VAAPI_HWACCEL + \ (CONFIG_H264_VDA_HWACCEL * 2) + \ CONFIG_H264_VIDEOTOOLBOX_HWACCEL + \ CONFIG_H264_VDPAU_HWACCEL) enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; const enum AVPixelFormat *choices = pix_fmts; int i; switch (h->ps.sps->bit_depth_luma) { case 9: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP9; } else *fmt++ = AV_PIX_FMT_YUV444P9; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P9; else *fmt++ = AV_PIX_FMT_YUV420P9; break; case 10: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP10; } else *fmt++ = AV_PIX_FMT_YUV444P10; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P10; else *fmt++ = AV_PIX_FMT_YUV420P10; break; case 12: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP12; } else *fmt++ = AV_PIX_FMT_YUV444P12; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P12; else *fmt++ = AV_PIX_FMT_YUV420P12; break; case 14: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP14; } else *fmt++ = AV_PIX_FMT_YUV444P14; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P14; else *fmt++ = AV_PIX_FMT_YUV420P14; break; case 8: #if CONFIG_H264_VDPAU_HWACCEL *fmt++ = AV_PIX_FMT_VDPAU; #endif if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) *fmt++ = AV_PIX_FMT_GBRP; else if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ444P; else *fmt++ = AV_PIX_FMT_YUV444P; } else if (CHROMA422(h)) { if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ422P; else *fmt++ = AV_PIX_FMT_YUV422P; } else { #if CONFIG_H264_DXVA2_HWACCEL *fmt++ = AV_PIX_FMT_DXVA2_VLD; #endif #if CONFIG_H264_D3D11VA_HWACCEL *fmt++ = AV_PIX_FMT_D3D11VA_VLD; #endif #if CONFIG_H264_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif #if CONFIG_H264_VDA_HWACCEL *fmt++ = AV_PIX_FMT_VDA_VLD; *fmt++ = AV_PIX_FMT_VDA; #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; #endif if (h->avctx->codec->pix_fmts) choices = h->avctx->codec->pix_fmts; else if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ420P; else *fmt++ = AV_PIX_FMT_YUV420P; } break; default: av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n", h->ps.sps->bit_depth_luma); return AVERROR_INVALIDDATA; } *fmt = AV_PIX_FMT_NONE; for (i=0; choices[i] != AV_PIX_FMT_NONE; i++) if (choices[i] == h->avctx->pix_fmt && !force_callback) return choices[i]; return ff_thread_get_format(h->avctx, choices); }
{ "code": [], "line_no": [] }
static enum AVPixelFormat FUNC_0(H264Context *VAR_0, int VAR_1) { #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \ CONFIG_H264_D3D11VA_HWACCEL + \ CONFIG_H264_VAAPI_HWACCEL + \ (CONFIG_H264_VDA_HWACCEL * 2) + \ CONFIG_H264_VIDEOTOOLBOX_HWACCEL + \ CONFIG_H264_VDPAU_HWACCEL) enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; const enum AVPixelFormat *VAR_2 = pix_fmts; int VAR_3; switch (VAR_0->ps.sps->bit_depth_luma) { case 9: if (CHROMA444(VAR_0)) { if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP9; } else *fmt++ = AV_PIX_FMT_YUV444P9; } else if (CHROMA422(VAR_0)) *fmt++ = AV_PIX_FMT_YUV422P9; else *fmt++ = AV_PIX_FMT_YUV420P9; break; case 10: if (CHROMA444(VAR_0)) { if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP10; } else *fmt++ = AV_PIX_FMT_YUV444P10; } else if (CHROMA422(VAR_0)) *fmt++ = AV_PIX_FMT_YUV422P10; else *fmt++ = AV_PIX_FMT_YUV420P10; break; case 12: if (CHROMA444(VAR_0)) { if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP12; } else *fmt++ = AV_PIX_FMT_YUV444P12; } else if (CHROMA422(VAR_0)) *fmt++ = AV_PIX_FMT_YUV422P12; else *fmt++ = AV_PIX_FMT_YUV420P12; break; case 14: if (CHROMA444(VAR_0)) { if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP14; } else *fmt++ = AV_PIX_FMT_YUV444P14; } else if (CHROMA422(VAR_0)) *fmt++ = AV_PIX_FMT_YUV422P14; else *fmt++ = AV_PIX_FMT_YUV420P14; break; case 8: #if CONFIG_H264_VDPAU_HWACCEL *fmt++ = AV_PIX_FMT_VDPAU; #endif if (CHROMA444(VAR_0)) { if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) *fmt++ = AV_PIX_FMT_GBRP; else if (VAR_0->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ444P; else *fmt++ = AV_PIX_FMT_YUV444P; } else if (CHROMA422(VAR_0)) { if (VAR_0->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ422P; else *fmt++ = AV_PIX_FMT_YUV422P; } else { #if CONFIG_H264_DXVA2_HWACCEL *fmt++ = AV_PIX_FMT_DXVA2_VLD; #endif #if CONFIG_H264_D3D11VA_HWACCEL *fmt++ = AV_PIX_FMT_D3D11VA_VLD; #endif #if CONFIG_H264_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif #if CONFIG_H264_VDA_HWACCEL *fmt++ = AV_PIX_FMT_VDA_VLD; *fmt++ = AV_PIX_FMT_VDA; #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; #endif if (VAR_0->avctx->codec->pix_fmts) VAR_2 = VAR_0->avctx->codec->pix_fmts; else if (VAR_0->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ420P; else *fmt++ = AV_PIX_FMT_YUV420P; } break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n", VAR_0->ps.sps->bit_depth_luma); return AVERROR_INVALIDDATA; } *fmt = AV_PIX_FMT_NONE; for (VAR_3=0; VAR_2[VAR_3] != AV_PIX_FMT_NONE; VAR_3++) if (VAR_2[VAR_3] == VAR_0->avctx->pix_fmt && !VAR_1) return VAR_2[VAR_3]; return ff_thread_get_format(VAR_0->avctx, VAR_2); }
[ "static enum AVPixelFormat FUNC_0(H264Context *VAR_0, int VAR_1)\n{", "#define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \\\nCONFIG_H264_D3D11VA_HWACCEL + \\\nCONFIG_H264_VAAPI_HWACCEL + \\\n(CONFIG_H264_VDA_HWACCEL * 2) + \\\nCONFIG_H264_VIDEOTOOLBOX_HWACCEL + \\\nCONFIG_H264_VDPAU_HWACCEL)\nenum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;", "const enum AVPixelFormat *VAR_2 = pix_fmts;", "int VAR_3;", "switch (VAR_0->ps.sps->bit_depth_luma) {", "case 9:\nif (CHROMA444(VAR_0)) {", "if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) {", "*fmt++ = AV_PIX_FMT_GBRP9;", "} else", "*fmt++ = AV_PIX_FMT_YUV444P9;", "} else if (CHROMA422(VAR_0))", "*fmt++ = AV_PIX_FMT_YUV422P9;", "else\n*fmt++ = AV_PIX_FMT_YUV420P9;", "break;", "case 10:\nif (CHROMA444(VAR_0)) {", "if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) {", "*fmt++ = AV_PIX_FMT_GBRP10;", "} else", "*fmt++ = AV_PIX_FMT_YUV444P10;", "} else if (CHROMA422(VAR_0))", "*fmt++ = AV_PIX_FMT_YUV422P10;", "else\n*fmt++ = AV_PIX_FMT_YUV420P10;", "break;", "case 12:\nif (CHROMA444(VAR_0)) {", "if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) {", "*fmt++ = AV_PIX_FMT_GBRP12;", "} else", "*fmt++ = AV_PIX_FMT_YUV444P12;", "} else if (CHROMA422(VAR_0))", "*fmt++ = AV_PIX_FMT_YUV422P12;", "else\n*fmt++ = AV_PIX_FMT_YUV420P12;", "break;", "case 14:\nif (CHROMA444(VAR_0)) {", "if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB) {", "*fmt++ = AV_PIX_FMT_GBRP14;", "} else", "*fmt++ = AV_PIX_FMT_YUV444P14;", "} else if (CHROMA422(VAR_0))", "*fmt++ = AV_PIX_FMT_YUV422P14;", "else\n*fmt++ = AV_PIX_FMT_YUV420P14;", "break;", "case 8:\n#if CONFIG_H264_VDPAU_HWACCEL\n*fmt++ = AV_PIX_FMT_VDPAU;", "#endif\nif (CHROMA444(VAR_0)) {", "if (VAR_0->avctx->colorspace == AVCOL_SPC_RGB)\n*fmt++ = AV_PIX_FMT_GBRP;", "else if (VAR_0->avctx->color_range == AVCOL_RANGE_JPEG)\n*fmt++ = AV_PIX_FMT_YUVJ444P;", "else\n*fmt++ = AV_PIX_FMT_YUV444P;", "} else if (CHROMA422(VAR_0)) {", "if (VAR_0->avctx->color_range == AVCOL_RANGE_JPEG)\n*fmt++ = AV_PIX_FMT_YUVJ422P;", "else\n*fmt++ = AV_PIX_FMT_YUV422P;", "} else {", "#if CONFIG_H264_DXVA2_HWACCEL\n*fmt++ = AV_PIX_FMT_DXVA2_VLD;", "#endif\n#if CONFIG_H264_D3D11VA_HWACCEL\n*fmt++ = AV_PIX_FMT_D3D11VA_VLD;", "#endif\n#if CONFIG_H264_VAAPI_HWACCEL\n*fmt++ = AV_PIX_FMT_VAAPI;", "#endif\n#if CONFIG_H264_VDA_HWACCEL\n*fmt++ = AV_PIX_FMT_VDA_VLD;", "*fmt++ = AV_PIX_FMT_VDA;", "#endif\n#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL\n*fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;", "#endif\nif (VAR_0->avctx->codec->pix_fmts)\nVAR_2 = VAR_0->avctx->codec->pix_fmts;", "else if (VAR_0->avctx->color_range == AVCOL_RANGE_JPEG)\n*fmt++ = AV_PIX_FMT_YUVJ420P;", "else\n*fmt++ = AV_PIX_FMT_YUV420P;", "}", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Unsupported bit depth %d\\n\", VAR_0->ps.sps->bit_depth_luma);", "return AVERROR_INVALIDDATA;", "}", "*fmt = AV_PIX_FMT_NONE;", "for (VAR_3=0; VAR_2[VAR_3] != AV_PIX_FMT_NONE; VAR_3++)", "if (VAR_2[VAR_3] == VAR_0->avctx->pix_fmt && !VAR_1)\nreturn VAR_2[VAR_3];", "return ff_thread_get_format(VAR_0->avctx, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117, 119 ], [ 121, 123 ], [ 125, 127 ], [ 129, 131 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 143, 145 ], [ 147 ], [ 149, 151 ], [ 153, 155, 157 ], [ 159, 161, 163 ], [ 165, 167, 169 ], [ 171 ], [ 173, 175, 177 ], [ 179, 181, 183 ], [ 185, 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197, 199, 201 ], [ 203 ], [ 205 ], [ 209 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ] ]
5,014
void msix_load(PCIDevice *dev, QEMUFile *f) { unsigned n = dev->msix_entries_nr; unsigned int vector; if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) { return; } msix_free_irq_entries(dev); qemu_get_buffer(f, dev->msix_table_page, n * PCI_MSIX_ENTRY_SIZE); qemu_get_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8); msix_update_function_masked(dev); for (vector = 0; vector < n; vector++) { msix_handle_mask_update(dev, vector, true); } }
false
qemu
44701ab71ad854e6be567a6294f4665f36651076
void msix_load(PCIDevice *dev, QEMUFile *f) { unsigned n = dev->msix_entries_nr; unsigned int vector; if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) { return; } msix_free_irq_entries(dev); qemu_get_buffer(f, dev->msix_table_page, n * PCI_MSIX_ENTRY_SIZE); qemu_get_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8); msix_update_function_masked(dev); for (vector = 0; vector < n; vector++) { msix_handle_mask_update(dev, vector, true); } }
{ "code": [], "line_no": [] }
void FUNC_0(PCIDevice *VAR_0, QEMUFile *VAR_1) { unsigned VAR_2 = VAR_0->msix_entries_nr; unsigned int VAR_3; if (!(VAR_0->cap_present & QEMU_PCI_CAP_MSIX)) { return; } msix_free_irq_entries(VAR_0); qemu_get_buffer(VAR_1, VAR_0->msix_table_page, VAR_2 * PCI_MSIX_ENTRY_SIZE); qemu_get_buffer(VAR_1, VAR_0->msix_table_page + MSIX_PAGE_PENDING, (VAR_2 + 7) / 8); msix_update_function_masked(VAR_0); for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { msix_handle_mask_update(VAR_0, VAR_3, true); } }
[ "void FUNC_0(PCIDevice *VAR_0, QEMUFile *VAR_1)\n{", "unsigned VAR_2 = VAR_0->msix_entries_nr;", "unsigned int VAR_3;", "if (!(VAR_0->cap_present & QEMU_PCI_CAP_MSIX)) {", "return;", "}", "msix_free_irq_entries(VAR_0);", "qemu_get_buffer(VAR_1, VAR_0->msix_table_page, VAR_2 * PCI_MSIX_ENTRY_SIZE);", "qemu_get_buffer(VAR_1, VAR_0->msix_table_page + MSIX_PAGE_PENDING, (VAR_2 + 7) / 8);", "msix_update_function_masked(VAR_0);", "for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {", "msix_handle_mask_update(VAR_0, VAR_3, true);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
5,015
static void vga_update_display(void *opaque) { VGACommonState *s = opaque; int full_update, graphic_mode; qemu_flush_coalesced_mmio_buffer(); if (ds_get_bits_per_pixel(s->ds) == 0) { /* nothing to do */ } else { full_update = 0; if (!(s->ar_index & 0x20) && /* extra CGA compatibility hacks (not in standard VGA */ (!(vga_cga_hacks & VGA_CGA_HACK_PALETTE_BLANKING) || (s->ar_index != 0 && s->ar_flip_flop))) { graphic_mode = GMODE_BLANK; } else { graphic_mode = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE; } if (graphic_mode != s->graphic_mode) { s->graphic_mode = graphic_mode; s->cursor_blink_time = qemu_get_clock_ms(vm_clock); full_update = 1; } switch(graphic_mode) { case GMODE_TEXT: vga_draw_text(s, full_update); break; case GMODE_GRAPH: vga_draw_graphic(s, full_update); break; case GMODE_BLANK: default: vga_draw_blank(s, full_update); break; } } }
false
qemu
df8002103c3e262dc40d7b5e0eb2171ba28b1d63
static void vga_update_display(void *opaque) { VGACommonState *s = opaque; int full_update, graphic_mode; qemu_flush_coalesced_mmio_buffer(); if (ds_get_bits_per_pixel(s->ds) == 0) { } else { full_update = 0; if (!(s->ar_index & 0x20) && (!(vga_cga_hacks & VGA_CGA_HACK_PALETTE_BLANKING) || (s->ar_index != 0 && s->ar_flip_flop))) { graphic_mode = GMODE_BLANK; } else { graphic_mode = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE; } if (graphic_mode != s->graphic_mode) { s->graphic_mode = graphic_mode; s->cursor_blink_time = qemu_get_clock_ms(vm_clock); full_update = 1; } switch(graphic_mode) { case GMODE_TEXT: vga_draw_text(s, full_update); break; case GMODE_GRAPH: vga_draw_graphic(s, full_update); break; case GMODE_BLANK: default: vga_draw_blank(s, full_update); break; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { VGACommonState *s = VAR_0; int VAR_1, VAR_2; qemu_flush_coalesced_mmio_buffer(); if (ds_get_bits_per_pixel(s->ds) == 0) { } else { VAR_1 = 0; if (!(s->ar_index & 0x20) && (!(vga_cga_hacks & VGA_CGA_HACK_PALETTE_BLANKING) || (s->ar_index != 0 && s->ar_flip_flop))) { VAR_2 = GMODE_BLANK; } else { VAR_2 = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE; } if (VAR_2 != s->VAR_2) { s->VAR_2 = VAR_2; s->cursor_blink_time = qemu_get_clock_ms(vm_clock); VAR_1 = 1; } switch(VAR_2) { case GMODE_TEXT: vga_draw_text(s, VAR_1); break; case GMODE_GRAPH: vga_draw_graphic(s, VAR_1); break; case GMODE_BLANK: default: vga_draw_blank(s, VAR_1); break; } } }
[ "static void FUNC_0(void *VAR_0)\n{", "VGACommonState *s = VAR_0;", "int VAR_1, VAR_2;", "qemu_flush_coalesced_mmio_buffer();", "if (ds_get_bits_per_pixel(s->ds) == 0) {", "} else {", "VAR_1 = 0;", "if (!(s->ar_index & 0x20) &&\n(!(vga_cga_hacks & VGA_CGA_HACK_PALETTE_BLANKING) ||\n(s->ar_index != 0 && s->ar_flip_flop))) {", "VAR_2 = GMODE_BLANK;", "} else {", "VAR_2 = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE;", "}", "if (VAR_2 != s->VAR_2) {", "s->VAR_2 = VAR_2;", "s->cursor_blink_time = qemu_get_clock_ms(vm_clock);", "VAR_1 = 1;", "}", "switch(VAR_2) {", "case GMODE_TEXT:\nvga_draw_text(s, VAR_1);", "break;", "case GMODE_GRAPH:\nvga_draw_graphic(s, VAR_1);", "break;", "case GMODE_BLANK:\ndefault:\nvga_draw_blank(s, VAR_1);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 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 ] ]
5,016
static bool eckd_valid_address(BootMapPointer *p) { const uint64_t cylinder = p->eckd.cylinder + ((p->eckd.head & 0xfff0) << 12); const uint64_t head = p->eckd.head & 0x000f; if (head >= virtio_get_heads() || p->eckd.sector > virtio_get_sectors() || p->eckd.sector <= 0) { return false; } if (!virtio_guessed_disk_nature() && cylinder >= virtio_get_cylinders()) { return false; } return true; }
false
qemu
f04db28b86654d1c7ff805b40eff27bba6b0f686
static bool eckd_valid_address(BootMapPointer *p) { const uint64_t cylinder = p->eckd.cylinder + ((p->eckd.head & 0xfff0) << 12); const uint64_t head = p->eckd.head & 0x000f; if (head >= virtio_get_heads() || p->eckd.sector > virtio_get_sectors() || p->eckd.sector <= 0) { return false; } if (!virtio_guessed_disk_nature() && cylinder >= virtio_get_cylinders()) { return false; } return true; }
{ "code": [], "line_no": [] }
static bool FUNC_0(BootMapPointer *p) { const uint64_t VAR_0 = p->eckd.VAR_0 + ((p->eckd.VAR_1 & 0xfff0) << 12); const uint64_t VAR_1 = p->eckd.VAR_1 & 0x000f; if (VAR_1 >= virtio_get_heads() || p->eckd.sector > virtio_get_sectors() || p->eckd.sector <= 0) { return false; } if (!virtio_guessed_disk_nature() && VAR_0 >= virtio_get_cylinders()) { return false; } return true; }
[ "static bool FUNC_0(BootMapPointer *p)\n{", "const uint64_t VAR_0 = p->eckd.VAR_0\n+ ((p->eckd.VAR_1 & 0xfff0) << 12);", "const uint64_t VAR_1 = p->eckd.VAR_1 & 0x000f;", "if (VAR_1 >= virtio_get_heads()\n|| p->eckd.sector > virtio_get_sectors()\n|| p->eckd.sector <= 0) {", "return false;", "}", "if (!virtio_guessed_disk_nature() && VAR_0 >= virtio_get_cylinders()) {", "return false;", "}", "return true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
5,017
static void test_bh_delete_from_cb(void) { BHTestData data1 = { .n = 0, .max = 1 }; data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1); qemu_bh_schedule(data1.bh); g_assert_cmpint(data1.n, ==, 0); wait_for_aio(); g_assert_cmpint(data1.n, ==, data1.max); g_assert(data1.bh == NULL); g_assert(!aio_poll(ctx, false)); }
false
qemu
acfb23ad3dd8d0ab385a10e483776ba7dcf927ad
static void test_bh_delete_from_cb(void) { BHTestData data1 = { .n = 0, .max = 1 }; data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1); qemu_bh_schedule(data1.bh); g_assert_cmpint(data1.n, ==, 0); wait_for_aio(); g_assert_cmpint(data1.n, ==, data1.max); g_assert(data1.bh == NULL); g_assert(!aio_poll(ctx, false)); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { BHTestData data1 = { .n = 0, .max = 1 }; data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1); qemu_bh_schedule(data1.bh); g_assert_cmpint(data1.n, ==, 0); wait_for_aio(); g_assert_cmpint(data1.n, ==, data1.max); g_assert(data1.bh == NULL); g_assert(!aio_poll(ctx, false)); }
[ "static void FUNC_0(void)\n{", "BHTestData data1 = { .n = 0, .max = 1 };", "data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);", "qemu_bh_schedule(data1.bh);", "g_assert_cmpint(data1.n, ==, 0);", "wait_for_aio();", "g_assert_cmpint(data1.n, ==, data1.max);", "g_assert(data1.bh == NULL);", "g_assert(!aio_poll(ctx, false));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
5,018
static void v9fs_create(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &name, &perm, &mode, &extension); trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_opendir(pdu, fidp); if (err < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { err = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { err = -EINVAL; goto out; } err = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char ctype; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, "%c %u %u", &ctype, &major, &minor) != 3) { err = -errno; goto out; } switch (ctype) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: err = -EIO; goto out; } nmode |= perm & 0777; err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { err = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { /* * We let the host file system do O_EXCL check * We should not reclaim such fd */ fidp->flags |= FID_NON_RECLAIMABLE; } } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit); err = offset; trace_v9fs_create_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit); out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); }
false
qemu
ddca7f86ac022289840e0200fd4050b2b58e9176
static void v9fs_create(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &name, &perm, &mode, &extension); trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_opendir(pdu, fidp); if (err < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { err = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { err = -EINVAL; goto out; } err = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char ctype; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, "%c %u %u", &ctype, &major, &minor) != 3) { err = -errno; goto out; } switch (ctype) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: err = -EIO; goto out; } nmode |= perm & 0777; err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { err = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { fidp->flags |= FID_NON_RECLAIMABLE; } } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit); err = offset; trace_v9fs_create_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit); out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { int32_t fid; int VAR_1 = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat VAR_2; V9fsString name; V9fsString extension; int VAR_3; V9fsPDU *pdu = VAR_0; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &name, &perm, &mode, &extension); trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); fidp = get_fid(pdu, fid); if (fidp == NULL) { VAR_1 = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { VAR_1 = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); VAR_1 = v9fs_co_opendir(pdu, fidp); if (VAR_1 < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { VAR_1 = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { VAR_1 = -EINVAL; goto out; } VAR_1 = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); VAR_1 = v9fs_co_lstat(pdu, &fidp->path, &VAR_2); if (VAR_1 < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char VAR_4; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, "%c %u %u", &VAR_4, &major, &minor) != 3) { VAR_1 = -errno; goto out; } switch (VAR_4) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: VAR_1 = -EIO; goto out; } nmode |= perm & 0777; VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { VAR_1 = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &VAR_2); if (VAR_1 < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { fidp->flags |= FID_NON_RECLAIMABLE; } } VAR_3 = get_iounit(pdu, &fidp->path); stat_to_qid(&VAR_2, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, VAR_3); VAR_1 = offset; trace_v9fs_create_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, VAR_3); out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, VAR_1); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); }
[ "static void FUNC_0(void *VAR_0)\n{", "int32_t fid;", "int VAR_1 = 0;", "size_t offset = 7;", "V9fsFidState *fidp;", "V9fsQID qid;", "int32_t perm;", "int8_t mode;", "V9fsPath path;", "struct stat VAR_2;", "V9fsString name;", "V9fsString extension;", "int VAR_3;", "V9fsPDU *pdu = VAR_0;", "v9fs_path_init(&path);", "pdu_unmarshal(pdu, offset, \"dsdbs\", &fid, &name,\n&perm, &mode, &extension);", "trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode);", "fidp = get_fid(pdu, fid);", "if (fidp == NULL) {", "VAR_1 = -EINVAL;", "goto out_nofid;", "}", "if (perm & P9_STAT_MODE_DIR) {", "VAR_1 = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777,\nfidp->uid, -1, &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "VAR_1 = v9fs_co_opendir(pdu, fidp);", "if (VAR_1 < 0) {", "goto out;", "}", "fidp->fid_type = P9_FID_DIR;", "} else if (perm & P9_STAT_MODE_SYMLINK) {", "VAR_1 = v9fs_co_symlink(pdu, fidp, &name,\nextension.data, -1 , &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else if (perm & P9_STAT_MODE_LINK) {", "int32_t ofid = atoi(extension.data);", "V9fsFidState *ofidp = get_fid(pdu, ofid);", "if (ofidp == NULL) {", "VAR_1 = -EINVAL;", "goto out;", "}", "VAR_1 = v9fs_co_link(pdu, ofidp, fidp, &name);", "put_fid(pdu, ofidp);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "fidp->fid_type = P9_FID_NONE;", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "VAR_1 = v9fs_co_lstat(pdu, &fidp->path, &VAR_2);", "if (VAR_1 < 0) {", "fidp->fid_type = P9_FID_NONE;", "goto out;", "}", "} else if (perm & P9_STAT_MODE_DEVICE) {", "char VAR_4;", "uint32_t major, minor;", "mode_t nmode = 0;", "if (sscanf(extension.data, \"%c %u %u\", &VAR_4, &major, &minor) != 3) {", "VAR_1 = -errno;", "goto out;", "}", "switch (VAR_4) {", "case 'c':\nnmode = S_IFCHR;", "break;", "case 'b':\nnmode = S_IFBLK;", "break;", "default:\nVAR_1 = -EIO;", "goto out;", "}", "nmode |= perm & 0777;", "VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1,\nmakedev(major, minor), nmode, &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else if (perm & P9_STAT_MODE_NAMED_PIPE) {", "VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1,\n0, S_IFIFO | (perm & 0777), &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else if (perm & P9_STAT_MODE_SOCKET) {", "VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1,\n0, S_IFSOCK | (perm & 0777), &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else {", "VAR_1 = v9fs_co_open2(pdu, fidp, &name, -1,\nomode_to_uflags(mode)|O_CREAT, perm, &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "fidp->fid_type = P9_FID_FILE;", "fidp->open_flags = omode_to_uflags(mode);", "if (fidp->open_flags & O_EXCL) {", "fidp->flags |= FID_NON_RECLAIMABLE;", "}", "}", "VAR_3 = get_iounit(pdu, &fidp->path);", "stat_to_qid(&VAR_2, &qid);", "offset += pdu_marshal(pdu, offset, \"Qd\", &qid, VAR_3);", "VAR_1 = offset;", "trace_v9fs_create_return(pdu->tag, pdu->id,\nqid.type, qid.version, qid.path, VAR_3);", "out:\nput_fid(pdu, fidp);", "out_nofid:\ncomplete_pdu(pdu->s, pdu, VAR_1);", "v9fs_string_free(&name);", "v9fs_string_free(&extension);", "v9fs_path_free(&path);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311, 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ] ]
5,019
static void dma_bdrv_cb(void *opaque, int ret) { DMAAIOCB *dbs = (DMAAIOCB *)opaque; dma_addr_t cur_addr, cur_len; void *mem; trace_dma_bdrv_cb(dbs, ret); dbs->acb = NULL; dbs->sector_num += dbs->iov.size / 512; if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) { dma_complete(dbs, ret); return; } dma_bdrv_unmap(dbs); while (dbs->sg_cur_index < dbs->sg->nsg) { cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte; cur_len = dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte; mem = dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir); if (!mem) break; qemu_iovec_add(&dbs->iov, mem, cur_len); dbs->sg_cur_byte += cur_len; if (dbs->sg_cur_byte == dbs->sg->sg[dbs->sg_cur_index].len) { dbs->sg_cur_byte = 0; ++dbs->sg_cur_index; } } if (dbs->iov.size == 0) { trace_dma_map_wait(dbs); cpu_register_map_client(dbs, continue_after_map_failure); return; } if (dbs->iov.size & ~BDRV_SECTOR_MASK) { qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK); } dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov, dbs->iov.size / 512, dma_bdrv_cb, dbs); assert(dbs->acb); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void dma_bdrv_cb(void *opaque, int ret) { DMAAIOCB *dbs = (DMAAIOCB *)opaque; dma_addr_t cur_addr, cur_len; void *mem; trace_dma_bdrv_cb(dbs, ret); dbs->acb = NULL; dbs->sector_num += dbs->iov.size / 512; if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) { dma_complete(dbs, ret); return; } dma_bdrv_unmap(dbs); while (dbs->sg_cur_index < dbs->sg->nsg) { cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte; cur_len = dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte; mem = dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir); if (!mem) break; qemu_iovec_add(&dbs->iov, mem, cur_len); dbs->sg_cur_byte += cur_len; if (dbs->sg_cur_byte == dbs->sg->sg[dbs->sg_cur_index].len) { dbs->sg_cur_byte = 0; ++dbs->sg_cur_index; } } if (dbs->iov.size == 0) { trace_dma_map_wait(dbs); cpu_register_map_client(dbs, continue_after_map_failure); return; } if (dbs->iov.size & ~BDRV_SECTOR_MASK) { qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK); } dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov, dbs->iov.size / 512, dma_bdrv_cb, dbs); assert(dbs->acb); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { DMAAIOCB *dbs = (DMAAIOCB *)VAR_0; dma_addr_t cur_addr, cur_len; void *VAR_2; trace_dma_bdrv_cb(dbs, VAR_1); dbs->acb = NULL; dbs->sector_num += dbs->iov.size / 512; if (dbs->sg_cur_index == dbs->sg->nsg || VAR_1 < 0) { dma_complete(dbs, VAR_1); return; } dma_bdrv_unmap(dbs); while (dbs->sg_cur_index < dbs->sg->nsg) { cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte; cur_len = dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte; VAR_2 = dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir); if (!VAR_2) break; qemu_iovec_add(&dbs->iov, VAR_2, cur_len); dbs->sg_cur_byte += cur_len; if (dbs->sg_cur_byte == dbs->sg->sg[dbs->sg_cur_index].len) { dbs->sg_cur_byte = 0; ++dbs->sg_cur_index; } } if (dbs->iov.size == 0) { trace_dma_map_wait(dbs); cpu_register_map_client(dbs, continue_after_map_failure); return; } if (dbs->iov.size & ~BDRV_SECTOR_MASK) { qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK); } dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov, dbs->iov.size / 512, FUNC_0, dbs); assert(dbs->acb); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "DMAAIOCB *dbs = (DMAAIOCB *)VAR_0;", "dma_addr_t cur_addr, cur_len;", "void *VAR_2;", "trace_dma_bdrv_cb(dbs, VAR_1);", "dbs->acb = NULL;", "dbs->sector_num += dbs->iov.size / 512;", "if (dbs->sg_cur_index == dbs->sg->nsg || VAR_1 < 0) {", "dma_complete(dbs, VAR_1);", "return;", "}", "dma_bdrv_unmap(dbs);", "while (dbs->sg_cur_index < dbs->sg->nsg) {", "cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;", "cur_len = dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte;", "VAR_2 = dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir);", "if (!VAR_2)\nbreak;", "qemu_iovec_add(&dbs->iov, VAR_2, cur_len);", "dbs->sg_cur_byte += cur_len;", "if (dbs->sg_cur_byte == dbs->sg->sg[dbs->sg_cur_index].len) {", "dbs->sg_cur_byte = 0;", "++dbs->sg_cur_index;", "}", "}", "if (dbs->iov.size == 0) {", "trace_dma_map_wait(dbs);", "cpu_register_map_client(dbs, continue_after_map_failure);", "return;", "}", "if (dbs->iov.size & ~BDRV_SECTOR_MASK) {", "qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK);", "}", "dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov,\ndbs->iov.size / 512, FUNC_0, dbs);", "assert(dbs->acb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89 ] ]
5,021
static void vtd_root_table_setup(IntelIOMMUState *s) { s->root = vtd_get_quad_raw(s, DMAR_RTADDR_REG); s->root_extended = s->root & VTD_RTADDR_RTT; s->root &= VTD_RTADDR_ADDR_MASK(VTD_HOST_ADDRESS_WIDTH); trace_vtd_reg_dmar_root(s->root, s->root_extended); }
false
qemu
37f51384ae05bd50f83308339dbffa3e78404874
static void vtd_root_table_setup(IntelIOMMUState *s) { s->root = vtd_get_quad_raw(s, DMAR_RTADDR_REG); s->root_extended = s->root & VTD_RTADDR_RTT; s->root &= VTD_RTADDR_ADDR_MASK(VTD_HOST_ADDRESS_WIDTH); trace_vtd_reg_dmar_root(s->root, s->root_extended); }
{ "code": [], "line_no": [] }
static void FUNC_0(IntelIOMMUState *VAR_0) { VAR_0->root = vtd_get_quad_raw(VAR_0, DMAR_RTADDR_REG); VAR_0->root_extended = VAR_0->root & VTD_RTADDR_RTT; VAR_0->root &= VTD_RTADDR_ADDR_MASK(VTD_HOST_ADDRESS_WIDTH); trace_vtd_reg_dmar_root(VAR_0->root, VAR_0->root_extended); }
[ "static void FUNC_0(IntelIOMMUState *VAR_0)\n{", "VAR_0->root = vtd_get_quad_raw(VAR_0, DMAR_RTADDR_REG);", "VAR_0->root_extended = VAR_0->root & VTD_RTADDR_RTT;", "VAR_0->root &= VTD_RTADDR_ADDR_MASK(VTD_HOST_ADDRESS_WIDTH);", "trace_vtd_reg_dmar_root(VAR_0->root, VAR_0->root_extended);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
5,022
CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, void (*init)(struct CharDriverState *s), Error **errp) { Error *local_err = NULL; CharDriver *cd; CharDriverState *chr; GSList *i; ChardevReturn *ret = NULL; ChardevBackend *backend; const char *id = qemu_opts_id(opts); char *bid = NULL; if (id == NULL) { error_setg(errp, "chardev: no id specified"); goto err; } if (qemu_opt_get(opts, "backend") == NULL) { error_setg(errp, "chardev: \"%s\" missing backend", qemu_opts_id(opts)); goto err; } for (i = backends; i; i = i->next) { cd = i->data; if (strcmp(cd->name, qemu_opt_get(opts, "backend")) == 0) { break; } } if (i == NULL) { error_setg(errp, "chardev: backend \"%s\" not found", qemu_opt_get(opts, "backend")); goto err; } backend = g_new0(ChardevBackend, 1); if (qemu_opt_get_bool(opts, "mux", 0)) { bid = g_strdup_printf("%s-base", id); } chr = NULL; backend->kind = cd->kind; if (cd->parse) { cd->parse(opts, backend, &local_err); if (local_err) { error_propagate(errp, local_err); goto qapi_out; } } ret = qmp_chardev_add(bid ? bid : id, backend, errp); if (!ret) { goto qapi_out; } if (bid) { qapi_free_ChardevBackend(backend); qapi_free_ChardevReturn(ret); backend = g_new0(ChardevBackend, 1); backend->mux = g_new0(ChardevMux, 1); backend->kind = CHARDEV_BACKEND_KIND_MUX; backend->mux->chardev = g_strdup(bid); ret = qmp_chardev_add(id, backend, errp); if (!ret) { chr = qemu_chr_find(bid); qemu_chr_delete(chr); chr = NULL; goto qapi_out; } } chr = qemu_chr_find(id); chr->opts = opts; qapi_out: qapi_free_ChardevBackend(backend); qapi_free_ChardevReturn(ret); g_free(bid); return chr; err: qemu_opts_del(opts); return NULL; }
false
qemu
130257dc443574a9da91dc293665be2cfc40245a
CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, void (*init)(struct CharDriverState *s), Error **errp) { Error *local_err = NULL; CharDriver *cd; CharDriverState *chr; GSList *i; ChardevReturn *ret = NULL; ChardevBackend *backend; const char *id = qemu_opts_id(opts); char *bid = NULL; if (id == NULL) { error_setg(errp, "chardev: no id specified"); goto err; } if (qemu_opt_get(opts, "backend") == NULL) { error_setg(errp, "chardev: \"%s\" missing backend", qemu_opts_id(opts)); goto err; } for (i = backends; i; i = i->next) { cd = i->data; if (strcmp(cd->name, qemu_opt_get(opts, "backend")) == 0) { break; } } if (i == NULL) { error_setg(errp, "chardev: backend \"%s\" not found", qemu_opt_get(opts, "backend")); goto err; } backend = g_new0(ChardevBackend, 1); if (qemu_opt_get_bool(opts, "mux", 0)) { bid = g_strdup_printf("%s-base", id); } chr = NULL; backend->kind = cd->kind; if (cd->parse) { cd->parse(opts, backend, &local_err); if (local_err) { error_propagate(errp, local_err); goto qapi_out; } } ret = qmp_chardev_add(bid ? bid : id, backend, errp); if (!ret) { goto qapi_out; } if (bid) { qapi_free_ChardevBackend(backend); qapi_free_ChardevReturn(ret); backend = g_new0(ChardevBackend, 1); backend->mux = g_new0(ChardevMux, 1); backend->kind = CHARDEV_BACKEND_KIND_MUX; backend->mux->chardev = g_strdup(bid); ret = qmp_chardev_add(id, backend, errp); if (!ret) { chr = qemu_chr_find(bid); qemu_chr_delete(chr); chr = NULL; goto qapi_out; } } chr = qemu_chr_find(id); chr->opts = opts; qapi_out: qapi_free_ChardevBackend(backend); qapi_free_ChardevReturn(ret); g_free(bid); return chr; err: qemu_opts_del(opts); return NULL; }
{ "code": [], "line_no": [] }
CharDriverState *FUNC_0(QemuOpts *opts, void (*init)(struct CharDriverState *s), Error **errp) { Error *local_err = NULL; CharDriver *cd; CharDriverState *chr; GSList *i; ChardevReturn *ret = NULL; ChardevBackend *backend; const char *VAR_0 = qemu_opts_id(opts); char *VAR_1 = NULL; if (VAR_0 == NULL) { error_setg(errp, "chardev: no VAR_0 specified"); goto err; } if (qemu_opt_get(opts, "backend") == NULL) { error_setg(errp, "chardev: \"%s\" missing backend", qemu_opts_id(opts)); goto err; } for (i = backends; i; i = i->next) { cd = i->data; if (strcmp(cd->name, qemu_opt_get(opts, "backend")) == 0) { break; } } if (i == NULL) { error_setg(errp, "chardev: backend \"%s\" not found", qemu_opt_get(opts, "backend")); goto err; } backend = g_new0(ChardevBackend, 1); if (qemu_opt_get_bool(opts, "mux", 0)) { VAR_1 = g_strdup_printf("%s-base", VAR_0); } chr = NULL; backend->kind = cd->kind; if (cd->parse) { cd->parse(opts, backend, &local_err); if (local_err) { error_propagate(errp, local_err); goto qapi_out; } } ret = qmp_chardev_add(VAR_1 ? VAR_1 : VAR_0, backend, errp); if (!ret) { goto qapi_out; } if (VAR_1) { qapi_free_ChardevBackend(backend); qapi_free_ChardevReturn(ret); backend = g_new0(ChardevBackend, 1); backend->mux = g_new0(ChardevMux, 1); backend->kind = CHARDEV_BACKEND_KIND_MUX; backend->mux->chardev = g_strdup(VAR_1); ret = qmp_chardev_add(VAR_0, backend, errp); if (!ret) { chr = qemu_chr_find(VAR_1); qemu_chr_delete(chr); chr = NULL; goto qapi_out; } } chr = qemu_chr_find(VAR_0); chr->opts = opts; qapi_out: qapi_free_ChardevBackend(backend); qapi_free_ChardevReturn(ret); g_free(VAR_1); return chr; err: qemu_opts_del(opts); return NULL; }
[ "CharDriverState *FUNC_0(QemuOpts *opts,\nvoid (*init)(struct CharDriverState *s),\nError **errp)\n{", "Error *local_err = NULL;", "CharDriver *cd;", "CharDriverState *chr;", "GSList *i;", "ChardevReturn *ret = NULL;", "ChardevBackend *backend;", "const char *VAR_0 = qemu_opts_id(opts);", "char *VAR_1 = NULL;", "if (VAR_0 == NULL) {", "error_setg(errp, \"chardev: no VAR_0 specified\");", "goto err;", "}", "if (qemu_opt_get(opts, \"backend\") == NULL) {", "error_setg(errp, \"chardev: \\\"%s\\\" missing backend\",\nqemu_opts_id(opts));", "goto err;", "}", "for (i = backends; i; i = i->next) {", "cd = i->data;", "if (strcmp(cd->name, qemu_opt_get(opts, \"backend\")) == 0) {", "break;", "}", "}", "if (i == NULL) {", "error_setg(errp, \"chardev: backend \\\"%s\\\" not found\",\nqemu_opt_get(opts, \"backend\"));", "goto err;", "}", "backend = g_new0(ChardevBackend, 1);", "if (qemu_opt_get_bool(opts, \"mux\", 0)) {", "VAR_1 = g_strdup_printf(\"%s-base\", VAR_0);", "}", "chr = NULL;", "backend->kind = cd->kind;", "if (cd->parse) {", "cd->parse(opts, backend, &local_err);", "if (local_err) {", "error_propagate(errp, local_err);", "goto qapi_out;", "}", "}", "ret = qmp_chardev_add(VAR_1 ? VAR_1 : VAR_0, backend, errp);", "if (!ret) {", "goto qapi_out;", "}", "if (VAR_1) {", "qapi_free_ChardevBackend(backend);", "qapi_free_ChardevReturn(ret);", "backend = g_new0(ChardevBackend, 1);", "backend->mux = g_new0(ChardevMux, 1);", "backend->kind = CHARDEV_BACKEND_KIND_MUX;", "backend->mux->chardev = g_strdup(VAR_1);", "ret = qmp_chardev_add(VAR_0, backend, errp);", "if (!ret) {", "chr = qemu_chr_find(VAR_1);", "qemu_chr_delete(chr);", "chr = NULL;", "goto qapi_out;", "}", "}", "chr = qemu_chr_find(VAR_0);", "chr->opts = opts;", "qapi_out:\nqapi_free_ChardevBackend(backend);", "qapi_free_ChardevReturn(ret);", "g_free(VAR_1);", "return chr;", "err:\nqemu_opts_del(opts);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163, 165 ], [ 167 ], [ 169 ] ]
5,023
void hmp_cont(Monitor *mon, const QDict *qdict) { Error *errp = NULL; qmp_cont(&errp); if (error_is_set(&errp)) { if (error_is_type(errp, QERR_DEVICE_ENCRYPTED)) { const char *device; /* The device is encrypted. Ask the user for the password and retry */ device = error_get_field(errp, "device"); assert(device != NULL); monitor_read_block_device_key(mon, device, hmp_cont_cb, mon); error_free(errp); return; } hmp_handle_error(mon, &errp); } }
false
qemu
8b7f6fbbdc5545f749864fdf295f2fae14c7ef0a
void hmp_cont(Monitor *mon, const QDict *qdict) { Error *errp = NULL; qmp_cont(&errp); if (error_is_set(&errp)) { if (error_is_type(errp, QERR_DEVICE_ENCRYPTED)) { const char *device; device = error_get_field(errp, "device"); assert(device != NULL); monitor_read_block_device_key(mon, device, hmp_cont_cb, mon); error_free(errp); return; } hmp_handle_error(mon, &errp); } }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { Error *errp = NULL; qmp_cont(&errp); if (error_is_set(&errp)) { if (error_is_type(errp, QERR_DEVICE_ENCRYPTED)) { const char *VAR_2; VAR_2 = error_get_field(errp, "VAR_2"); assert(VAR_2 != NULL); monitor_read_block_device_key(VAR_0, VAR_2, hmp_cont_cb, VAR_0); error_free(errp); return; } hmp_handle_error(VAR_0, &errp); } }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "Error *errp = NULL;", "qmp_cont(&errp);", "if (error_is_set(&errp)) {", "if (error_is_type(errp, QERR_DEVICE_ENCRYPTED)) {", "const char *VAR_2;", "VAR_2 = error_get_field(errp, \"VAR_2\");", "assert(VAR_2 != NULL);", "monitor_read_block_device_key(VAR_0, VAR_2, hmp_cont_cb, VAR_0);", "error_free(errp);", "return;", "}", "hmp_handle_error(VAR_0, &errp);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
5,024
static int smka_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { SmackerAudioContext *s = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; HuffContext h[4] = { { 0 } }; VLC vlc[4] = { { 0 } }; int16_t *samples; uint8_t *samples8; int val; int i, res, ret; int unp_size; int bits, stereo; int pred[2] = {0, 0}; if (buf_size <= 4) { av_log(avctx, AV_LOG_ERROR, "packet is too small\n"); return AVERROR(EINVAL); } unp_size = AV_RL32(buf); if (unp_size > (1U<<24)) { av_log(avctx, AV_LOG_ERROR, "packet is too big\n"); return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); if(!get_bits1(&gb)){ av_log(avctx, AV_LOG_INFO, "Sound: no data\n"); *got_frame_ptr = 0; return 1; } stereo = get_bits1(&gb); bits = get_bits1(&gb); if (stereo ^ (avctx->channels != 1)) { av_log(avctx, AV_LOG_ERROR, "channels mismatch\n"); return AVERROR(EINVAL); } if (bits && avctx->sample_fmt == AV_SAMPLE_FMT_U8) { av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n"); return AVERROR(EINVAL); } /* get output buffer */ s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1)); if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (int16_t *)s->frame.data[0]; samples8 = s->frame.data[0]; // Initialize for(i = 0; i < (1 << (bits + stereo)); i++) { h[i].length = 256; h[i].maxlength = 0; h[i].current = 0; h[i].bits = av_mallocz(256 * 4); h[i].lengths = av_mallocz(256 * sizeof(int)); h[i].values = av_mallocz(256 * sizeof(int)); skip_bits1(&gb); smacker_decode_tree(&gb, &h[i], 0, 0); skip_bits1(&gb); if(h[i].current > 1) { res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length, h[i].lengths, sizeof(int), sizeof(int), h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(res < 0) { av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); return AVERROR_INVALIDDATA; } } } if(bits) { //decode 16-bit data for(i = stereo; i >= 0; i--) pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16); for(i = 0; i <= stereo; i++) *samples++ = pred[i]; for(; i < unp_size / 2; i++) { if(get_bits_left(&gb)<0) return AVERROR_INVALIDDATA; if(i & stereo) { if(vlc[2].table) res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val = h[2].values[res]; if(vlc[3].table) res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val |= h[3].values[res] << 8; pred[1] += sign_extend(val, 16); *samples++ = av_clip_int16(pred[1]); } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val = h[0].values[res]; if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val |= h[1].values[res] << 8; pred[0] += sign_extend(val, 16); *samples++ = av_clip_int16(pred[0]); } } } else { //8-bit data for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); for(i = 0; i <= stereo; i++) *samples8++ = pred[i]; for(; i < unp_size; i++) { if(get_bits_left(&gb)<0) return AVERROR_INVALIDDATA; if(i & stereo){ if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } pred[1] += sign_extend(h[1].values[res], 8); *samples8++ = av_clip_uint8(pred[1]); } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } pred[0] += sign_extend(h[0].values[res], 8); *samples8++ = av_clip_uint8(pred[0]); } } } for(i = 0; i < 4; i++) { if(vlc[i].table) ff_free_vlc(&vlc[i]); av_free(h[i].bits); av_free(h[i].lengths); av_free(h[i].values); } *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return buf_size; }
false
FFmpeg
50cbe09d8ced75422571d29bbec1f35a33a0d3ed
static int smka_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { SmackerAudioContext *s = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; HuffContext h[4] = { { 0 } }; VLC vlc[4] = { { 0 } }; int16_t *samples; uint8_t *samples8; int val; int i, res, ret; int unp_size; int bits, stereo; int pred[2] = {0, 0}; if (buf_size <= 4) { av_log(avctx, AV_LOG_ERROR, "packet is too small\n"); return AVERROR(EINVAL); } unp_size = AV_RL32(buf); if (unp_size > (1U<<24)) { av_log(avctx, AV_LOG_ERROR, "packet is too big\n"); return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); if(!get_bits1(&gb)){ av_log(avctx, AV_LOG_INFO, "Sound: no data\n"); *got_frame_ptr = 0; return 1; } stereo = get_bits1(&gb); bits = get_bits1(&gb); if (stereo ^ (avctx->channels != 1)) { av_log(avctx, AV_LOG_ERROR, "channels mismatch\n"); return AVERROR(EINVAL); } if (bits && avctx->sample_fmt == AV_SAMPLE_FMT_U8) { av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n"); return AVERROR(EINVAL); } s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1)); if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (int16_t *)s->frame.data[0]; samples8 = s->frame.data[0]; for(i = 0; i < (1 << (bits + stereo)); i++) { h[i].length = 256; h[i].maxlength = 0; h[i].current = 0; h[i].bits = av_mallocz(256 * 4); h[i].lengths = av_mallocz(256 * sizeof(int)); h[i].values = av_mallocz(256 * sizeof(int)); skip_bits1(&gb); smacker_decode_tree(&gb, &h[i], 0, 0); skip_bits1(&gb); if(h[i].current > 1) { res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length, h[i].lengths, sizeof(int), sizeof(int), h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(res < 0) { av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); return AVERROR_INVALIDDATA; } } } if(bits) { for(i = stereo; i >= 0; i--) pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16); for(i = 0; i <= stereo; i++) *samples++ = pred[i]; for(; i < unp_size / 2; i++) { if(get_bits_left(&gb)<0) return AVERROR_INVALIDDATA; if(i & stereo) { if(vlc[2].table) res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val = h[2].values[res]; if(vlc[3].table) res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val |= h[3].values[res] << 8; pred[1] += sign_extend(val, 16); *samples++ = av_clip_int16(pred[1]); } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val = h[0].values[res]; if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } val |= h[1].values[res] << 8; pred[0] += sign_extend(val, 16); *samples++ = av_clip_int16(pred[0]); } } } else { for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); for(i = 0; i <= stereo; i++) *samples8++ = pred[i]; for(; i < unp_size; i++) { if(get_bits_left(&gb)<0) return AVERROR_INVALIDDATA; if(i & stereo){ if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } pred[1] += sign_extend(h[1].values[res], 8); *samples8++ = av_clip_uint8(pred[1]); } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; if (res < 0) { av_log(avctx, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } pred[0] += sign_extend(h[0].values[res], 8); *samples8++ = av_clip_uint8(pred[0]); } } } for(i = 0; i < 4; i++) { if(vlc[i].table) ff_free_vlc(&vlc[i]); av_free(h[i].bits); av_free(h[i].lengths); av_free(h[i].values); } *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { SmackerAudioContext *s = VAR_0->priv_data; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; GetBitContext gb; HuffContext h[4] = { { 0 } }; VLC vlc[4] = { { 0 } }; int16_t *samples; uint8_t *samples8; int VAR_6; int VAR_7, VAR_8, VAR_9; int VAR_10; int VAR_11, VAR_12; int VAR_13[2] = {0, 0}; if (VAR_5 <= 4) { av_log(VAR_0, AV_LOG_ERROR, "packet is too small\n"); return AVERROR(EINVAL); } VAR_10 = AV_RL32(VAR_4); if (VAR_10 > (1U<<24)) { av_log(VAR_0, AV_LOG_ERROR, "packet is too big\n"); return AVERROR_INVALIDDATA; } init_get_bits(&gb, VAR_4 + 4, (VAR_5 - 4) * 8); if(!get_bits1(&gb)){ av_log(VAR_0, AV_LOG_INFO, "Sound: no VAR_1\n"); *VAR_2 = 0; return 1; } VAR_12 = get_bits1(&gb); VAR_11 = get_bits1(&gb); if (VAR_12 ^ (VAR_0->channels != 1)) { av_log(VAR_0, AV_LOG_ERROR, "channels mismatch\n"); return AVERROR(EINVAL); } if (VAR_11 && VAR_0->sample_fmt == AV_SAMPLE_FMT_U8) { av_log(VAR_0, AV_LOG_ERROR, "sample format mismatch\n"); return AVERROR(EINVAL); } s->frame.nb_samples = VAR_10 / (VAR_0->channels * (VAR_11 + 1)); if ((VAR_9 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_9; } samples = (int16_t *)s->frame.VAR_1[0]; samples8 = s->frame.VAR_1[0]; for(VAR_7 = 0; VAR_7 < (1 << (VAR_11 + VAR_12)); VAR_7++) { h[VAR_7].length = 256; h[VAR_7].maxlength = 0; h[VAR_7].current = 0; h[VAR_7].VAR_11 = av_mallocz(256 * 4); h[VAR_7].lengths = av_mallocz(256 * sizeof(int)); h[VAR_7].values = av_mallocz(256 * sizeof(int)); skip_bits1(&gb); smacker_decode_tree(&gb, &h[VAR_7], 0, 0); skip_bits1(&gb); if(h[VAR_7].current > 1) { VAR_8 = init_vlc(&vlc[VAR_7], SMKTREE_BITS, h[VAR_7].length, h[VAR_7].lengths, sizeof(int), sizeof(int), h[VAR_7].VAR_11, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Cannot build VLC table\n"); return AVERROR_INVALIDDATA; } } } if(VAR_11) { for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--) VAR_13[VAR_7] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16); for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++) *samples++ = VAR_13[VAR_7]; for(; VAR_7 < VAR_10 / 2; VAR_7++) { if(get_bits_left(&gb)<0) return AVERROR_INVALIDDATA; if(VAR_7 & VAR_12) { if(vlc[2].table) VAR_8 = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); else VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6 = h[2].values[VAR_8]; if(vlc[3].table) VAR_8 = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3); else VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6 |= h[3].values[VAR_8] << 8; VAR_13[1] += sign_extend(VAR_6, 16); *samples++ = av_clip_int16(VAR_13[1]); } else { if(vlc[0].table) VAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6 = h[0].values[VAR_8]; if(vlc[1].table) VAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6 |= h[1].values[VAR_8] << 8; VAR_13[0] += sign_extend(VAR_6, 16); *samples++ = av_clip_int16(VAR_13[0]); } } } else { for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--) VAR_13[VAR_7] = get_bits(&gb, 8); for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++) *samples8++ = VAR_13[VAR_7]; for(; VAR_7 < VAR_10; VAR_7++) { if(get_bits_left(&gb)<0) return AVERROR_INVALIDDATA; if(VAR_7 & VAR_12){ if(vlc[1].table) VAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_13[1] += sign_extend(h[1].values[VAR_8], 8); *samples8++ = av_clip_uint8(VAR_13[1]); } else { if(vlc[0].table) VAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_13[0] += sign_extend(h[0].values[VAR_8], 8); *samples8++ = av_clip_uint8(VAR_13[0]); } } } for(VAR_7 = 0; VAR_7 < 4; VAR_7++) { if(vlc[VAR_7].table) ff_free_vlc(&vlc[VAR_7]); av_free(h[VAR_7].VAR_11); av_free(h[VAR_7].lengths); av_free(h[VAR_7].values); } *VAR_2 = 1; *(AVFrame *)VAR_1 = s->frame; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "SmackerAudioContext *s = VAR_0->priv_data;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "GetBitContext gb;", "HuffContext h[4] = { { 0 } };", "VLC vlc[4] = { { 0 } };", "int16_t *samples;", "uint8_t *samples8;", "int VAR_6;", "int VAR_7, VAR_8, VAR_9;", "int VAR_10;", "int VAR_11, VAR_12;", "int VAR_13[2] = {0, 0};", "if (VAR_5 <= 4) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet is too small\\n\");", "return AVERROR(EINVAL);", "}", "VAR_10 = AV_RL32(VAR_4);", "if (VAR_10 > (1U<<24)) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet is too big\\n\");", "return AVERROR_INVALIDDATA;", "}", "init_get_bits(&gb, VAR_4 + 4, (VAR_5 - 4) * 8);", "if(!get_bits1(&gb)){", "av_log(VAR_0, AV_LOG_INFO, \"Sound: no VAR_1\\n\");", "*VAR_2 = 0;", "return 1;", "}", "VAR_12 = get_bits1(&gb);", "VAR_11 = get_bits1(&gb);", "if (VAR_12 ^ (VAR_0->channels != 1)) {", "av_log(VAR_0, AV_LOG_ERROR, \"channels mismatch\\n\");", "return AVERROR(EINVAL);", "}", "if (VAR_11 && VAR_0->sample_fmt == AV_SAMPLE_FMT_U8) {", "av_log(VAR_0, AV_LOG_ERROR, \"sample format mismatch\\n\");", "return AVERROR(EINVAL);", "}", "s->frame.nb_samples = VAR_10 / (VAR_0->channels * (VAR_11 + 1));", "if ((VAR_9 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_9;", "}", "samples = (int16_t *)s->frame.VAR_1[0];", "samples8 = s->frame.VAR_1[0];", "for(VAR_7 = 0; VAR_7 < (1 << (VAR_11 + VAR_12)); VAR_7++) {", "h[VAR_7].length = 256;", "h[VAR_7].maxlength = 0;", "h[VAR_7].current = 0;", "h[VAR_7].VAR_11 = av_mallocz(256 * 4);", "h[VAR_7].lengths = av_mallocz(256 * sizeof(int));", "h[VAR_7].values = av_mallocz(256 * sizeof(int));", "skip_bits1(&gb);", "smacker_decode_tree(&gb, &h[VAR_7], 0, 0);", "skip_bits1(&gb);", "if(h[VAR_7].current > 1) {", "VAR_8 = init_vlc(&vlc[VAR_7], SMKTREE_BITS, h[VAR_7].length,\nh[VAR_7].lengths, sizeof(int), sizeof(int),\nh[VAR_7].VAR_11, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);", "if(VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot build VLC table\\n\");", "return AVERROR_INVALIDDATA;", "}", "}", "}", "if(VAR_11) {", "for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--)", "VAR_13[VAR_7] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16);", "for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++)", "*samples++ = VAR_13[VAR_7];", "for(; VAR_7 < VAR_10 / 2; VAR_7++) {", "if(get_bits_left(&gb)<0)\nreturn AVERROR_INVALIDDATA;", "if(VAR_7 & VAR_12) {", "if(vlc[2].table)\nVAR_8 = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3);", "else\nVAR_8 = 0;", "if (VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid vlc\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_6 = h[2].values[VAR_8];", "if(vlc[3].table)\nVAR_8 = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3);", "else\nVAR_8 = 0;", "if (VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid vlc\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_6 |= h[3].values[VAR_8] << 8;", "VAR_13[1] += sign_extend(VAR_6, 16);", "*samples++ = av_clip_int16(VAR_13[1]);", "} else {", "if(vlc[0].table)\nVAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);", "else\nVAR_8 = 0;", "if (VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid vlc\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_6 = h[0].values[VAR_8];", "if(vlc[1].table)\nVAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);", "else\nVAR_8 = 0;", "if (VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid vlc\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_6 |= h[1].values[VAR_8] << 8;", "VAR_13[0] += sign_extend(VAR_6, 16);", "*samples++ = av_clip_int16(VAR_13[0]);", "}", "}", "} else {", "for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--)", "VAR_13[VAR_7] = get_bits(&gb, 8);", "for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++)", "*samples8++ = VAR_13[VAR_7];", "for(; VAR_7 < VAR_10; VAR_7++) {", "if(get_bits_left(&gb)<0)\nreturn AVERROR_INVALIDDATA;", "if(VAR_7 & VAR_12){", "if(vlc[1].table)\nVAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);", "else\nVAR_8 = 0;", "if (VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid vlc\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_13[1] += sign_extend(h[1].values[VAR_8], 8);", "*samples8++ = av_clip_uint8(VAR_13[1]);", "} else {", "if(vlc[0].table)\nVAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);", "else\nVAR_8 = 0;", "if (VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid vlc\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_13[0] += sign_extend(h[0].values[VAR_8], 8);", "*samples8++ = av_clip_uint8(VAR_13[0]);", "}", "}", "}", "for(VAR_7 = 0; VAR_7 < 4; VAR_7++) {", "if(vlc[VAR_7].table)\nff_free_vlc(&vlc[VAR_7]);", "av_free(h[VAR_7].VAR_11);", "av_free(h[VAR_7].lengths);", "av_free(h[VAR_7].values);", "}", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = s->frame;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 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 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277, 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329, 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ] ]
5,025
CharDriverState *qemu_chr_open(const char *filename) { const char *p; if (!strcmp(filename, "vc")) { return text_console_init(&display_state); } else if (!strcmp(filename, "null")) { return qemu_chr_open_null(); } else if (strstart(filename, "tcp:", &p)) { return qemu_chr_open_tcp(p, 0, 0); } else if (strstart(filename, "telnet:", &p)) { return qemu_chr_open_tcp(p, 1, 0); } else if (strstart(filename, "udp:", &p)) { return qemu_chr_open_udp(p); } else if (strstart(filename, "mon:", &p)) { CharDriverState *drv = qemu_chr_open(p); if (drv) { drv = qemu_chr_open_mux(drv); monitor_init(drv, !nographic); return drv; } printf("Unable to open driver: %s\n", p); return 0; } else #ifndef _WIN32 if (strstart(filename, "unix:", &p)) { return qemu_chr_open_tcp(p, 0, 1); } else if (strstart(filename, "file:", &p)) { return qemu_chr_open_file_out(p); } else if (strstart(filename, "pipe:", &p)) { return qemu_chr_open_pipe(p); } else if (!strcmp(filename, "pty")) { return qemu_chr_open_pty(); } else if (!strcmp(filename, "stdio")) { return qemu_chr_open_stdio(); } else #if defined(__linux__) if (strstart(filename, "/dev/parport", NULL)) { return qemu_chr_open_pp(filename); } else #endif if (strstart(filename, "/dev/", NULL)) { return qemu_chr_open_tty(filename); } else #else /* !_WIN32 */ if (strstart(filename, "COM", NULL)) { return qemu_chr_open_win(filename); } else if (strstart(filename, "pipe:", &p)) { return qemu_chr_open_win_pipe(p); } else if (strstart(filename, "con:", NULL)) { return qemu_chr_open_win_con(filename); } else if (strstart(filename, "file:", &p)) { return qemu_chr_open_win_file_out(p); } #endif { return NULL; } }
false
qemu
3fda388a1c19bef4aa8615d91693260e74564bd8
CharDriverState *qemu_chr_open(const char *filename) { const char *p; if (!strcmp(filename, "vc")) { return text_console_init(&display_state); } else if (!strcmp(filename, "null")) { return qemu_chr_open_null(); } else if (strstart(filename, "tcp:", &p)) { return qemu_chr_open_tcp(p, 0, 0); } else if (strstart(filename, "telnet:", &p)) { return qemu_chr_open_tcp(p, 1, 0); } else if (strstart(filename, "udp:", &p)) { return qemu_chr_open_udp(p); } else if (strstart(filename, "mon:", &p)) { CharDriverState *drv = qemu_chr_open(p); if (drv) { drv = qemu_chr_open_mux(drv); monitor_init(drv, !nographic); return drv; } printf("Unable to open driver: %s\n", p); return 0; } else #ifndef _WIN32 if (strstart(filename, "unix:", &p)) { return qemu_chr_open_tcp(p, 0, 1); } else if (strstart(filename, "file:", &p)) { return qemu_chr_open_file_out(p); } else if (strstart(filename, "pipe:", &p)) { return qemu_chr_open_pipe(p); } else if (!strcmp(filename, "pty")) { return qemu_chr_open_pty(); } else if (!strcmp(filename, "stdio")) { return qemu_chr_open_stdio(); } else #if defined(__linux__) if (strstart(filename, "/dev/parport", NULL)) { return qemu_chr_open_pp(filename); } else #endif if (strstart(filename, "/dev/", NULL)) { return qemu_chr_open_tty(filename); } else #else if (strstart(filename, "COM", NULL)) { return qemu_chr_open_win(filename); } else if (strstart(filename, "pipe:", &p)) { return qemu_chr_open_win_pipe(p); } else if (strstart(filename, "con:", NULL)) { return qemu_chr_open_win_con(filename); } else if (strstart(filename, "file:", &p)) { return qemu_chr_open_win_file_out(p); } #endif { return NULL; } }
{ "code": [], "line_no": [] }
CharDriverState *FUNC_0(const char *filename) { const char *VAR_0; if (!strcmp(filename, "vc")) { return text_console_init(&display_state); } else if (!strcmp(filename, "null")) { return qemu_chr_open_null(); } else if (strstart(filename, "tcp:", &VAR_0)) { return qemu_chr_open_tcp(VAR_0, 0, 0); } else if (strstart(filename, "telnet:", &VAR_0)) { return qemu_chr_open_tcp(VAR_0, 1, 0); } else if (strstart(filename, "udp:", &VAR_0)) { return qemu_chr_open_udp(VAR_0); } else if (strstart(filename, "mon:", &VAR_0)) { CharDriverState *drv = FUNC_0(VAR_0); if (drv) { drv = qemu_chr_open_mux(drv); monitor_init(drv, !nographic); return drv; } printf("Unable to open driver: %s\n", VAR_0); return 0; } else #ifndef _WIN32 if (strstart(filename, "unix:", &VAR_0)) { return qemu_chr_open_tcp(VAR_0, 0, 1); } else if (strstart(filename, "file:", &VAR_0)) { return qemu_chr_open_file_out(VAR_0); } else if (strstart(filename, "pipe:", &VAR_0)) { return qemu_chr_open_pipe(VAR_0); } else if (!strcmp(filename, "pty")) { return qemu_chr_open_pty(); } else if (!strcmp(filename, "stdio")) { return qemu_chr_open_stdio(); } else #if defined(__linux__) if (strstart(filename, "/dev/parport", NULL)) { return qemu_chr_open_pp(filename); } else #endif if (strstart(filename, "/dev/", NULL)) { return qemu_chr_open_tty(filename); } else #else if (strstart(filename, "COM", NULL)) { return qemu_chr_open_win(filename); } else if (strstart(filename, "pipe:", &VAR_0)) { return qemu_chr_open_win_pipe(VAR_0); } else if (strstart(filename, "con:", NULL)) { return qemu_chr_open_win_con(filename); } else if (strstart(filename, "file:", &VAR_0)) { return qemu_chr_open_win_file_out(VAR_0); } #endif { return NULL; } }
[ "CharDriverState *FUNC_0(const char *filename)\n{", "const char *VAR_0;", "if (!strcmp(filename, \"vc\")) {", "return text_console_init(&display_state);", "} else if (!strcmp(filename, \"null\")) {", "return qemu_chr_open_null();", "} else", "if (strstart(filename, \"tcp:\", &VAR_0)) {", "return qemu_chr_open_tcp(VAR_0, 0, 0);", "} else", "if (strstart(filename, \"telnet:\", &VAR_0)) {", "return qemu_chr_open_tcp(VAR_0, 1, 0);", "} else", "if (strstart(filename, \"udp:\", &VAR_0)) {", "return qemu_chr_open_udp(VAR_0);", "} else", "if (strstart(filename, \"mon:\", &VAR_0)) {", "CharDriverState *drv = FUNC_0(VAR_0);", "if (drv) {", "drv = qemu_chr_open_mux(drv);", "monitor_init(drv, !nographic);", "return drv;", "}", "printf(\"Unable to open driver: %s\\n\", VAR_0);", "return 0;", "} else", "#ifndef _WIN32\nif (strstart(filename, \"unix:\", &VAR_0)) {", "return qemu_chr_open_tcp(VAR_0, 0, 1);", "} else if (strstart(filename, \"file:\", &VAR_0)) {", "return qemu_chr_open_file_out(VAR_0);", "} else if (strstart(filename, \"pipe:\", &VAR_0)) {", "return qemu_chr_open_pipe(VAR_0);", "} else if (!strcmp(filename, \"pty\")) {", "return qemu_chr_open_pty();", "} else if (!strcmp(filename, \"stdio\")) {", "return qemu_chr_open_stdio();", "} else", "#if defined(__linux__)\nif (strstart(filename, \"/dev/parport\", NULL)) {", "return qemu_chr_open_pp(filename);", "} else", "#endif\nif (strstart(filename, \"/dev/\", NULL)) {", "return qemu_chr_open_tty(filename);", "} else", "#else\nif (strstart(filename, \"COM\", NULL)) {", "return qemu_chr_open_win(filename);", "} else", "if (strstart(filename, \"pipe:\", &VAR_0)) {", "return qemu_chr_open_win_pipe(VAR_0);", "} else", "if (strstart(filename, \"con:\", NULL)) {", "return qemu_chr_open_win_con(filename);", "} else", "if (strstart(filename, \"file:\", &VAR_0)) {", "return qemu_chr_open_win_file_out(VAR_0);", "}", "#endif\n{", "return NULL;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ] ]
5,026
void spapr_events_init(sPAPREnvironment *spapr) { spapr->epow_irq = xics_alloc(spapr->icp, 0, 0, false); spapr->epow_notifier.notify = spapr_powerdown_req; qemu_register_powerdown_notifier(&spapr->epow_notifier); spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception", check_exception); }
false
qemu
31fe14d15d08d613ff38abb249911e98c7966b86
void spapr_events_init(sPAPREnvironment *spapr) { spapr->epow_irq = xics_alloc(spapr->icp, 0, 0, false); spapr->epow_notifier.notify = spapr_powerdown_req; qemu_register_powerdown_notifier(&spapr->epow_notifier); spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception", check_exception); }
{ "code": [], "line_no": [] }
void FUNC_0(sPAPREnvironment *VAR_0) { VAR_0->epow_irq = xics_alloc(VAR_0->icp, 0, 0, false); VAR_0->epow_notifier.notify = spapr_powerdown_req; qemu_register_powerdown_notifier(&VAR_0->epow_notifier); spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception", check_exception); }
[ "void FUNC_0(sPAPREnvironment *VAR_0)\n{", "VAR_0->epow_irq = xics_alloc(VAR_0->icp, 0, 0, false);", "VAR_0->epow_notifier.notify = spapr_powerdown_req;", "qemu_register_powerdown_notifier(&VAR_0->epow_notifier);", "spapr_rtas_register(RTAS_CHECK_EXCEPTION, \"check-exception\",\ncheck_exception);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ] ]
5,028
GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **errp) { GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; bool is_ok; DWORD write_count; GuestFileHandle *gfh = guest_file_handle_find(handle, errp); HANDLE fh; if (!gfh) { return NULL; } fh = gfh->fh; buf = g_base64_decode(buf_b64, &buf_len); if (!has_count) { count = buf_len; } else if (count < 0 || count > buf_len) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); goto done; } is_ok = WriteFile(fh, buf, count, &write_count, NULL); if (!is_ok) { error_setg_win32(errp, GetLastError(), "failed to write to file"); slog("guest-file-write-failed, handle: %" PRId64, handle); } else { write_data = g_new0(GuestFileWrite, 1); write_data->count = (size_t) write_count; } done: g_free(buf); return write_data; }
false
qemu
920639cab0fe28d003c90b53bd8b66e8fb333bdd
GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **errp) { GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; bool is_ok; DWORD write_count; GuestFileHandle *gfh = guest_file_handle_find(handle, errp); HANDLE fh; if (!gfh) { return NULL; } fh = gfh->fh; buf = g_base64_decode(buf_b64, &buf_len); if (!has_count) { count = buf_len; } else if (count < 0 || count > buf_len) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); goto done; } is_ok = WriteFile(fh, buf, count, &write_count, NULL); if (!is_ok) { error_setg_win32(errp, GetLastError(), "failed to write to file"); slog("guest-file-write-failed, handle: %" PRId64, handle); } else { write_data = g_new0(GuestFileWrite, 1); write_data->count = (size_t) write_count; } done: g_free(buf); return write_data; }
{ "code": [], "line_no": [] }
GuestFileWrite *FUNC_0(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **errp) { GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; bool is_ok; DWORD write_count; GuestFileHandle *gfh = guest_file_handle_find(handle, errp); HANDLE fh; if (!gfh) { return NULL; } fh = gfh->fh; buf = g_base64_decode(buf_b64, &buf_len); if (!has_count) { count = buf_len; } else if (count < 0 || count > buf_len) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); goto done; } is_ok = WriteFile(fh, buf, count, &write_count, NULL); if (!is_ok) { error_setg_win32(errp, GetLastError(), "failed to write to file"); slog("guest-file-write-failed, handle: %" PRId64, handle); } else { write_data = g_new0(GuestFileWrite, 1); write_data->count = (size_t) write_count; } done: g_free(buf); return write_data; }
[ "GuestFileWrite *FUNC_0(int64_t handle, const char *buf_b64,\nbool has_count, int64_t count,\nError **errp)\n{", "GuestFileWrite *write_data = NULL;", "guchar *buf;", "gsize buf_len;", "bool is_ok;", "DWORD write_count;", "GuestFileHandle *gfh = guest_file_handle_find(handle, errp);", "HANDLE fh;", "if (!gfh) {", "return NULL;", "}", "fh = gfh->fh;", "buf = g_base64_decode(buf_b64, &buf_len);", "if (!has_count) {", "count = buf_len;", "} else if (count < 0 || count > buf_len) {", "error_setg(errp, \"value '%\" PRId64\n\"' is invalid for argument count\", count);", "goto done;", "}", "is_ok = WriteFile(fh, buf, count, &write_count, NULL);", "if (!is_ok) {", "error_setg_win32(errp, GetLastError(), \"failed to write to file\");", "slog(\"guest-file-write-failed, handle: %\" PRId64, handle);", "} else {", "write_data = g_new0(GuestFileWrite, 1);", "write_data->count = (size_t) write_count;", "}", "done:\ng_free(buf);", "return write_data;", "}" ]
[ 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77 ] ]
5,029
static int nbd_config(BDRVNBDState *s, QDict *options, char **export) { Error *local_err = NULL; if (qdict_haskey(options, "path") == qdict_haskey(options, "host")) { if (qdict_haskey(options, "path")) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not " "be used at the same time."); } else { qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host " "must be specified."); } return -EINVAL; } s->client.is_unix = qdict_haskey(options, "path"); s->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); qemu_opts_absorb_qdict(s->socket_opts, options, &local_err); if (local_err) { qerror_report_err(local_err); error_free(local_err); return -EINVAL; } if (!qemu_opt_get(s->socket_opts, "port")) { qemu_opt_set_number(s->socket_opts, "port", NBD_DEFAULT_PORT); } *export = g_strdup(qdict_get_try_str(options, "export")); if (*export) { qdict_del(options, "export"); } return 0; }
false
qemu
77e8b9ca64e85d3d309f322410964b7852ec091e
static int nbd_config(BDRVNBDState *s, QDict *options, char **export) { Error *local_err = NULL; if (qdict_haskey(options, "path") == qdict_haskey(options, "host")) { if (qdict_haskey(options, "path")) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not " "be used at the same time."); } else { qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host " "must be specified."); } return -EINVAL; } s->client.is_unix = qdict_haskey(options, "path"); s->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); qemu_opts_absorb_qdict(s->socket_opts, options, &local_err); if (local_err) { qerror_report_err(local_err); error_free(local_err); return -EINVAL; } if (!qemu_opt_get(s->socket_opts, "port")) { qemu_opt_set_number(s->socket_opts, "port", NBD_DEFAULT_PORT); } *export = g_strdup(qdict_get_try_str(options, "export")); if (*export) { qdict_del(options, "export"); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BDRVNBDState *VAR_0, QDict *VAR_1, char **VAR_2) { Error *local_err = NULL; if (qdict_haskey(VAR_1, "path") == qdict_haskey(VAR_1, "host")) { if (qdict_haskey(VAR_1, "path")) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not " "be used at the same time."); } else { qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host " "must be specified."); } return -EINVAL; } VAR_0->client.is_unix = qdict_haskey(VAR_1, "path"); VAR_0->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); qemu_opts_absorb_qdict(VAR_0->socket_opts, VAR_1, &local_err); if (local_err) { qerror_report_err(local_err); error_free(local_err); return -EINVAL; } if (!qemu_opt_get(VAR_0->socket_opts, "port")) { qemu_opt_set_number(VAR_0->socket_opts, "port", NBD_DEFAULT_PORT); } *VAR_2 = g_strdup(qdict_get_try_str(VAR_1, "VAR_2")); if (*VAR_2) { qdict_del(VAR_1, "VAR_2"); } return 0; }
[ "static int FUNC_0(BDRVNBDState *VAR_0, QDict *VAR_1, char **VAR_2)\n{", "Error *local_err = NULL;", "if (qdict_haskey(VAR_1, \"path\") == qdict_haskey(VAR_1, \"host\")) {", "if (qdict_haskey(VAR_1, \"path\")) {", "qerror_report(ERROR_CLASS_GENERIC_ERROR, \"path and host may not \"\n\"be used at the same time.\");", "} else {", "qerror_report(ERROR_CLASS_GENERIC_ERROR, \"one of path and host \"\n\"must be specified.\");", "}", "return -EINVAL;", "}", "VAR_0->client.is_unix = qdict_haskey(VAR_1, \"path\");", "VAR_0->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0,\n&error_abort);", "qemu_opts_absorb_qdict(VAR_0->socket_opts, VAR_1, &local_err);", "if (local_err) {", "qerror_report_err(local_err);", "error_free(local_err);", "return -EINVAL;", "}", "if (!qemu_opt_get(VAR_0->socket_opts, \"port\")) {", "qemu_opt_set_number(VAR_0->socket_opts, \"port\", NBD_DEFAULT_PORT);", "}", "*VAR_2 = g_strdup(qdict_get_try_str(VAR_1, \"VAR_2\"));", "if (*VAR_2) {", "qdict_del(VAR_1, \"VAR_2\");", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ] ]
5,030
int qemu_loadvm_state(QEMUFile *f) { LIST_HEAD(, LoadStateEntry) loadvm_handlers = LIST_HEAD_INITIALIZER(loadvm_handlers); LoadStateEntry *le, *new_le; uint8_t section_type; unsigned int v; int ret; v = qemu_get_be32(f); if (v != QEMU_VM_FILE_MAGIC) return -EINVAL; v = qemu_get_be32(f); if (v == QEMU_VM_FILE_VERSION_COMPAT) { fprintf(stderr, "SaveVM v2 format is obsolete and don't work anymore\n"); return -ENOTSUP; } if (v != QEMU_VM_FILE_VERSION) return -ENOTSUP; while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) { uint32_t instance_id, version_id, section_id; SaveStateEntry *se; char idstr[257]; int len; switch (section_type) { case QEMU_VM_SECTION_START: case QEMU_VM_SECTION_FULL: /* Read section start */ section_id = qemu_get_be32(f); len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)idstr, len); idstr[len] = 0; instance_id = qemu_get_be32(f); version_id = qemu_get_be32(f); /* Find savevm section */ se = find_se(idstr, instance_id); if (se == NULL) { fprintf(stderr, "Unknown savevm section or instance '%s' %d\n", idstr, instance_id); ret = -EINVAL; goto out; } /* Validate version */ if (version_id > se->version_id) { fprintf(stderr, "savevm: unsupported version %d for '%s' v%d\n", version_id, idstr, se->version_id); ret = -EINVAL; goto out; } /* Add entry */ le = qemu_mallocz(sizeof(*le)); le->se = se; le->section_id = section_id; le->version_id = version_id; LIST_INSERT_HEAD(&loadvm_handlers, le, entry); ret = vmstate_load(f, le->se, le->version_id); if (ret < 0) { fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", instance_id, idstr); goto out; } break; case QEMU_VM_SECTION_PART: case QEMU_VM_SECTION_END: section_id = qemu_get_be32(f); LIST_FOREACH(le, &loadvm_handlers, entry) { if (le->section_id == section_id) { break; } } if (le == NULL) { fprintf(stderr, "Unknown savevm section %d\n", section_id); ret = -EINVAL; goto out; } ret = vmstate_load(f, le->se, le->version_id); if (ret < 0) { fprintf(stderr, "qemu: warning: error while loading state section id %d\n", section_id); goto out; } break; default: fprintf(stderr, "Unknown savevm section type %d\n", section_type); ret = -EINVAL; goto out; } } ret = 0; out: LIST_FOREACH_SAFE(le, &loadvm_handlers, entry, new_le) { LIST_REMOVE(le, entry); qemu_free(le); } if (qemu_file_has_error(f)) ret = -EIO; return ret; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
int qemu_loadvm_state(QEMUFile *f) { LIST_HEAD(, LoadStateEntry) loadvm_handlers = LIST_HEAD_INITIALIZER(loadvm_handlers); LoadStateEntry *le, *new_le; uint8_t section_type; unsigned int v; int ret; v = qemu_get_be32(f); if (v != QEMU_VM_FILE_MAGIC) return -EINVAL; v = qemu_get_be32(f); if (v == QEMU_VM_FILE_VERSION_COMPAT) { fprintf(stderr, "SaveVM v2 format is obsolete and don't work anymore\n"); return -ENOTSUP; } if (v != QEMU_VM_FILE_VERSION) return -ENOTSUP; while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) { uint32_t instance_id, version_id, section_id; SaveStateEntry *se; char idstr[257]; int len; switch (section_type) { case QEMU_VM_SECTION_START: case QEMU_VM_SECTION_FULL: section_id = qemu_get_be32(f); len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)idstr, len); idstr[len] = 0; instance_id = qemu_get_be32(f); version_id = qemu_get_be32(f); se = find_se(idstr, instance_id); if (se == NULL) { fprintf(stderr, "Unknown savevm section or instance '%s' %d\n", idstr, instance_id); ret = -EINVAL; goto out; } if (version_id > se->version_id) { fprintf(stderr, "savevm: unsupported version %d for '%s' v%d\n", version_id, idstr, se->version_id); ret = -EINVAL; goto out; } le = qemu_mallocz(sizeof(*le)); le->se = se; le->section_id = section_id; le->version_id = version_id; LIST_INSERT_HEAD(&loadvm_handlers, le, entry); ret = vmstate_load(f, le->se, le->version_id); if (ret < 0) { fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", instance_id, idstr); goto out; } break; case QEMU_VM_SECTION_PART: case QEMU_VM_SECTION_END: section_id = qemu_get_be32(f); LIST_FOREACH(le, &loadvm_handlers, entry) { if (le->section_id == section_id) { break; } } if (le == NULL) { fprintf(stderr, "Unknown savevm section %d\n", section_id); ret = -EINVAL; goto out; } ret = vmstate_load(f, le->se, le->version_id); if (ret < 0) { fprintf(stderr, "qemu: warning: error while loading state section id %d\n", section_id); goto out; } break; default: fprintf(stderr, "Unknown savevm section type %d\n", section_type); ret = -EINVAL; goto out; } } ret = 0; out: LIST_FOREACH_SAFE(le, &loadvm_handlers, entry, new_le) { LIST_REMOVE(le, entry); qemu_free(le); } if (qemu_file_has_error(f)) ret = -EIO; return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(QEMUFile *VAR_0) { LIST_HEAD(, LoadStateEntry) loadvm_handlers = LIST_HEAD_INITIALIZER(loadvm_handlers); LoadStateEntry *le, *new_le; uint8_t section_type; unsigned int VAR_1; int VAR_2; VAR_1 = qemu_get_be32(VAR_0); if (VAR_1 != QEMU_VM_FILE_MAGIC) return -EINVAL; VAR_1 = qemu_get_be32(VAR_0); if (VAR_1 == QEMU_VM_FILE_VERSION_COMPAT) { fprintf(stderr, "SaveVM v2 format is obsolete and don't work anymore\n"); return -ENOTSUP; } if (VAR_1 != QEMU_VM_FILE_VERSION) return -ENOTSUP; while ((section_type = qemu_get_byte(VAR_0)) != QEMU_VM_EOF) { uint32_t instance_id, version_id, section_id; SaveStateEntry *se; char VAR_3[257]; int VAR_4; switch (section_type) { case QEMU_VM_SECTION_START: case QEMU_VM_SECTION_FULL: section_id = qemu_get_be32(VAR_0); VAR_4 = qemu_get_byte(VAR_0); qemu_get_buffer(VAR_0, (uint8_t *)VAR_3, VAR_4); VAR_3[VAR_4] = 0; instance_id = qemu_get_be32(VAR_0); version_id = qemu_get_be32(VAR_0); se = find_se(VAR_3, instance_id); if (se == NULL) { fprintf(stderr, "Unknown savevm section or instance '%s' %d\n", VAR_3, instance_id); VAR_2 = -EINVAL; goto out; } if (version_id > se->version_id) { fprintf(stderr, "savevm: unsupported version %d for '%s' VAR_1%d\n", version_id, VAR_3, se->version_id); VAR_2 = -EINVAL; goto out; } le = qemu_mallocz(sizeof(*le)); le->se = se; le->section_id = section_id; le->version_id = version_id; LIST_INSERT_HEAD(&loadvm_handlers, le, entry); VAR_2 = vmstate_load(VAR_0, le->se, le->version_id); if (VAR_2 < 0) { fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", instance_id, VAR_3); goto out; } break; case QEMU_VM_SECTION_PART: case QEMU_VM_SECTION_END: section_id = qemu_get_be32(VAR_0); LIST_FOREACH(le, &loadvm_handlers, entry) { if (le->section_id == section_id) { break; } } if (le == NULL) { fprintf(stderr, "Unknown savevm section %d\n", section_id); VAR_2 = -EINVAL; goto out; } VAR_2 = vmstate_load(VAR_0, le->se, le->version_id); if (VAR_2 < 0) { fprintf(stderr, "qemu: warning: error while loading state section id %d\n", section_id); goto out; } break; default: fprintf(stderr, "Unknown savevm section type %d\n", section_type); VAR_2 = -EINVAL; goto out; } } VAR_2 = 0; out: LIST_FOREACH_SAFE(le, &loadvm_handlers, entry, new_le) { LIST_REMOVE(le, entry); qemu_free(le); } if (qemu_file_has_error(VAR_0)) VAR_2 = -EIO; return VAR_2; }
[ "int FUNC_0(QEMUFile *VAR_0)\n{", "LIST_HEAD(, LoadStateEntry) loadvm_handlers =\nLIST_HEAD_INITIALIZER(loadvm_handlers);", "LoadStateEntry *le, *new_le;", "uint8_t section_type;", "unsigned int VAR_1;", "int VAR_2;", "VAR_1 = qemu_get_be32(VAR_0);", "if (VAR_1 != QEMU_VM_FILE_MAGIC)\nreturn -EINVAL;", "VAR_1 = qemu_get_be32(VAR_0);", "if (VAR_1 == QEMU_VM_FILE_VERSION_COMPAT) {", "fprintf(stderr, \"SaveVM v2 format is obsolete and don't work anymore\\n\");", "return -ENOTSUP;", "}", "if (VAR_1 != QEMU_VM_FILE_VERSION)\nreturn -ENOTSUP;", "while ((section_type = qemu_get_byte(VAR_0)) != QEMU_VM_EOF) {", "uint32_t instance_id, version_id, section_id;", "SaveStateEntry *se;", "char VAR_3[257];", "int VAR_4;", "switch (section_type) {", "case QEMU_VM_SECTION_START:\ncase QEMU_VM_SECTION_FULL:\nsection_id = qemu_get_be32(VAR_0);", "VAR_4 = qemu_get_byte(VAR_0);", "qemu_get_buffer(VAR_0, (uint8_t *)VAR_3, VAR_4);", "VAR_3[VAR_4] = 0;", "instance_id = qemu_get_be32(VAR_0);", "version_id = qemu_get_be32(VAR_0);", "se = find_se(VAR_3, instance_id);", "if (se == NULL) {", "fprintf(stderr, \"Unknown savevm section or instance '%s' %d\\n\", VAR_3, instance_id);", "VAR_2 = -EINVAL;", "goto out;", "}", "if (version_id > se->version_id) {", "fprintf(stderr, \"savevm: unsupported version %d for '%s' VAR_1%d\\n\",\nversion_id, VAR_3, se->version_id);", "VAR_2 = -EINVAL;", "goto out;", "}", "le = qemu_mallocz(sizeof(*le));", "le->se = se;", "le->section_id = section_id;", "le->version_id = version_id;", "LIST_INSERT_HEAD(&loadvm_handlers, le, entry);", "VAR_2 = vmstate_load(VAR_0, le->se, le->version_id);", "if (VAR_2 < 0) {", "fprintf(stderr, \"qemu: warning: error while loading state for instance 0x%x of device '%s'\\n\",\ninstance_id, VAR_3);", "goto out;", "}", "break;", "case QEMU_VM_SECTION_PART:\ncase QEMU_VM_SECTION_END:\nsection_id = qemu_get_be32(VAR_0);", "LIST_FOREACH(le, &loadvm_handlers, entry) {", "if (le->section_id == section_id) {", "break;", "}", "}", "if (le == NULL) {", "fprintf(stderr, \"Unknown savevm section %d\\n\", section_id);", "VAR_2 = -EINVAL;", "goto out;", "}", "VAR_2 = vmstate_load(VAR_0, le->se, le->version_id);", "if (VAR_2 < 0) {", "fprintf(stderr, \"qemu: warning: error while loading state section id %d\\n\",\nsection_id);", "goto out;", "}", "break;", "default:\nfprintf(stderr, \"Unknown savevm section type %d\\n\", section_type);", "VAR_2 = -EINVAL;", "goto out;", "}", "}", "VAR_2 = 0;", "out:\nLIST_FOREACH_SAFE(le, &loadvm_handlers, entry, new_le) {", "LIST_REMOVE(le, entry);", "qemu_free(le);", "}", "if (qemu_file_has_error(VAR_0))\nVAR_2 = -EIO;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141, 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213, 215 ], [ 219 ], [ 221 ] ]
5,031
int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags) { #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { if (bp->pc == pc && bp->flags == flags) { cpu_breakpoint_remove_by_ref(cpu, bp); return 0; } } return -ENOENT; #else return -ENOSYS; #endif }
false
qemu
ec53b45bcd1f74f7a4c31331fa6d50b402cd6d26
int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags) { #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { if (bp->pc == pc && bp->flags == flags) { cpu_breakpoint_remove_by_ref(cpu, bp); return 0; } } return -ENOENT; #else return -ENOSYS; #endif }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0, vaddr VAR_1, int VAR_2) { #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry) { if (bp->VAR_1 == VAR_1 && bp->VAR_2 == VAR_2) { cpu_breakpoint_remove_by_ref(VAR_0, bp); return 0; } } return -ENOENT; #else return -ENOSYS; #endif }
[ "int FUNC_0(CPUState *VAR_0, vaddr VAR_1, int VAR_2)\n{", "#if defined(TARGET_HAS_ICE)\nCPUBreakpoint *bp;", "QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry) {", "if (bp->VAR_1 == VAR_1 && bp->VAR_2 == VAR_2) {", "cpu_breakpoint_remove_by_ref(VAR_0, bp);", "return 0;", "}", "}", "return -ENOENT;", "#else\nreturn -ENOSYS;", "#endif\n}" ]
[ 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 ] ]
5,032
void kvm_s390_interrupt(S390CPU *cpu, int type, uint32_t code) { kvm_s390_interrupt_internal(cpu, type, code, 0, 0); }
false
qemu
de13d2161473d02ae97ec0f8e4503147554892dd
void kvm_s390_interrupt(S390CPU *cpu, int type, uint32_t code) { kvm_s390_interrupt_internal(cpu, type, code, 0, 0); }
{ "code": [], "line_no": [] }
void FUNC_0(S390CPU *VAR_0, int VAR_1, uint32_t VAR_2) { kvm_s390_interrupt_internal(VAR_0, VAR_1, VAR_2, 0, 0); }
[ "void FUNC_0(S390CPU *VAR_0, int VAR_1, uint32_t VAR_2)\n{", "kvm_s390_interrupt_internal(VAR_0, VAR_1, VAR_2, 0, 0);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,033
static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pix_fmt) { struct video_data *s = ctx->priv_data; int fd = s->fd; struct v4l2_format fmt; struct v4l2_pix_format *pix = &fmt.fmt.pix; int res; memset(&fmt, 0, sizeof(struct v4l2_format)); fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; pix->width = *width; pix->height = *height; pix->pixelformat = pix_fmt; pix->field = V4L2_FIELD_ANY; res = ioctl(fd, VIDIOC_S_FMT, &fmt); if ((*width != fmt.fmt.pix.width) || (*height != fmt.fmt.pix.height)) { av_log(ctx, AV_LOG_INFO, "The V4L2 driver changed the video from %dx%d to %dx%d\n", *width, *height, fmt.fmt.pix.width, fmt.fmt.pix.height); *width = fmt.fmt.pix.width; *height = fmt.fmt.pix.height; } if (pix_fmt != fmt.fmt.pix.pixelformat) { av_log(ctx, AV_LOG_DEBUG, "The V4L2 driver changed the pixel format " "from 0x%08X to 0x%08X\n", pix_fmt, fmt.fmt.pix.pixelformat); res = -1; } if (fmt.fmt.pix.field == V4L2_FIELD_INTERLACED) { av_log(ctx, AV_LOG_DEBUG, "The V4L2 driver using the interlaced mode"); s->interlaced = 1; } return res; }
false
FFmpeg
b6db385922b79939b0dc124d53ddb4824afac040
static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pix_fmt) { struct video_data *s = ctx->priv_data; int fd = s->fd; struct v4l2_format fmt; struct v4l2_pix_format *pix = &fmt.fmt.pix; int res; memset(&fmt, 0, sizeof(struct v4l2_format)); fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; pix->width = *width; pix->height = *height; pix->pixelformat = pix_fmt; pix->field = V4L2_FIELD_ANY; res = ioctl(fd, VIDIOC_S_FMT, &fmt); if ((*width != fmt.fmt.pix.width) || (*height != fmt.fmt.pix.height)) { av_log(ctx, AV_LOG_INFO, "The V4L2 driver changed the video from %dx%d to %dx%d\n", *width, *height, fmt.fmt.pix.width, fmt.fmt.pix.height); *width = fmt.fmt.pix.width; *height = fmt.fmt.pix.height; } if (pix_fmt != fmt.fmt.pix.pixelformat) { av_log(ctx, AV_LOG_DEBUG, "The V4L2 driver changed the pixel format " "from 0x%08X to 0x%08X\n", pix_fmt, fmt.fmt.pix.pixelformat); res = -1; } if (fmt.fmt.pix.field == V4L2_FIELD_INTERLACED) { av_log(ctx, AV_LOG_DEBUG, "The V4L2 driver using the interlaced mode"); s->interlaced = 1; } return res; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int *VAR_1, int *VAR_2, uint32_t VAR_3) { struct video_data *VAR_4 = VAR_0->priv_data; int VAR_5 = VAR_4->VAR_5; struct v4l2_format VAR_6; struct v4l2_pix_format *VAR_7 = &VAR_6.VAR_6.VAR_7; int VAR_8; memset(&VAR_6, 0, sizeof(struct v4l2_format)); VAR_6.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; VAR_7->VAR_1 = *VAR_1; VAR_7->VAR_2 = *VAR_2; VAR_7->pixelformat = VAR_3; VAR_7->field = V4L2_FIELD_ANY; VAR_8 = ioctl(VAR_5, VIDIOC_S_FMT, &VAR_6); if ((*VAR_1 != VAR_6.VAR_6.VAR_7.VAR_1) || (*VAR_2 != VAR_6.VAR_6.VAR_7.VAR_2)) { av_log(VAR_0, AV_LOG_INFO, "The V4L2 driver changed the video from %dx%d to %dx%d\n", *VAR_1, *VAR_2, VAR_6.VAR_6.VAR_7.VAR_1, VAR_6.VAR_6.VAR_7.VAR_2); *VAR_1 = VAR_6.VAR_6.VAR_7.VAR_1; *VAR_2 = VAR_6.VAR_6.VAR_7.VAR_2; } if (VAR_3 != VAR_6.VAR_6.VAR_7.pixelformat) { av_log(VAR_0, AV_LOG_DEBUG, "The V4L2 driver changed the pixel format " "from 0x%08X to 0x%08X\n", VAR_3, VAR_6.VAR_6.VAR_7.pixelformat); VAR_8 = -1; } if (VAR_6.VAR_6.VAR_7.field == V4L2_FIELD_INTERLACED) { av_log(VAR_0, AV_LOG_DEBUG, "The V4L2 driver using the interlaced mode"); VAR_4->interlaced = 1; } return VAR_8; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int *VAR_1, int *VAR_2,\nuint32_t VAR_3)\n{", "struct video_data *VAR_4 = VAR_0->priv_data;", "int VAR_5 = VAR_4->VAR_5;", "struct v4l2_format VAR_6;", "struct v4l2_pix_format *VAR_7 = &VAR_6.VAR_6.VAR_7;", "int VAR_8;", "memset(&VAR_6, 0, sizeof(struct v4l2_format));", "VAR_6.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;", "VAR_7->VAR_1 = *VAR_1;", "VAR_7->VAR_2 = *VAR_2;", "VAR_7->pixelformat = VAR_3;", "VAR_7->field = V4L2_FIELD_ANY;", "VAR_8 = ioctl(VAR_5, VIDIOC_S_FMT, &VAR_6);", "if ((*VAR_1 != VAR_6.VAR_6.VAR_7.VAR_1) || (*VAR_2 != VAR_6.VAR_6.VAR_7.VAR_2)) {", "av_log(VAR_0, AV_LOG_INFO,\n\"The V4L2 driver changed the video from %dx%d to %dx%d\\n\",\n*VAR_1, *VAR_2, VAR_6.VAR_6.VAR_7.VAR_1, VAR_6.VAR_6.VAR_7.VAR_2);", "*VAR_1 = VAR_6.VAR_6.VAR_7.VAR_1;", "*VAR_2 = VAR_6.VAR_6.VAR_7.VAR_2;", "}", "if (VAR_3 != VAR_6.VAR_6.VAR_7.pixelformat) {", "av_log(VAR_0, AV_LOG_DEBUG,\n\"The V4L2 driver changed the pixel format \"\n\"from 0x%08X to 0x%08X\\n\",\nVAR_3, VAR_6.VAR_6.VAR_7.pixelformat);", "VAR_8 = -1;", "}", "if (VAR_6.VAR_6.VAR_7.field == V4L2_FIELD_INTERLACED) {", "av_log(VAR_0, AV_LOG_DEBUG, \"The V4L2 driver using the interlaced mode\");", "VAR_4->interlaced = 1;", "}", "return VAR_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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61, 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
5,034
static void arm1026_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); cpu->dtb_compatible = "arm,arm1026"; set_feature(&cpu->env, ARM_FEATURE_V5); set_feature(&cpu->env, ARM_FEATURE_VFP); set_feature(&cpu->env, ARM_FEATURE_AUXCR); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); cpu->midr = 0x4106a262; cpu->reset_fpsid = 0x410110a0; cpu->ctr = 0x1dd20d2; cpu->reset_sctlr = 0x00090078; cpu->reset_auxcr = 1; { /* The 1026 had an IFAR at c6,c0,0,1 rather than the ARMv6 c6,c0,0,2 */ ARMCPRegInfo ifar = { .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[1]), .resetvalue = 0 }; define_one_arm_cp_reg(cpu, &ifar); } }
false
qemu
b848ce2b9cbd38da3f2530fd93dba76dba0621c0
static void arm1026_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); cpu->dtb_compatible = "arm,arm1026"; set_feature(&cpu->env, ARM_FEATURE_V5); set_feature(&cpu->env, ARM_FEATURE_VFP); set_feature(&cpu->env, ARM_FEATURE_AUXCR); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); cpu->midr = 0x4106a262; cpu->reset_fpsid = 0x410110a0; cpu->ctr = 0x1dd20d2; cpu->reset_sctlr = 0x00090078; cpu->reset_auxcr = 1; { ARMCPRegInfo ifar = { .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[1]), .resetvalue = 0 }; define_one_arm_cp_reg(cpu, &ifar); } }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0) { ARMCPU *cpu = ARM_CPU(VAR_0); cpu->dtb_compatible = "arm,arm1026"; set_feature(&cpu->env, ARM_FEATURE_V5); set_feature(&cpu->env, ARM_FEATURE_VFP); set_feature(&cpu->env, ARM_FEATURE_AUXCR); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); cpu->midr = 0x4106a262; cpu->reset_fpsid = 0x410110a0; cpu->ctr = 0x1dd20d2; cpu->reset_sctlr = 0x00090078; cpu->reset_auxcr = 1; { ARMCPRegInfo ifar = { .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[1]), .resetvalue = 0 }; define_one_arm_cp_reg(cpu, &ifar); } }
[ "static void FUNC_0(Object *VAR_0)\n{", "ARMCPU *cpu = ARM_CPU(VAR_0);", "cpu->dtb_compatible = \"arm,arm1026\";", "set_feature(&cpu->env, ARM_FEATURE_V5);", "set_feature(&cpu->env, ARM_FEATURE_VFP);", "set_feature(&cpu->env, ARM_FEATURE_AUXCR);", "set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);", "set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN);", "cpu->midr = 0x4106a262;", "cpu->reset_fpsid = 0x410110a0;", "cpu->ctr = 0x1dd20d2;", "cpu->reset_sctlr = 0x00090078;", "cpu->reset_auxcr = 1;", "{", "ARMCPRegInfo ifar = {", ".name = \"IFAR\", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1,\n.access = PL1_RW,\n.fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[1]),\n.resetvalue = 0\n};", "define_one_arm_cp_reg(cpu, &ifar);", "}", "}" ]
[ 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 ], [ 35 ], [ 37, 39, 41, 43, 45 ], [ 47 ], [ 49 ], [ 51 ] ]
5,037
void msi_uninit(struct PCIDevice *dev) { uint16_t flags; uint8_t cap_size; if (!(dev->cap_present & QEMU_PCI_CAP_MSI)) { return; } flags = pci_get_word(dev->config + msi_flags_off(dev)); cap_size = msi_cap_sizeof(flags); pci_del_capability(dev, PCI_CAP_ID_MSI, cap_size); dev->cap_present &= ~QEMU_PCI_CAP_MSI; MSI_DEV_PRINTF(dev, "uninit\n"); }
false
qemu
44701ab71ad854e6be567a6294f4665f36651076
void msi_uninit(struct PCIDevice *dev) { uint16_t flags; uint8_t cap_size; if (!(dev->cap_present & QEMU_PCI_CAP_MSI)) { return; } flags = pci_get_word(dev->config + msi_flags_off(dev)); cap_size = msi_cap_sizeof(flags); pci_del_capability(dev, PCI_CAP_ID_MSI, cap_size); dev->cap_present &= ~QEMU_PCI_CAP_MSI; MSI_DEV_PRINTF(dev, "uninit\n"); }
{ "code": [], "line_no": [] }
void FUNC_0(struct PCIDevice *VAR_0) { uint16_t flags; uint8_t cap_size; if (!(VAR_0->cap_present & QEMU_PCI_CAP_MSI)) { return; } flags = pci_get_word(VAR_0->config + msi_flags_off(VAR_0)); cap_size = msi_cap_sizeof(flags); pci_del_capability(VAR_0, PCI_CAP_ID_MSI, cap_size); VAR_0->cap_present &= ~QEMU_PCI_CAP_MSI; MSI_DEV_PRINTF(VAR_0, "uninit\n"); }
[ "void FUNC_0(struct PCIDevice *VAR_0)\n{", "uint16_t flags;", "uint8_t cap_size;", "if (!(VAR_0->cap_present & QEMU_PCI_CAP_MSI)) {", "return;", "}", "flags = pci_get_word(VAR_0->config + msi_flags_off(VAR_0));", "cap_size = msi_cap_sizeof(flags);", "pci_del_capability(VAR_0, PCI_CAP_ID_MSI, cap_size);", "VAR_0->cap_present &= ~QEMU_PCI_CAP_MSI;", "MSI_DEV_PRINTF(VAR_0, \"uninit\\n\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
5,038
static uint64_t mv88w8618_pic_read(void *opaque, target_phys_addr_t offset, unsigned size) { mv88w8618_pic_state *s = opaque; switch (offset) { case MP_PIC_STATUS: return s->level & s->enabled; default: return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t mv88w8618_pic_read(void *opaque, target_phys_addr_t offset, unsigned size) { mv88w8618_pic_state *s = opaque; switch (offset) { case MP_PIC_STATUS: return s->level & s->enabled; default: return 0; } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { mv88w8618_pic_state *s = opaque; switch (offset) { case MP_PIC_STATUS: return s->level & s->enabled; default: return 0; } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "mv88w8618_pic_state *s = opaque;", "switch (offset) {", "case MP_PIC_STATUS:\nreturn s->level & s->enabled;", "default:\nreturn 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19, 21 ], [ 23 ], [ 25 ] ]
5,039
static int nic_can_receive(void *opaque) { dp8393xState *s = opaque; if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN)) return 0; if (s->regs[SONIC_ISR] & SONIC_ISR_RBE) return 0; return 1; }
false
qemu
e3f5ec2b5e92706e3b807059f79b1fb5d936e567
static int nic_can_receive(void *opaque) { dp8393xState *s = opaque; if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN)) return 0; if (s->regs[SONIC_ISR] & SONIC_ISR_RBE) return 0; return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { dp8393xState *s = VAR_0; if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN)) return 0; if (s->regs[SONIC_ISR] & SONIC_ISR_RBE) return 0; return 1; }
[ "static int FUNC_0(void *VAR_0)\n{", "dp8393xState *s = VAR_0;", "if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN))\nreturn 0;", "if (s->regs[SONIC_ISR] & SONIC_ISR_RBE)\nreturn 0;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
5,040
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, "sm501.local", local_mem_bytes); vmstate_register_ram_global(&s->local_mem_region); 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, &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, &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, &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_taddr(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(sm501_update_display, NULL, NULL, NULL, s); }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
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, "sm501.local", local_mem_bytes); vmstate_register_ram_global(&s->local_mem_region); 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, &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, &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, &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_taddr(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(sm501_update_display, NULL, NULL, NULL, s); }
{ "code": [], "line_no": [] }
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, "sm501.local", VAR_2); vmstate_register_ram_global(&s->local_mem_region); 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, &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, &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, &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_taddr(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(sm501_update_display, NULL, NULL, NULL, 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, \"sm501.local\",\nVAR_2);", "vmstate_register_ram_global(&s->local_mem_region);", "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, &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, &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, &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_taddr(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(sm501_update_display, NULL,\nNULL, NULL, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 71, 73, 75 ], [ 77, 79 ], [ 81, 83, 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 109 ], [ 111, 113, 115, 117 ], [ 119 ], [ 125, 127 ], [ 129 ] ]
5,042
static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { int idx = -1; HotplugHandlerClass *hhc; Error *local_err = NULL; PCMachineState *pcms = PC_MACHINE(hotplug_dev); pc_find_cpu_slot(pcms, CPU(dev), &idx); assert(idx != -1); if (idx == 0) { error_setg(&local_err, "Boot CPU is unpluggable"); goto out; } if (idx < pcms->possible_cpus->len - 1 && pcms->possible_cpus->cpus[idx + 1].cpu != NULL) { X86CPU *cpu; for (idx = pcms->possible_cpus->len - 1; pcms->possible_cpus->cpus[idx].cpu == NULL; idx--) { ;; } cpu = X86_CPU(pcms->possible_cpus->cpus[idx].cpu); error_setg(&local_err, "CPU [socket-id: %u, core-id: %u," " thread-id: %u] should be removed first", cpu->socket_id, cpu->core_id, cpu->thread_id); goto out; } hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); if (local_err) { goto out; } out: error_propagate(errp, local_err); }
false
qemu
9527e7bde5b59005ddb2d902973915b81b4c5b2c
static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { int idx = -1; HotplugHandlerClass *hhc; Error *local_err = NULL; PCMachineState *pcms = PC_MACHINE(hotplug_dev); pc_find_cpu_slot(pcms, CPU(dev), &idx); assert(idx != -1); if (idx == 0) { error_setg(&local_err, "Boot CPU is unpluggable"); goto out; } if (idx < pcms->possible_cpus->len - 1 && pcms->possible_cpus->cpus[idx + 1].cpu != NULL) { X86CPU *cpu; for (idx = pcms->possible_cpus->len - 1; pcms->possible_cpus->cpus[idx].cpu == NULL; idx--) { ;; } cpu = X86_CPU(pcms->possible_cpus->cpus[idx].cpu); error_setg(&local_err, "CPU [socket-id: %u, core-id: %u," " thread-id: %u] should be removed first", cpu->socket_id, cpu->core_id, cpu->thread_id); goto out; } hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); if (local_err) { goto out; } out: error_propagate(errp, local_err); }
{ "code": [], "line_no": [] }
static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1, Error **VAR_2) { int VAR_3 = -1; HotplugHandlerClass *hhc; Error *local_err = NULL; PCMachineState *pcms = PC_MACHINE(VAR_0); pc_find_cpu_slot(pcms, CPU(VAR_1), &VAR_3); assert(VAR_3 != -1); if (VAR_3 == 0) { error_setg(&local_err, "Boot CPU is unpluggable"); goto out; } if (VAR_3 < pcms->possible_cpus->len - 1 && pcms->possible_cpus->cpus[VAR_3 + 1].cpu != NULL) { X86CPU *cpu; for (VAR_3 = pcms->possible_cpus->len - 1; pcms->possible_cpus->cpus[VAR_3].cpu == NULL; VAR_3--) { ;; } cpu = X86_CPU(pcms->possible_cpus->cpus[VAR_3].cpu); error_setg(&local_err, "CPU [socket-id: %u, core-id: %u," " thread-id: %u] should be removed first", cpu->socket_id, cpu->core_id, cpu->thread_id); goto out; } hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), VAR_1, &local_err); if (local_err) { goto out; } out: error_propagate(VAR_2, local_err); }
[ "static void FUNC_0(HotplugHandler *VAR_0,\nDeviceState *VAR_1, Error **VAR_2)\n{", "int VAR_3 = -1;", "HotplugHandlerClass *hhc;", "Error *local_err = NULL;", "PCMachineState *pcms = PC_MACHINE(VAR_0);", "pc_find_cpu_slot(pcms, CPU(VAR_1), &VAR_3);", "assert(VAR_3 != -1);", "if (VAR_3 == 0) {", "error_setg(&local_err, \"Boot CPU is unpluggable\");", "goto out;", "}", "if (VAR_3 < pcms->possible_cpus->len - 1 &&\npcms->possible_cpus->cpus[VAR_3 + 1].cpu != NULL) {", "X86CPU *cpu;", "for (VAR_3 = pcms->possible_cpus->len - 1;", "pcms->possible_cpus->cpus[VAR_3].cpu == NULL; VAR_3--) {", ";;", "}", "cpu = X86_CPU(pcms->possible_cpus->cpus[VAR_3].cpu);", "error_setg(&local_err, \"CPU [socket-id: %u, core-id: %u,\"\n\" thread-id: %u] should be removed first\",\ncpu->socket_id, cpu->core_id, cpu->thread_id);", "goto out;", "}", "hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);", "hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), VAR_1, &local_err);", "if (local_err) {", "goto out;", "}", "out:\nerror_propagate(VAR_2, local_err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 85 ] ]
5,043
static int smc91c111_can_receive(void *opaque) { smc91c111_state *s = (smc91c111_state *)opaque; if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) return 1; if (s->allocated == (1 << NUM_PACKETS) - 1) return 0; return 1; }
false
qemu
e3f5ec2b5e92706e3b807059f79b1fb5d936e567
static int smc91c111_can_receive(void *opaque) { smc91c111_state *s = (smc91c111_state *)opaque; if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) return 1; if (s->allocated == (1 << NUM_PACKETS) - 1) return 0; return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { smc91c111_state *s = (smc91c111_state *)VAR_0; if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) return 1; if (s->allocated == (1 << NUM_PACKETS) - 1) return 0; return 1; }
[ "static int FUNC_0(void *VAR_0)\n{", "smc91c111_state *s = (smc91c111_state *)VAR_0;", "if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST))\nreturn 1;", "if (s->allocated == (1 << NUM_PACKETS) - 1)\nreturn 0;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
5,045
static void sigchld_bh_handler(void *opaque) { ChildProcessRecord *rec, *next; QLIST_FOREACH_SAFE(rec, &child_watches, next, next) { if (waitpid(rec->pid, NULL, WNOHANG) == rec->pid) { QLIST_REMOVE(rec, next); g_free(rec); } } }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
static void sigchld_bh_handler(void *opaque) { ChildProcessRecord *rec, *next; QLIST_FOREACH_SAFE(rec, &child_watches, next, next) { if (waitpid(rec->pid, NULL, WNOHANG) == rec->pid) { QLIST_REMOVE(rec, next); g_free(rec); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { ChildProcessRecord *rec, *next; QLIST_FOREACH_SAFE(rec, &child_watches, next, next) { if (waitpid(rec->pid, NULL, WNOHANG) == rec->pid) { QLIST_REMOVE(rec, next); g_free(rec); } } }
[ "static void FUNC_0(void *VAR_0)\n{", "ChildProcessRecord *rec, *next;", "QLIST_FOREACH_SAFE(rec, &child_watches, next, next) {", "if (waitpid(rec->pid, NULL, WNOHANG) == rec->pid) {", "QLIST_REMOVE(rec, next);", "g_free(rec);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
5,046
static PCIIDEState *pci_from_bm(BMDMAState *bm) { return bm->pci_dev; }
false
qemu
70ae65f5d91462e1905a53236179fde21cda3a2f
static PCIIDEState *pci_from_bm(BMDMAState *bm) { return bm->pci_dev; }
{ "code": [], "line_no": [] }
static PCIIDEState *FUNC_0(BMDMAState *bm) { return bm->pci_dev; }
[ "static PCIIDEState *FUNC_0(BMDMAState *bm)\n{", "return bm->pci_dev;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,047
static int local_set_mapped_file_attrat(int dirfd, const char *name, FsCred *credp) { FILE *fp; int ret; char buf[ATTR_MAX]; int uid = -1, gid = -1, mode = -1, rdev = -1; int map_dirfd; ret = mkdirat(dirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { return -1; } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); if (map_dirfd == -1) { return -1; } fp = local_fopenat(map_dirfd, name, "r"); if (!fp) { if (errno == ENOENT) { goto update_map_file; } else { close_preserve_errno(map_dirfd); return -1; } } memset(buf, 0, ATTR_MAX); while (fgets(buf, ATTR_MAX, fp)) { if (!strncmp(buf, "virtfs.uid", 10)) { uid = atoi(buf + 11); } else if (!strncmp(buf, "virtfs.gid", 10)) { gid = atoi(buf + 11); } else if (!strncmp(buf, "virtfs.mode", 11)) { mode = atoi(buf + 12); } else if (!strncmp(buf, "virtfs.rdev", 11)) { rdev = atoi(buf + 12); } memset(buf, 0, ATTR_MAX); } fclose(fp); update_map_file: fp = local_fopenat(map_dirfd, name, "w"); close_preserve_errno(map_dirfd); if (!fp) { return -1; } if (credp->fc_uid != -1) { uid = credp->fc_uid; } if (credp->fc_gid != -1) { gid = credp->fc_gid; } if (credp->fc_mode != -1) { mode = credp->fc_mode; } if (credp->fc_rdev != -1) { rdev = credp->fc_rdev; } if (uid != -1) { fprintf(fp, "virtfs.uid=%d\n", uid); } if (gid != -1) { fprintf(fp, "virtfs.gid=%d\n", gid); } if (mode != -1) { fprintf(fp, "virtfs.mode=%d\n", mode); } if (rdev != -1) { fprintf(fp, "virtfs.rdev=%d\n", rdev); } fclose(fp); return 0; }
false
qemu
81ffbf5ab1458e357a761f1272105a55829b351e
static int local_set_mapped_file_attrat(int dirfd, const char *name, FsCred *credp) { FILE *fp; int ret; char buf[ATTR_MAX]; int uid = -1, gid = -1, mode = -1, rdev = -1; int map_dirfd; ret = mkdirat(dirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { return -1; } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); if (map_dirfd == -1) { return -1; } fp = local_fopenat(map_dirfd, name, "r"); if (!fp) { if (errno == ENOENT) { goto update_map_file; } else { close_preserve_errno(map_dirfd); return -1; } } memset(buf, 0, ATTR_MAX); while (fgets(buf, ATTR_MAX, fp)) { if (!strncmp(buf, "virtfs.uid", 10)) { uid = atoi(buf + 11); } else if (!strncmp(buf, "virtfs.gid", 10)) { gid = atoi(buf + 11); } else if (!strncmp(buf, "virtfs.mode", 11)) { mode = atoi(buf + 12); } else if (!strncmp(buf, "virtfs.rdev", 11)) { rdev = atoi(buf + 12); } memset(buf, 0, ATTR_MAX); } fclose(fp); update_map_file: fp = local_fopenat(map_dirfd, name, "w"); close_preserve_errno(map_dirfd); if (!fp) { return -1; } if (credp->fc_uid != -1) { uid = credp->fc_uid; } if (credp->fc_gid != -1) { gid = credp->fc_gid; } if (credp->fc_mode != -1) { mode = credp->fc_mode; } if (credp->fc_rdev != -1) { rdev = credp->fc_rdev; } if (uid != -1) { fprintf(fp, "virtfs.uid=%d\n", uid); } if (gid != -1) { fprintf(fp, "virtfs.gid=%d\n", gid); } if (mode != -1) { fprintf(fp, "virtfs.mode=%d\n", mode); } if (rdev != -1) { fprintf(fp, "virtfs.rdev=%d\n", rdev); } fclose(fp); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, const char *VAR_1, FsCred *VAR_2) { FILE *fp; int VAR_3; char VAR_4[ATTR_MAX]; int VAR_5 = -1, VAR_6 = -1, VAR_7 = -1, VAR_8 = -1; int VAR_9; VAR_3 = mkdirat(VAR_0, VIRTFS_META_DIR, 0700); if (VAR_3 < 0 && errno != EEXIST) { return -1; } VAR_9 = openat_dir(VAR_0, VIRTFS_META_DIR); if (VAR_9 == -1) { return -1; } fp = local_fopenat(VAR_9, VAR_1, "r"); if (!fp) { if (errno == ENOENT) { goto update_map_file; } else { close_preserve_errno(VAR_9); return -1; } } memset(VAR_4, 0, ATTR_MAX); while (fgets(VAR_4, ATTR_MAX, fp)) { if (!strncmp(VAR_4, "virtfs.VAR_5", 10)) { VAR_5 = atoi(VAR_4 + 11); } else if (!strncmp(VAR_4, "virtfs.VAR_6", 10)) { VAR_6 = atoi(VAR_4 + 11); } else if (!strncmp(VAR_4, "virtfs.VAR_7", 11)) { VAR_7 = atoi(VAR_4 + 12); } else if (!strncmp(VAR_4, "virtfs.VAR_8", 11)) { VAR_8 = atoi(VAR_4 + 12); } memset(VAR_4, 0, ATTR_MAX); } fclose(fp); update_map_file: fp = local_fopenat(VAR_9, VAR_1, "w"); close_preserve_errno(VAR_9); if (!fp) { return -1; } if (VAR_2->fc_uid != -1) { VAR_5 = VAR_2->fc_uid; } if (VAR_2->fc_gid != -1) { VAR_6 = VAR_2->fc_gid; } if (VAR_2->fc_mode != -1) { VAR_7 = VAR_2->fc_mode; } if (VAR_2->fc_rdev != -1) { VAR_8 = VAR_2->fc_rdev; } if (VAR_5 != -1) { fprintf(fp, "virtfs.VAR_5=%d\n", VAR_5); } if (VAR_6 != -1) { fprintf(fp, "virtfs.VAR_6=%d\n", VAR_6); } if (VAR_7 != -1) { fprintf(fp, "virtfs.VAR_7=%d\n", VAR_7); } if (VAR_8 != -1) { fprintf(fp, "virtfs.VAR_8=%d\n", VAR_8); } fclose(fp); return 0; }
[ "static int FUNC_0(int VAR_0, const char *VAR_1,\nFsCred *VAR_2)\n{", "FILE *fp;", "int VAR_3;", "char VAR_4[ATTR_MAX];", "int VAR_5 = -1, VAR_6 = -1, VAR_7 = -1, VAR_8 = -1;", "int VAR_9;", "VAR_3 = mkdirat(VAR_0, VIRTFS_META_DIR, 0700);", "if (VAR_3 < 0 && errno != EEXIST) {", "return -1;", "}", "VAR_9 = openat_dir(VAR_0, VIRTFS_META_DIR);", "if (VAR_9 == -1) {", "return -1;", "}", "fp = local_fopenat(VAR_9, VAR_1, \"r\");", "if (!fp) {", "if (errno == ENOENT) {", "goto update_map_file;", "} else {", "close_preserve_errno(VAR_9);", "return -1;", "}", "}", "memset(VAR_4, 0, ATTR_MAX);", "while (fgets(VAR_4, ATTR_MAX, fp)) {", "if (!strncmp(VAR_4, \"virtfs.VAR_5\", 10)) {", "VAR_5 = atoi(VAR_4 + 11);", "} else if (!strncmp(VAR_4, \"virtfs.VAR_6\", 10)) {", "VAR_6 = atoi(VAR_4 + 11);", "} else if (!strncmp(VAR_4, \"virtfs.VAR_7\", 11)) {", "VAR_7 = atoi(VAR_4 + 12);", "} else if (!strncmp(VAR_4, \"virtfs.VAR_8\", 11)) {", "VAR_8 = atoi(VAR_4 + 12);", "}", "memset(VAR_4, 0, ATTR_MAX);", "}", "fclose(fp);", "update_map_file:\nfp = local_fopenat(VAR_9, VAR_1, \"w\");", "close_preserve_errno(VAR_9);", "if (!fp) {", "return -1;", "}", "if (VAR_2->fc_uid != -1) {", "VAR_5 = VAR_2->fc_uid;", "}", "if (VAR_2->fc_gid != -1) {", "VAR_6 = VAR_2->fc_gid;", "}", "if (VAR_2->fc_mode != -1) {", "VAR_7 = VAR_2->fc_mode;", "}", "if (VAR_2->fc_rdev != -1) {", "VAR_8 = VAR_2->fc_rdev;", "}", "if (VAR_5 != -1) {", "fprintf(fp, \"virtfs.VAR_5=%d\\n\", VAR_5);", "}", "if (VAR_6 != -1) {", "fprintf(fp, \"virtfs.VAR_6=%d\\n\", VAR_6);", "}", "if (VAR_7 != -1) {", "fprintf(fp, \"virtfs.VAR_7=%d\\n\", VAR_7);", "}", "if (VAR_8 != -1) {", "fprintf(fp, \"virtfs.VAR_8=%d\\n\", VAR_8);", "}", "fclose(fp);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ] ]
5,049
static void check_ieee_exceptions(CPUSPARCState *env) { target_ulong status; status = get_float_exception_flags(&env->fp_status); if (status) { /* Copy IEEE 754 flags into FSR */ if (status & float_flag_invalid) { env->fsr |= FSR_NVC; } if (status & float_flag_overflow) { env->fsr |= FSR_OFC; } if (status & float_flag_underflow) { env->fsr |= FSR_UFC; } if (status & float_flag_divbyzero) { env->fsr |= FSR_DZC; } if (status & float_flag_inexact) { env->fsr |= FSR_NXC; } if ((env->fsr & FSR_CEXC_MASK) & ((env->fsr & FSR_TEM_MASK) >> 23)) { /* Unmasked exception, generate a trap */ env->fsr |= FSR_FTT_IEEE_EXCP; helper_raise_exception(env, TT_FP_EXCP); } else { /* Accumulate exceptions */ env->fsr |= (env->fsr & FSR_CEXC_MASK) << 5; } } }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
static void check_ieee_exceptions(CPUSPARCState *env) { target_ulong status; status = get_float_exception_flags(&env->fp_status); if (status) { if (status & float_flag_invalid) { env->fsr |= FSR_NVC; } if (status & float_flag_overflow) { env->fsr |= FSR_OFC; } if (status & float_flag_underflow) { env->fsr |= FSR_UFC; } if (status & float_flag_divbyzero) { env->fsr |= FSR_DZC; } if (status & float_flag_inexact) { env->fsr |= FSR_NXC; } if ((env->fsr & FSR_CEXC_MASK) & ((env->fsr & FSR_TEM_MASK) >> 23)) { env->fsr |= FSR_FTT_IEEE_EXCP; helper_raise_exception(env, TT_FP_EXCP); } else { env->fsr |= (env->fsr & FSR_CEXC_MASK) << 5; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUSPARCState *VAR_0) { target_ulong status; status = get_float_exception_flags(&VAR_0->fp_status); if (status) { if (status & float_flag_invalid) { VAR_0->fsr |= FSR_NVC; } if (status & float_flag_overflow) { VAR_0->fsr |= FSR_OFC; } if (status & float_flag_underflow) { VAR_0->fsr |= FSR_UFC; } if (status & float_flag_divbyzero) { VAR_0->fsr |= FSR_DZC; } if (status & float_flag_inexact) { VAR_0->fsr |= FSR_NXC; } if ((VAR_0->fsr & FSR_CEXC_MASK) & ((VAR_0->fsr & FSR_TEM_MASK) >> 23)) { VAR_0->fsr |= FSR_FTT_IEEE_EXCP; helper_raise_exception(VAR_0, TT_FP_EXCP); } else { VAR_0->fsr |= (VAR_0->fsr & FSR_CEXC_MASK) << 5; } } }
[ "static void FUNC_0(CPUSPARCState *VAR_0)\n{", "target_ulong status;", "status = get_float_exception_flags(&VAR_0->fp_status);", "if (status) {", "if (status & float_flag_invalid) {", "VAR_0->fsr |= FSR_NVC;", "}", "if (status & float_flag_overflow) {", "VAR_0->fsr |= FSR_OFC;", "}", "if (status & float_flag_underflow) {", "VAR_0->fsr |= FSR_UFC;", "}", "if (status & float_flag_divbyzero) {", "VAR_0->fsr |= FSR_DZC;", "}", "if (status & float_flag_inexact) {", "VAR_0->fsr |= FSR_NXC;", "}", "if ((VAR_0->fsr & FSR_CEXC_MASK) & ((VAR_0->fsr & FSR_TEM_MASK) >> 23)) {", "VAR_0->fsr |= FSR_FTT_IEEE_EXCP;", "helper_raise_exception(VAR_0, TT_FP_EXCP);", "} else {", "VAR_0->fsr |= (VAR_0->fsr & FSR_CEXC_MASK) << 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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
5,050
static hwaddr ppc_hash64_htab_lookup(PowerPCCPU *cpu, ppc_slb_t *slb, target_ulong eaddr, ppc_hash_pte64_t *pte, unsigned *pshift) { CPUPPCState *env = &cpu->env; hwaddr hash, ptex; uint64_t vsid, epnmask, epn, ptem; const struct ppc_one_seg_page_size *sps = slb->sps; /* The SLB store path should prevent any bad page size encodings * getting in there, so: */ assert(sps); /* If ISL is set in LPCR we need to clamp the page size to 4K */ if (env->spr[SPR_LPCR] & LPCR_ISL) { /* We assume that when using TCG, 4k is first entry of SPS */ sps = &env->sps.sps[0]; assert(sps->page_shift == 12); } epnmask = ~((1ULL << sps->page_shift) - 1); if (slb->vsid & SLB_VSID_B) { /* 1TB segment */ vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T; epn = (eaddr & ~SEGMENT_MASK_1T) & epnmask; hash = vsid ^ (vsid << 25) ^ (epn >> sps->page_shift); } else { /* 256M segment */ vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT; epn = (eaddr & ~SEGMENT_MASK_256M) & epnmask; hash = vsid ^ (epn >> sps->page_shift); } ptem = (slb->vsid & SLB_VSID_PTEM) | ((epn >> 16) & HPTE64_V_AVPN); ptem |= HPTE64_V_VALID; /* Page address translation */ qemu_log_mask(CPU_LOG_MMU, "htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); /* Primary PTEG lookup */ qemu_log_mask(CPU_LOG_MMU, "0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); ptex = ppc_hash64_pteg_search(cpu, hash, sps, ptem, pte, pshift); if (ptex == -1) { /* Secondary PTEG lookup */ ptem |= HPTE64_V_SECONDARY; qemu_log_mask(CPU_LOG_MMU, "1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); ptex = ppc_hash64_pteg_search(cpu, ~hash, sps, ptem, pte, pshift); } return ptex; }
false
qemu
36778660d7fd0748a6129916e47ecedd67bdb758
static hwaddr ppc_hash64_htab_lookup(PowerPCCPU *cpu, ppc_slb_t *slb, target_ulong eaddr, ppc_hash_pte64_t *pte, unsigned *pshift) { CPUPPCState *env = &cpu->env; hwaddr hash, ptex; uint64_t vsid, epnmask, epn, ptem; const struct ppc_one_seg_page_size *sps = slb->sps; assert(sps); if (env->spr[SPR_LPCR] & LPCR_ISL) { sps = &env->sps.sps[0]; assert(sps->page_shift == 12); } epnmask = ~((1ULL << sps->page_shift) - 1); if (slb->vsid & SLB_VSID_B) { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T; epn = (eaddr & ~SEGMENT_MASK_1T) & epnmask; hash = vsid ^ (vsid << 25) ^ (epn >> sps->page_shift); } else { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT; epn = (eaddr & ~SEGMENT_MASK_256M) & epnmask; hash = vsid ^ (epn >> sps->page_shift); } ptem = (slb->vsid & SLB_VSID_PTEM) | ((epn >> 16) & HPTE64_V_AVPN); ptem |= HPTE64_V_VALID; qemu_log_mask(CPU_LOG_MMU, "htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); qemu_log_mask(CPU_LOG_MMU, "0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); ptex = ppc_hash64_pteg_search(cpu, hash, sps, ptem, pte, pshift); if (ptex == -1) { ptem |= HPTE64_V_SECONDARY; qemu_log_mask(CPU_LOG_MMU, "1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); ptex = ppc_hash64_pteg_search(cpu, ~hash, sps, ptem, pte, pshift); } return ptex; }
{ "code": [], "line_no": [] }
static hwaddr FUNC_0(PowerPCCPU *cpu, ppc_slb_t *slb, target_ulong eaddr, ppc_hash_pte64_t *pte, unsigned *pshift) { CPUPPCState *env = &cpu->env; hwaddr hash, ptex; uint64_t vsid, epnmask, epn, ptem; const struct ppc_one_seg_page_size *VAR_0 = slb->VAR_0; assert(VAR_0); if (env->spr[SPR_LPCR] & LPCR_ISL) { VAR_0 = &env->VAR_0.VAR_0[0]; assert(VAR_0->page_shift == 12); } epnmask = ~((1ULL << VAR_0->page_shift) - 1); if (slb->vsid & SLB_VSID_B) { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T; epn = (eaddr & ~SEGMENT_MASK_1T) & epnmask; hash = vsid ^ (vsid << 25) ^ (epn >> VAR_0->page_shift); } else { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT; epn = (eaddr & ~SEGMENT_MASK_256M) & epnmask; hash = vsid ^ (epn >> VAR_0->page_shift); } ptem = (slb->vsid & SLB_VSID_PTEM) | ((epn >> 16) & HPTE64_V_AVPN); ptem |= HPTE64_V_VALID; qemu_log_mask(CPU_LOG_MMU, "htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); qemu_log_mask(CPU_LOG_MMU, "0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); ptex = ppc_hash64_pteg_search(cpu, hash, VAR_0, ptem, pte, pshift); if (ptex == -1) { ptem |= HPTE64_V_SECONDARY; qemu_log_mask(CPU_LOG_MMU, "1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); ptex = ppc_hash64_pteg_search(cpu, ~hash, VAR_0, ptem, pte, pshift); } return ptex; }
[ "static hwaddr FUNC_0(PowerPCCPU *cpu,\nppc_slb_t *slb, target_ulong eaddr,\nppc_hash_pte64_t *pte, unsigned *pshift)\n{", "CPUPPCState *env = &cpu->env;", "hwaddr hash, ptex;", "uint64_t vsid, epnmask, epn, ptem;", "const struct ppc_one_seg_page_size *VAR_0 = slb->VAR_0;", "assert(VAR_0);", "if (env->spr[SPR_LPCR] & LPCR_ISL) {", "VAR_0 = &env->VAR_0.VAR_0[0];", "assert(VAR_0->page_shift == 12);", "}", "epnmask = ~((1ULL << VAR_0->page_shift) - 1);", "if (slb->vsid & SLB_VSID_B) {", "vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T;", "epn = (eaddr & ~SEGMENT_MASK_1T) & epnmask;", "hash = vsid ^ (vsid << 25) ^ (epn >> VAR_0->page_shift);", "} else {", "vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT;", "epn = (eaddr & ~SEGMENT_MASK_256M) & epnmask;", "hash = vsid ^ (epn >> VAR_0->page_shift);", "}", "ptem = (slb->vsid & SLB_VSID_PTEM) | ((epn >> 16) & HPTE64_V_AVPN);", "ptem |= HPTE64_V_VALID;", "qemu_log_mask(CPU_LOG_MMU,\n\"htab_base \" TARGET_FMT_plx \" htab_mask \" TARGET_FMT_plx\n\" hash \" TARGET_FMT_plx \"\\n\",\nenv->htab_base, env->htab_mask, hash);", "qemu_log_mask(CPU_LOG_MMU,\n\"0 htab=\" TARGET_FMT_plx \"/\" TARGET_FMT_plx\n\" vsid=\" TARGET_FMT_lx \" ptem=\" TARGET_FMT_lx\n\" hash=\" TARGET_FMT_plx \"\\n\",\nenv->htab_base, env->htab_mask, vsid, ptem, hash);", "ptex = ppc_hash64_pteg_search(cpu, hash, VAR_0, ptem, pte, pshift);", "if (ptex == -1) {", "ptem |= HPTE64_V_SECONDARY;", "qemu_log_mask(CPU_LOG_MMU,\n\"1 htab=\" TARGET_FMT_plx \"/\" TARGET_FMT_plx\n\" vsid=\" TARGET_FMT_lx \" api=\" TARGET_FMT_lx\n\" hash=\" TARGET_FMT_plx \"\\n\", env->htab_base,\nenv->htab_mask, vsid, ptem, ~hash);", "ptex = ppc_hash64_pteg_search(cpu, ~hash, VAR_0, ptem, pte, pshift);", "}", "return ptex;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75, 77, 79, 81 ], [ 87, 89, 91, 93, 95 ], [ 97 ], [ 101 ], [ 105 ], [ 107, 109, 111, 113, 115 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ] ]
5,053
QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists, Error **errp) { QemuOpts *opts = NULL; if (id) { if (!id_wellformed(id)) { error_set(errp,QERR_INVALID_PARAMETER_VALUE, "id", "an identifier"); #if 0 /* conversion from qerror_report() to error_set() broke this: */ error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n"); #endif return NULL; } opts = qemu_opts_find(list, id); if (opts != NULL) { if (fail_if_exists && !list->merge_lists) { error_setg(errp, "Duplicate ID '%s' for %s", id, list->name); return NULL; } else { return opts; } } } else if (list->merge_lists) { opts = qemu_opts_find(list, NULL); if (opts) { return opts; } } opts = g_malloc0(sizeof(*opts)); opts->id = g_strdup(id); opts->list = list; loc_save(&opts->loc); QTAILQ_INIT(&opts->head); QTAILQ_INSERT_TAIL(&list->head, opts, next); return opts; }
false
qemu
9aebf3b89281a173d2dfeee379b800be5e3f363e
QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists, Error **errp) { QemuOpts *opts = NULL; if (id) { if (!id_wellformed(id)) { error_set(errp,QERR_INVALID_PARAMETER_VALUE, "id", "an identifier"); #if 0 error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n"); #endif return NULL; } opts = qemu_opts_find(list, id); if (opts != NULL) { if (fail_if_exists && !list->merge_lists) { error_setg(errp, "Duplicate ID '%s' for %s", id, list->name); return NULL; } else { return opts; } } } else if (list->merge_lists) { opts = qemu_opts_find(list, NULL); if (opts) { return opts; } } opts = g_malloc0(sizeof(*opts)); opts->id = g_strdup(id); opts->list = list; loc_save(&opts->loc); QTAILQ_INIT(&opts->head); QTAILQ_INSERT_TAIL(&list->head, opts, next); return opts; }
{ "code": [], "line_no": [] }
QemuOpts *FUNC_0(QemuOptsList *list, const char *id, int fail_if_exists, Error **errp) { QemuOpts *opts = NULL; if (id) { if (!id_wellformed(id)) { error_set(errp,QERR_INVALID_PARAMETER_VALUE, "id", "an identifier"); #if 0 error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n"); #endif return NULL; } opts = qemu_opts_find(list, id); if (opts != NULL) { if (fail_if_exists && !list->merge_lists) { error_setg(errp, "Duplicate ID '%s' for %s", id, list->name); return NULL; } else { return opts; } } } else if (list->merge_lists) { opts = qemu_opts_find(list, NULL); if (opts) { return opts; } } opts = g_malloc0(sizeof(*opts)); opts->id = g_strdup(id); opts->list = list; loc_save(&opts->loc); QTAILQ_INIT(&opts->head); QTAILQ_INSERT_TAIL(&list->head, opts, next); return opts; }
[ "QemuOpts *FUNC_0(QemuOptsList *list, const char *id,\nint fail_if_exists, Error **errp)\n{", "QemuOpts *opts = NULL;", "if (id) {", "if (!id_wellformed(id)) {", "error_set(errp,QERR_INVALID_PARAMETER_VALUE, \"id\", \"an identifier\");", "#if 0\nerror_printf_unless_qmp(\"Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\\n\");", "#endif\nreturn NULL;", "}", "opts = qemu_opts_find(list, id);", "if (opts != NULL) {", "if (fail_if_exists && !list->merge_lists) {", "error_setg(errp, \"Duplicate ID '%s' for %s\", id, list->name);", "return NULL;", "} else {", "return opts;", "}", "}", "} else if (list->merge_lists) {", "opts = qemu_opts_find(list, NULL);", "if (opts) {", "return opts;", "}", "}", "opts = g_malloc0(sizeof(*opts));", "opts->id = g_strdup(id);", "opts->list = list;", "loc_save(&opts->loc);", "QTAILQ_INIT(&opts->head);", "QTAILQ_INSERT_TAIL(&list->head, opts, next);", "return opts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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 ] ]
5,056
static int coroutine_fn backup_run_incremental(BackupBlockJob *job) { bool error_is_read; int ret = 0; int clusters_per_iter; uint32_t granularity; int64_t sector; int64_t cluster; int64_t end; int64_t last_cluster = -1; int64_t sectors_per_cluster = cluster_size_sectors(job); BdrvDirtyBitmapIter *dbi; granularity = bdrv_dirty_bitmap_granularity(job->sync_bitmap); clusters_per_iter = MAX((granularity / job->cluster_size), 1); dbi = bdrv_dirty_iter_new(job->sync_bitmap, 0); /* Find the next dirty sector(s) */ while ((sector = bdrv_dirty_iter_next(dbi)) != -1) { cluster = sector / sectors_per_cluster; /* Fake progress updates for any clusters we skipped */ if (cluster != last_cluster + 1) { job->common.offset += ((cluster - last_cluster - 1) * job->cluster_size); } for (end = cluster + clusters_per_iter; cluster < end; cluster++) { do { if (yield_and_check(job)) { goto out; } ret = backup_do_cow(job, cluster * job->cluster_size, job->cluster_size, &error_is_read, false); if ((ret < 0) && backup_error_action(job, error_is_read, -ret) == BLOCK_ERROR_ACTION_REPORT) { goto out; } } while (ret < 0); } /* If the bitmap granularity is smaller than the backup granularity, * we need to advance the iterator pointer to the next cluster. */ if (granularity < job->cluster_size) { bdrv_set_dirty_iter(dbi, cluster * sectors_per_cluster); } last_cluster = cluster - 1; } /* Play some final catchup with the progress meter */ end = DIV_ROUND_UP(job->common.len, job->cluster_size); if (last_cluster + 1 < end) { job->common.offset += ((end - last_cluster - 1) * job->cluster_size); } out: bdrv_dirty_iter_free(dbi); return ret; }
false
qemu
6f8e35e2414433a56b4bd548b87b8ac2aedecb77
static int coroutine_fn backup_run_incremental(BackupBlockJob *job) { bool error_is_read; int ret = 0; int clusters_per_iter; uint32_t granularity; int64_t sector; int64_t cluster; int64_t end; int64_t last_cluster = -1; int64_t sectors_per_cluster = cluster_size_sectors(job); BdrvDirtyBitmapIter *dbi; granularity = bdrv_dirty_bitmap_granularity(job->sync_bitmap); clusters_per_iter = MAX((granularity / job->cluster_size), 1); dbi = bdrv_dirty_iter_new(job->sync_bitmap, 0); while ((sector = bdrv_dirty_iter_next(dbi)) != -1) { cluster = sector / sectors_per_cluster; if (cluster != last_cluster + 1) { job->common.offset += ((cluster - last_cluster - 1) * job->cluster_size); } for (end = cluster + clusters_per_iter; cluster < end; cluster++) { do { if (yield_and_check(job)) { goto out; } ret = backup_do_cow(job, cluster * job->cluster_size, job->cluster_size, &error_is_read, false); if ((ret < 0) && backup_error_action(job, error_is_read, -ret) == BLOCK_ERROR_ACTION_REPORT) { goto out; } } while (ret < 0); } if (granularity < job->cluster_size) { bdrv_set_dirty_iter(dbi, cluster * sectors_per_cluster); } last_cluster = cluster - 1; } end = DIV_ROUND_UP(job->common.len, job->cluster_size); if (last_cluster + 1 < end) { job->common.offset += ((end - last_cluster - 1) * job->cluster_size); } out: bdrv_dirty_iter_free(dbi); return ret; }
{ "code": [], "line_no": [] }
static int VAR_0 backup_run_incremental(BackupBlockJob *job) { bool error_is_read; int ret = 0; int clusters_per_iter; uint32_t granularity; int64_t sector; int64_t cluster; int64_t end; int64_t last_cluster = -1; int64_t sectors_per_cluster = cluster_size_sectors(job); BdrvDirtyBitmapIter *dbi; granularity = bdrv_dirty_bitmap_granularity(job->sync_bitmap); clusters_per_iter = MAX((granularity / job->cluster_size), 1); dbi = bdrv_dirty_iter_new(job->sync_bitmap, 0); while ((sector = bdrv_dirty_iter_next(dbi)) != -1) { cluster = sector / sectors_per_cluster; if (cluster != last_cluster + 1) { job->common.offset += ((cluster - last_cluster - 1) * job->cluster_size); } for (end = cluster + clusters_per_iter; cluster < end; cluster++) { do { if (yield_and_check(job)) { goto out; } ret = backup_do_cow(job, cluster * job->cluster_size, job->cluster_size, &error_is_read, false); if ((ret < 0) && backup_error_action(job, error_is_read, -ret) == BLOCK_ERROR_ACTION_REPORT) { goto out; } } while (ret < 0); } if (granularity < job->cluster_size) { bdrv_set_dirty_iter(dbi, cluster * sectors_per_cluster); } last_cluster = cluster - 1; } end = DIV_ROUND_UP(job->common.len, job->cluster_size); if (last_cluster + 1 < end) { job->common.offset += ((end - last_cluster - 1) * job->cluster_size); } out: bdrv_dirty_iter_free(dbi); return ret; }
[ "static int VAR_0 backup_run_incremental(BackupBlockJob *job)\n{", "bool error_is_read;", "int ret = 0;", "int clusters_per_iter;", "uint32_t granularity;", "int64_t sector;", "int64_t cluster;", "int64_t end;", "int64_t last_cluster = -1;", "int64_t sectors_per_cluster = cluster_size_sectors(job);", "BdrvDirtyBitmapIter *dbi;", "granularity = bdrv_dirty_bitmap_granularity(job->sync_bitmap);", "clusters_per_iter = MAX((granularity / job->cluster_size), 1);", "dbi = bdrv_dirty_iter_new(job->sync_bitmap, 0);", "while ((sector = bdrv_dirty_iter_next(dbi)) != -1) {", "cluster = sector / sectors_per_cluster;", "if (cluster != last_cluster + 1) {", "job->common.offset += ((cluster - last_cluster - 1) *\njob->cluster_size);", "}", "for (end = cluster + clusters_per_iter; cluster < end; cluster++) {", "do {", "if (yield_and_check(job)) {", "goto out;", "}", "ret = backup_do_cow(job, cluster * job->cluster_size,\njob->cluster_size, &error_is_read,\nfalse);", "if ((ret < 0) &&\nbackup_error_action(job, error_is_read, -ret) ==\nBLOCK_ERROR_ACTION_REPORT) {", "goto out;", "}", "} while (ret < 0);", "}", "if (granularity < job->cluster_size) {", "bdrv_set_dirty_iter(dbi, cluster * sectors_per_cluster);", "}", "last_cluster = cluster - 1;", "}", "end = DIV_ROUND_UP(job->common.len, job->cluster_size);", "if (last_cluster + 1 < end) {", "job->common.offset += ((end - last_cluster - 1) * job->cluster_size);", "}", "out:\nbdrv_dirty_iter_free(dbi);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ] ]
5,057
static uint64_t omap_eac_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_eac_s *s = (struct omap_eac_s *) opaque; uint32_t ret; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (addr) { case 0x000: /* CPCFR1 */ return s->config[0]; case 0x004: /* CPCFR2 */ return s->config[1]; case 0x008: /* CPCFR3 */ return s->config[2]; case 0x00c: /* CPCFR4 */ return s->config[3]; case 0x010: /* CPTCTL */ return s->control | ((s->codec.rxavail + s->codec.rxlen > 0) << 7) | ((s->codec.txlen < s->codec.txavail) << 5); case 0x014: /* CPTTADR */ return s->address; case 0x018: /* CPTDATL */ return s->data & 0xff; case 0x01c: /* CPTDATH */ return s->data >> 8; case 0x020: /* CPTVSLL */ return s->vtol; case 0x024: /* CPTVSLH */ return s->vtsl | (3 << 5); /* CRDY1 | CRDY2 */ case 0x040: /* MPCTR */ return s->modem.control; case 0x044: /* MPMCCFR */ return s->modem.config; case 0x060: /* BPCTR */ return s->bt.control; case 0x064: /* BPMCCFR */ return s->bt.config; case 0x080: /* AMSCFR */ return s->mixer; case 0x084: /* AMVCTR */ return s->gain[0]; case 0x088: /* AM1VCTR */ return s->gain[1]; case 0x08c: /* AM2VCTR */ return s->gain[2]; case 0x090: /* AM3VCTR */ return s->gain[3]; case 0x094: /* ASTCTR */ return s->att; case 0x098: /* APD1LCR */ return s->max[0]; case 0x09c: /* APD1RCR */ return s->max[1]; case 0x0a0: /* APD2LCR */ return s->max[2]; case 0x0a4: /* APD2RCR */ return s->max[3]; case 0x0a8: /* APD3LCR */ return s->max[4]; case 0x0ac: /* APD3RCR */ return s->max[5]; case 0x0b0: /* APD4R */ return s->max[6]; case 0x0b4: /* ADWR */ /* This should be write-only? Docs list it as read-only. */ return 0x0000; case 0x0b8: /* ADRDR */ if (likely(s->codec.rxlen > 1)) { ret = s->codec.rxbuf[s->codec.rxoff ++]; s->codec.rxlen --; s->codec.rxoff &= EAC_BUF_LEN - 1; return ret; } else if (s->codec.rxlen) { ret = s->codec.rxbuf[s->codec.rxoff ++]; s->codec.rxlen --; s->codec.rxoff &= EAC_BUF_LEN - 1; if (s->codec.rxavail) omap_eac_in_refill(s); omap_eac_in_dmarequest_update(s); return ret; } return 0x0000; case 0x0bc: /* AGCFR */ return s->codec.config[0]; case 0x0c0: /* AGCTR */ return s->codec.config[1] | ((s->codec.config[1] & 2) << 14); case 0x0c4: /* AGCFR2 */ return s->codec.config[2]; case 0x0c8: /* AGCFR3 */ return s->codec.config[3]; case 0x0cc: /* MBPDMACTR */ case 0x0d0: /* MPDDMARR */ case 0x0d8: /* MPUDMARR */ case 0x0e4: /* BPDDMARR */ case 0x0ec: /* BPUDMARR */ return 0x0000; case 0x100: /* VERSION_NUMBER */ return 0x0010; case 0x104: /* SYSCONFIG */ return s->sysconfig; case 0x108: /* SYSSTATUS */ return 1 | 0xe; /* RESETDONE | stuff */ } OMAP_BAD_REG(addr); return 0; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t omap_eac_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_eac_s *s = (struct omap_eac_s *) opaque; uint32_t ret; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (addr) { case 0x000: return s->config[0]; case 0x004: return s->config[1]; case 0x008: return s->config[2]; case 0x00c: return s->config[3]; case 0x010: return s->control | ((s->codec.rxavail + s->codec.rxlen > 0) << 7) | ((s->codec.txlen < s->codec.txavail) << 5); case 0x014: return s->address; case 0x018: return s->data & 0xff; case 0x01c: return s->data >> 8; case 0x020: return s->vtol; case 0x024: return s->vtsl | (3 << 5); case 0x040: return s->modem.control; case 0x044: return s->modem.config; case 0x060: return s->bt.control; case 0x064: return s->bt.config; case 0x080: return s->mixer; case 0x084: return s->gain[0]; case 0x088: return s->gain[1]; case 0x08c: return s->gain[2]; case 0x090: return s->gain[3]; case 0x094: return s->att; case 0x098: return s->max[0]; case 0x09c: return s->max[1]; case 0x0a0: return s->max[2]; case 0x0a4: return s->max[3]; case 0x0a8: return s->max[4]; case 0x0ac: return s->max[5]; case 0x0b0: return s->max[6]; case 0x0b4: return 0x0000; case 0x0b8: if (likely(s->codec.rxlen > 1)) { ret = s->codec.rxbuf[s->codec.rxoff ++]; s->codec.rxlen --; s->codec.rxoff &= EAC_BUF_LEN - 1; return ret; } else if (s->codec.rxlen) { ret = s->codec.rxbuf[s->codec.rxoff ++]; s->codec.rxlen --; s->codec.rxoff &= EAC_BUF_LEN - 1; if (s->codec.rxavail) omap_eac_in_refill(s); omap_eac_in_dmarequest_update(s); return ret; } return 0x0000; case 0x0bc: return s->codec.config[0]; case 0x0c0: return s->codec.config[1] | ((s->codec.config[1] & 2) << 14); case 0x0c4: return s->codec.config[2]; case 0x0c8: return s->codec.config[3]; case 0x0cc: case 0x0d0: case 0x0d8: case 0x0e4: case 0x0ec: return 0x0000; case 0x100: return 0x0010; case 0x104: return s->sysconfig; case 0x108: return 1 | 0xe; } OMAP_BAD_REG(addr); return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_eac_s *VAR_0 = (struct omap_eac_s *) opaque; uint32_t ret; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (addr) { case 0x000: return VAR_0->config[0]; case 0x004: return VAR_0->config[1]; case 0x008: return VAR_0->config[2]; case 0x00c: return VAR_0->config[3]; case 0x010: return VAR_0->control | ((VAR_0->codec.rxavail + VAR_0->codec.rxlen > 0) << 7) | ((VAR_0->codec.txlen < VAR_0->codec.txavail) << 5); case 0x014: return VAR_0->address; case 0x018: return VAR_0->data & 0xff; case 0x01c: return VAR_0->data >> 8; case 0x020: return VAR_0->vtol; case 0x024: return VAR_0->vtsl | (3 << 5); case 0x040: return VAR_0->modem.control; case 0x044: return VAR_0->modem.config; case 0x060: return VAR_0->bt.control; case 0x064: return VAR_0->bt.config; case 0x080: return VAR_0->mixer; case 0x084: return VAR_0->gain[0]; case 0x088: return VAR_0->gain[1]; case 0x08c: return VAR_0->gain[2]; case 0x090: return VAR_0->gain[3]; case 0x094: return VAR_0->att; case 0x098: return VAR_0->max[0]; case 0x09c: return VAR_0->max[1]; case 0x0a0: return VAR_0->max[2]; case 0x0a4: return VAR_0->max[3]; case 0x0a8: return VAR_0->max[4]; case 0x0ac: return VAR_0->max[5]; case 0x0b0: return VAR_0->max[6]; case 0x0b4: return 0x0000; case 0x0b8: if (likely(VAR_0->codec.rxlen > 1)) { ret = VAR_0->codec.rxbuf[VAR_0->codec.rxoff ++]; VAR_0->codec.rxlen --; VAR_0->codec.rxoff &= EAC_BUF_LEN - 1; return ret; } else if (VAR_0->codec.rxlen) { ret = VAR_0->codec.rxbuf[VAR_0->codec.rxoff ++]; VAR_0->codec.rxlen --; VAR_0->codec.rxoff &= EAC_BUF_LEN - 1; if (VAR_0->codec.rxavail) omap_eac_in_refill(VAR_0); omap_eac_in_dmarequest_update(VAR_0); return ret; } return 0x0000; case 0x0bc: return VAR_0->codec.config[0]; case 0x0c0: return VAR_0->codec.config[1] | ((VAR_0->codec.config[1] & 2) << 14); case 0x0c4: return VAR_0->codec.config[2]; case 0x0c8: return VAR_0->codec.config[3]; case 0x0cc: case 0x0d0: case 0x0d8: case 0x0e4: case 0x0ec: return 0x0000; case 0x100: return 0x0010; case 0x104: return VAR_0->sysconfig; case 0x108: return 1 | 0xe; } OMAP_BAD_REG(addr); return 0; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "struct omap_eac_s *VAR_0 = (struct omap_eac_s *) opaque;", "uint32_t ret;", "if (size != 2) {", "return omap_badwidth_read16(opaque, addr);", "}", "switch (addr) {", "case 0x000:\nreturn VAR_0->config[0];", "case 0x004:\nreturn VAR_0->config[1];", "case 0x008:\nreturn VAR_0->config[2];", "case 0x00c:\nreturn VAR_0->config[3];", "case 0x010:\nreturn VAR_0->control | ((VAR_0->codec.rxavail + VAR_0->codec.rxlen > 0) << 7) |\n((VAR_0->codec.txlen < VAR_0->codec.txavail) << 5);", "case 0x014:\nreturn VAR_0->address;", "case 0x018:\nreturn VAR_0->data & 0xff;", "case 0x01c:\nreturn VAR_0->data >> 8;", "case 0x020:\nreturn VAR_0->vtol;", "case 0x024:\nreturn VAR_0->vtsl | (3 << 5);", "case 0x040:\nreturn VAR_0->modem.control;", "case 0x044:\nreturn VAR_0->modem.config;", "case 0x060:\nreturn VAR_0->bt.control;", "case 0x064:\nreturn VAR_0->bt.config;", "case 0x080:\nreturn VAR_0->mixer;", "case 0x084:\nreturn VAR_0->gain[0];", "case 0x088:\nreturn VAR_0->gain[1];", "case 0x08c:\nreturn VAR_0->gain[2];", "case 0x090:\nreturn VAR_0->gain[3];", "case 0x094:\nreturn VAR_0->att;", "case 0x098:\nreturn VAR_0->max[0];", "case 0x09c:\nreturn VAR_0->max[1];", "case 0x0a0:\nreturn VAR_0->max[2];", "case 0x0a4:\nreturn VAR_0->max[3];", "case 0x0a8:\nreturn VAR_0->max[4];", "case 0x0ac:\nreturn VAR_0->max[5];", "case 0x0b0:\nreturn VAR_0->max[6];", "case 0x0b4:\nreturn 0x0000;", "case 0x0b8:\nif (likely(VAR_0->codec.rxlen > 1)) {", "ret = VAR_0->codec.rxbuf[VAR_0->codec.rxoff ++];", "VAR_0->codec.rxlen --;", "VAR_0->codec.rxoff &= EAC_BUF_LEN - 1;", "return ret;", "} else if (VAR_0->codec.rxlen) {", "ret = VAR_0->codec.rxbuf[VAR_0->codec.rxoff ++];", "VAR_0->codec.rxlen --;", "VAR_0->codec.rxoff &= EAC_BUF_LEN - 1;", "if (VAR_0->codec.rxavail)\nomap_eac_in_refill(VAR_0);", "omap_eac_in_dmarequest_update(VAR_0);", "return ret;", "}", "return 0x0000;", "case 0x0bc:\nreturn VAR_0->codec.config[0];", "case 0x0c0:\nreturn VAR_0->codec.config[1] | ((VAR_0->codec.config[1] & 2) << 14);", "case 0x0c4:\nreturn VAR_0->codec.config[2];", "case 0x0c8:\nreturn VAR_0->codec.config[3];", "case 0x0cc:\ncase 0x0d0:\ncase 0x0d8:\ncase 0x0e4:\ncase 0x0ec:\nreturn 0x0000;", "case 0x100:\nreturn 0x0010;", "case 0x104:\nreturn VAR_0->sysconfig;", "case 0x108:\nreturn 1 | 0xe;", "}", "OMAP_BAD_REG(addr);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 41, 43, 45 ], [ 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, 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 ], [ 205, 207 ], [ 211, 213 ], [ 217, 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ] ]
5,058
static int encode_packets(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno) { int compno, reslevelno, ret; Jpeg2000CodingStyle *codsty = &s->codsty; Jpeg2000QuantStyle *qntsty = &s->qntsty; av_log(s->avctx, AV_LOG_DEBUG, "tier2\n"); // lay-rlevel-comp-pos progression for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ for (compno = 0; compno < s->ncomponents; compno++){ int precno; Jpeg2000ResLevel *reslevel = s->tile[tileno].comp[compno].reslevel + reslevelno; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){ if (ret = encode_packet(s, reslevel, precno, qntsty->expn + (reslevelno ? 3*reslevelno-2 : 0), qntsty->nguardbits)) return ret; } } } av_log(s->avctx, AV_LOG_DEBUG, "after tier2\n"); return 0; }
true
FFmpeg
2580bae54a45d6aaf85ddc5e780389e7e90b2c86
static int encode_packets(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno) { int compno, reslevelno, ret; Jpeg2000CodingStyle *codsty = &s->codsty; Jpeg2000QuantStyle *qntsty = &s->qntsty; av_log(s->avctx, AV_LOG_DEBUG, "tier2\n"); for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ for (compno = 0; compno < s->ncomponents; compno++){ int precno; Jpeg2000ResLevel *reslevel = s->tile[tileno].comp[compno].reslevel + reslevelno; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){ if (ret = encode_packet(s, reslevel, precno, qntsty->expn + (reslevelno ? 3*reslevelno-2 : 0), qntsty->nguardbits)) return ret; } } } av_log(s->avctx, AV_LOG_DEBUG, "after tier2\n"); return 0; }
{ "code": [ " if (ret = encode_packet(s, reslevel, precno, qntsty->expn + (reslevelno ? 3*reslevelno-2 : 0),", " qntsty->nguardbits))" ], "line_no": [ 27, 29 ] }
static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5; Jpeg2000CodingStyle *codsty = &VAR_0->codsty; Jpeg2000QuantStyle *qntsty = &VAR_0->qntsty; av_log(VAR_0->avctx, AV_LOG_DEBUG, "tier2\n"); for (VAR_4 = 0; VAR_4 < codsty->nreslevels; VAR_4++){ for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++){ int precno; Jpeg2000ResLevel *reslevel = VAR_0->VAR_1[VAR_2].comp[VAR_3].reslevel + VAR_4; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){ if (VAR_5 = encode_packet(VAR_0, reslevel, precno, qntsty->expn + (VAR_4 ? 3*VAR_4-2 : 0), qntsty->nguardbits)) return VAR_5; } } } av_log(VAR_0->avctx, AV_LOG_DEBUG, "after tier2\n"); return 0; }
[ "static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "Jpeg2000CodingStyle *codsty = &VAR_0->codsty;", "Jpeg2000QuantStyle *qntsty = &VAR_0->qntsty;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"tier2\\n\");", "for (VAR_4 = 0; VAR_4 < codsty->nreslevels; VAR_4++){", "for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++){", "int precno;", "Jpeg2000ResLevel *reslevel = VAR_0->VAR_1[VAR_2].comp[VAR_3].reslevel + VAR_4;", "for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){", "if (VAR_5 = encode_packet(VAR_0, reslevel, precno, qntsty->expn + (VAR_4 ? 3*VAR_4-2 : 0),\nqntsty->nguardbits))\nreturn VAR_5;", "}", "}", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"after tier2\\n\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
5,059
static void allwinner_ahci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_allwinner_ahci; }
true
qemu
e4f4fb1eca795e36f363b4647724221e774523c1
static void allwinner_ahci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_allwinner_ahci; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->vmsd = &vmstate_allwinner_ahci; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->vmsd = &vmstate_allwinner_ahci;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 16 ] ]
5,061
static QemuOpts *opts_parse(QemuOptsList *list, const char *params, int permit_abbrev, bool defaults) { const char *firstname; char value[1024], *id = NULL; const char *p; QemuOpts *opts; assert(!permit_abbrev || list->implied_opt_name); firstname = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "id=", 3) == 0) { get_opt_value(value, sizeof(value), params+3); id = value; } else if ((p = strstr(params, ",id=")) != NULL) { get_opt_value(value, sizeof(value), p+4); id = value; } if (defaults) { if (!id && !QTAILQ_EMPTY(&list->head)) { opts = qemu_opts_find(list, NULL); } else { opts = qemu_opts_create(list, id, 0); } } else { opts = qemu_opts_create(list, id, 1); } if (opts == NULL) return NULL; if (opts_do_parse(opts, params, firstname, defaults) != 0) { qemu_opts_del(opts); return NULL; } return opts; }
true
qemu
8be7e7e4c72c048b90e3482557954a24bba43ba7
static QemuOpts *opts_parse(QemuOptsList *list, const char *params, int permit_abbrev, bool defaults) { const char *firstname; char value[1024], *id = NULL; const char *p; QemuOpts *opts; assert(!permit_abbrev || list->implied_opt_name); firstname = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "id=", 3) == 0) { get_opt_value(value, sizeof(value), params+3); id = value; } else if ((p = strstr(params, ",id=")) != NULL) { get_opt_value(value, sizeof(value), p+4); id = value; } if (defaults) { if (!id && !QTAILQ_EMPTY(&list->head)) { opts = qemu_opts_find(list, NULL); } else { opts = qemu_opts_create(list, id, 0); } } else { opts = qemu_opts_create(list, id, 1); } if (opts == NULL) return NULL; if (opts_do_parse(opts, params, firstname, defaults) != 0) { qemu_opts_del(opts); return NULL; } return opts; }
{ "code": [ " opts = qemu_opts_create(list, id, 0);", " opts = qemu_opts_create(list, id, 1);", " if (opts == NULL)", " if (opts == NULL)" ], "line_no": [ 45, 51, 55, 55 ] }
static QemuOpts *FUNC_0(QemuOptsList *list, const char *params, int permit_abbrev, bool defaults) { const char *VAR_0; char VAR_1[1024], *VAR_2 = NULL; const char *VAR_3; QemuOpts *opts; assert(!permit_abbrev || list->implied_opt_name); VAR_0 = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "VAR_2=", 3) == 0) { get_opt_value(VAR_1, sizeof(VAR_1), params+3); VAR_2 = VAR_1; } else if ((VAR_3 = strstr(params, ",VAR_2=")) != NULL) { get_opt_value(VAR_1, sizeof(VAR_1), VAR_3+4); VAR_2 = VAR_1; } if (defaults) { if (!VAR_2 && !QTAILQ_EMPTY(&list->head)) { opts = qemu_opts_find(list, NULL); } else { opts = qemu_opts_create(list, VAR_2, 0); } } else { opts = qemu_opts_create(list, VAR_2, 1); } if (opts == NULL) return NULL; if (opts_do_parse(opts, params, VAR_0, defaults) != 0) { qemu_opts_del(opts); return NULL; } return opts; }
[ "static QemuOpts *FUNC_0(QemuOptsList *list, const char *params,\nint permit_abbrev, bool defaults)\n{", "const char *VAR_0;", "char VAR_1[1024], *VAR_2 = NULL;", "const char *VAR_3;", "QemuOpts *opts;", "assert(!permit_abbrev || list->implied_opt_name);", "VAR_0 = permit_abbrev ? list->implied_opt_name : NULL;", "if (strncmp(params, \"VAR_2=\", 3) == 0) {", "get_opt_value(VAR_1, sizeof(VAR_1), params+3);", "VAR_2 = VAR_1;", "} else if ((VAR_3 = strstr(params, \",VAR_2=\")) != NULL) {", "get_opt_value(VAR_1, sizeof(VAR_1), VAR_3+4);", "VAR_2 = VAR_1;", "}", "if (defaults) {", "if (!VAR_2 && !QTAILQ_EMPTY(&list->head)) {", "opts = qemu_opts_find(list, NULL);", "} else {", "opts = qemu_opts_create(list, VAR_2, 0);", "}", "} else {", "opts = qemu_opts_create(list, VAR_2, 1);", "}", "if (opts == NULL)\nreturn NULL;", "if (opts_do_parse(opts, params, VAR_0, defaults) != 0) {", "qemu_opts_del(opts);", "return NULL;", "}", "return opts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ] ]
5,062
static void chomp3(ChannelData *ctx, int16_t *output, uint8_t val, const uint16_t tab1[], const int16_t *tab2, int tab2_stride, uint32_t numChannels) { int16_t current; current = tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val]; current = mace_broken_clip_int16(current + ctx->lev); ctx->lev = current - (current >> 3); *output = QT_8S_2_16S(current); if (( ctx->index += tab1[val]-(ctx->index >> 5) ) < 0) ctx->index = 0; }
true
FFmpeg
f36aec3b5e18c4c167612d0051a6d5b6144b3552
static void chomp3(ChannelData *ctx, int16_t *output, uint8_t val, const uint16_t tab1[], const int16_t *tab2, int tab2_stride, uint32_t numChannels) { int16_t current; current = tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val]; current = mace_broken_clip_int16(current + ctx->lev); ctx->lev = current - (current >> 3); *output = QT_8S_2_16S(current); if (( ctx->index += tab1[val]-(ctx->index >> 5) ) < 0) ctx->index = 0; }
{ "code": [ " current = tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val];", " current = tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val];" ], "line_no": [ 15, 15 ] }
static void FUNC_0(ChannelData *VAR_0, int16_t *VAR_1, uint8_t VAR_2, const uint16_t VAR_3[], const int16_t *VAR_4, int VAR_5, uint32_t VAR_6) { int16_t current; current = VAR_4[((VAR_0->index & 0x7f0) >> 4)*VAR_5 + VAR_2]; current = mace_broken_clip_int16(current + VAR_0->lev); VAR_0->lev = current - (current >> 3); *VAR_1 = QT_8S_2_16S(current); if (( VAR_0->index += VAR_3[VAR_2]-(VAR_0->index >> 5) ) < 0) VAR_0->index = 0; }
[ "static void FUNC_0(ChannelData *VAR_0, int16_t *VAR_1, uint8_t VAR_2,\nconst uint16_t VAR_3[],\nconst int16_t *VAR_4, int VAR_5,\nuint32_t VAR_6)\n{", "int16_t current;", "current = VAR_4[((VAR_0->index & 0x7f0) >> 4)*VAR_5 + VAR_2];", "current = mace_broken_clip_int16(current + VAR_0->lev);", "VAR_0->lev = current - (current >> 3);", "*VAR_1 = QT_8S_2_16S(current);", "if (( VAR_0->index += VAR_3[VAR_2]-(VAR_0->index >> 5) ) < 0)\nVAR_0->index = 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ] ]