id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
9,710
static void readline_completion(ReadLineState *rs) { int len, i, j, max_width, nb_cols, max_prefix; char *cmdline; rs->nb_completions = 0; cmdline = g_malloc(rs->cmd_buf_index + 1); memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index); cmdline[rs->cmd_buf_index] = '\0'; rs->completion_finder(rs->mon, cmdline); g_free(cmdline); /* no completion found */ if (rs->nb_completions <= 0) return; if (rs->nb_completions == 1) { len = strlen(rs->completions[0]); for(i = rs->completion_index; i < len; i++) { readline_insert_char(rs, rs->completions[0][i]); } /* extra space for next argument. XXX: make it more generic */ if (len > 0 && rs->completions[0][len - 1] != '/') readline_insert_char(rs, ' '); } else { monitor_printf(rs->mon, "\n"); max_width = 0; max_prefix = 0; for(i = 0; i < rs->nb_completions; i++) { len = strlen(rs->completions[i]); if (i==0) { max_prefix = len; } else { if (len < max_prefix) max_prefix = len; for(j=0; j<max_prefix; j++) { if (rs->completions[i][j] != rs->completions[0][j]) max_prefix = j; } } if (len > max_width) max_width = len; } if (max_prefix > 0) for(i = rs->completion_index; i < max_prefix; i++) { readline_insert_char(rs, rs->completions[0][i]); } max_width += 2; if (max_width < 10) max_width = 10; else if (max_width > 80) max_width = 80; nb_cols = 80 / max_width; j = 0; for(i = 0; i < rs->nb_completions; i++) { monitor_printf(rs->mon, "%-*s", max_width, rs->completions[i]); if (++j == nb_cols || i == (rs->nb_completions - 1)) { monitor_printf(rs->mon, "\n"); j = 0; } } readline_show_prompt(rs); } for (i = 0; i < rs->nb_completions; i++) { g_free(rs->completions[i]); } }
false
qemu
c60bf3391bf4cb79b7adc6650094e21671ddaabd
static void readline_completion(ReadLineState *rs) { int len, i, j, max_width, nb_cols, max_prefix; char *cmdline; rs->nb_completions = 0; cmdline = g_malloc(rs->cmd_buf_index + 1); memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index); cmdline[rs->cmd_buf_index] = '\0'; rs->completion_finder(rs->mon, cmdline); g_free(cmdline); if (rs->nb_completions <= 0) return; if (rs->nb_completions == 1) { len = strlen(rs->completions[0]); for(i = rs->completion_index; i < len; i++) { readline_insert_char(rs, rs->completions[0][i]); } if (len > 0 && rs->completions[0][len - 1] != '/') readline_insert_char(rs, ' '); } else { monitor_printf(rs->mon, "\n"); max_width = 0; max_prefix = 0; for(i = 0; i < rs->nb_completions; i++) { len = strlen(rs->completions[i]); if (i==0) { max_prefix = len; } else { if (len < max_prefix) max_prefix = len; for(j=0; j<max_prefix; j++) { if (rs->completions[i][j] != rs->completions[0][j]) max_prefix = j; } } if (len > max_width) max_width = len; } if (max_prefix > 0) for(i = rs->completion_index; i < max_prefix; i++) { readline_insert_char(rs, rs->completions[0][i]); } max_width += 2; if (max_width < 10) max_width = 10; else if (max_width > 80) max_width = 80; nb_cols = 80 / max_width; j = 0; for(i = 0; i < rs->nb_completions; i++) { monitor_printf(rs->mon, "%-*s", max_width, rs->completions[i]); if (++j == nb_cols || i == (rs->nb_completions - 1)) { monitor_printf(rs->mon, "\n"); j = 0; } } readline_show_prompt(rs); } for (i = 0; i < rs->nb_completions; i++) { g_free(rs->completions[i]); } }
{ "code": [], "line_no": [] }
static void FUNC_0(ReadLineState *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; char *VAR_7; VAR_0->nb_completions = 0; VAR_7 = g_malloc(VAR_0->cmd_buf_index + 1); memcpy(VAR_7, VAR_0->cmd_buf, VAR_0->cmd_buf_index); VAR_7[VAR_0->cmd_buf_index] = '\0'; VAR_0->completion_finder(VAR_0->mon, VAR_7); g_free(VAR_7); if (VAR_0->nb_completions <= 0) return; if (VAR_0->nb_completions == 1) { VAR_1 = strlen(VAR_0->completions[0]); for(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_1; VAR_2++) { readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]); } if (VAR_1 > 0 && VAR_0->completions[0][VAR_1 - 1] != '/') readline_insert_char(VAR_0, ' '); } else { monitor_printf(VAR_0->mon, "\n"); VAR_4 = 0; VAR_6 = 0; for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) { VAR_1 = strlen(VAR_0->completions[VAR_2]); if (VAR_2==0) { VAR_6 = VAR_1; } else { if (VAR_1 < VAR_6) VAR_6 = VAR_1; for(VAR_3=0; VAR_3<VAR_6; VAR_3++) { if (VAR_0->completions[VAR_2][VAR_3] != VAR_0->completions[0][VAR_3]) VAR_6 = VAR_3; } } if (VAR_1 > VAR_4) VAR_4 = VAR_1; } if (VAR_6 > 0) for(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_6; VAR_2++) { readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]); } VAR_4 += 2; if (VAR_4 < 10) VAR_4 = 10; else if (VAR_4 > 80) VAR_4 = 80; VAR_5 = 80 / VAR_4; VAR_3 = 0; for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) { monitor_printf(VAR_0->mon, "%-*s", VAR_4, VAR_0->completions[VAR_2]); if (++VAR_3 == VAR_5 || VAR_2 == (VAR_0->nb_completions - 1)) { monitor_printf(VAR_0->mon, "\n"); VAR_3 = 0; } } readline_show_prompt(VAR_0); } for (VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) { g_free(VAR_0->completions[VAR_2]); } }
[ "static void FUNC_0(ReadLineState *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "char *VAR_7;", "VAR_0->nb_completions = 0;", "VAR_7 = g_malloc(VAR_0->cmd_buf_index + 1);", "memcpy(VAR_7, VAR_0->cmd_buf, VAR_0->cmd_buf_index);", "VAR_7[VAR_0->cmd_buf_index] = '\\0';", "VAR_0->completion_finder(VAR_0->mon, VAR_7);", "g_free(VAR_7);", "if (VAR_0->nb_completions <= 0)\nreturn;", "if (VAR_0->nb_completions == 1) {", "VAR_1 = strlen(VAR_0->completions[0]);", "for(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_1; VAR_2++) {", "readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]);", "}", "if (VAR_1 > 0 && VAR_0->completions[0][VAR_1 - 1] != '/')\nreadline_insert_char(VAR_0, ' ');", "} else {", "monitor_printf(VAR_0->mon, \"\\n\");", "VAR_4 = 0;", "VAR_6 = 0;", "for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) {", "VAR_1 = strlen(VAR_0->completions[VAR_2]);", "if (VAR_2==0) {", "VAR_6 = VAR_1;", "} else {", "if (VAR_1 < VAR_6)\nVAR_6 = VAR_1;", "for(VAR_3=0; VAR_3<VAR_6; VAR_3++) {", "if (VAR_0->completions[VAR_2][VAR_3] != VAR_0->completions[0][VAR_3])\nVAR_6 = VAR_3;", "}", "}", "if (VAR_1 > VAR_4)\nVAR_4 = VAR_1;", "}", "if (VAR_6 > 0)\nfor(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_6; VAR_2++) {", "readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]);", "}", "VAR_4 += 2;", "if (VAR_4 < 10)\nVAR_4 = 10;", "else if (VAR_4 > 80)\nVAR_4 = 80;", "VAR_5 = 80 / VAR_4;", "VAR_3 = 0;", "for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) {", "monitor_printf(VAR_0->mon, \"%-*s\", VAR_4, VAR_0->completions[VAR_2]);", "if (++VAR_3 == VAR_5 || VAR_2 == (VAR_0->nb_completions - 1)) {", "monitor_printf(VAR_0->mon, \"\\n\");", "VAR_3 = 0;", "}", "}", "readline_show_prompt(VAR_0);", "}", "for (VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) {", "g_free(VAR_0->completions[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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ] ]
9,711
static void tlb_unprotect_code_phys(CPUState *env, ram_addr_t ram_addr, target_ulong vaddr) { phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] |= CODE_DIRTY_FLAG; }
false
qemu
f7c11b535040df31cc8bc3b1f0c33f546073ee62
static void tlb_unprotect_code_phys(CPUState *env, ram_addr_t ram_addr, target_ulong vaddr) { phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] |= CODE_DIRTY_FLAG; }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0, ram_addr_t VAR_1, target_ulong VAR_2) { phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS] |= CODE_DIRTY_FLAG; }
[ "static void FUNC_0(CPUState *VAR_0, ram_addr_t VAR_1,\ntarget_ulong VAR_2)\n{", "phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS] |= CODE_DIRTY_FLAG;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
9,713
float64 helper_fqtod(CPUSPARCState *env) { float64 ret; clear_float_exceptions(env); ret = float128_to_float64(QT1, &env->fp_status); check_ieee_exceptions(env); return ret; }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
float64 helper_fqtod(CPUSPARCState *env) { float64 ret; clear_float_exceptions(env); ret = float128_to_float64(QT1, &env->fp_status); check_ieee_exceptions(env); return ret; }
{ "code": [], "line_no": [] }
float64 FUNC_0(CPUSPARCState *env) { float64 ret; clear_float_exceptions(env); ret = float128_to_float64(QT1, &env->fp_status); check_ieee_exceptions(env); return ret; }
[ "float64 FUNC_0(CPUSPARCState *env)\n{", "float64 ret;", "clear_float_exceptions(env);", "ret = float128_to_float64(QT1, &env->fp_status);", "check_ieee_exceptions(env);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
9,714
static bool vhost_section(MemoryRegionSection *section) { return section->address_space == get_system_memory() && memory_region_is_ram(section->mr); }
false
qemu
0fada67420e29f389119ca6f44285203400e0730
static bool vhost_section(MemoryRegionSection *section) { return section->address_space == get_system_memory() && memory_region_is_ram(section->mr); }
{ "code": [], "line_no": [] }
static bool FUNC_0(MemoryRegionSection *section) { return section->address_space == get_system_memory() && memory_region_is_ram(section->mr); }
[ "static bool FUNC_0(MemoryRegionSection *section)\n{", "return section->address_space == get_system_memory()\n&& memory_region_is_ram(section->mr);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
9,715
static int parse_str(StringInputVisitor *siv, const char *name, Error **errp) { char *str = (char *) siv->string; long long start, end; Range *cur; char *endptr; if (siv->ranges) { return 0; } do { errno = 0; start = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; str = NULL; } else if (*endptr == '-') { str = endptr + 1; errno = 0; end = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str && start <= end && (start > INT64_MAX - 65536 || end < start + 65536)) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; str = NULL; } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } while (str); return 0; error: g_list_foreach(siv->ranges, free_range, NULL); g_list_free(siv->ranges); siv->ranges = NULL; error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); return -1; }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
static int parse_str(StringInputVisitor *siv, const char *name, Error **errp) { char *str = (char *) siv->string; long long start, end; Range *cur; char *endptr; if (siv->ranges) { return 0; } do { errno = 0; start = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; str = NULL; } else if (*endptr == '-') { str = endptr + 1; errno = 0; end = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str && start <= end && (start > INT64_MAX - 65536 || end < start + 65536)) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; str = NULL; } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } while (str); return 0; error: g_list_foreach(siv->ranges, free_range, NULL); g_list_free(siv->ranges); siv->ranges = NULL; error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(StringInputVisitor *VAR_0, const char *VAR_1, Error **VAR_2) { char *VAR_3 = (char *) VAR_0->string; long long VAR_4, VAR_5; Range *cur; char *VAR_6; if (VAR_0->ranges) { return 0; } do { errno = 0; VAR_4 = strtoll(VAR_3, &VAR_6, 0); if (errno == 0 && VAR_6 > VAR_3) { if (*VAR_6 == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_4 + 1; VAR_0->ranges = range_list_insert(VAR_0->ranges, cur); cur = NULL; VAR_3 = NULL; } else if (*VAR_6 == '-') { VAR_3 = VAR_6 + 1; errno = 0; VAR_5 = strtoll(VAR_3, &VAR_6, 0); if (errno == 0 && VAR_6 > VAR_3 && VAR_4 <= VAR_5 && (VAR_4 > INT64_MAX - 65536 || VAR_5 < VAR_4 + 65536)) { if (*VAR_6 == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_5 + 1; VAR_0->ranges = range_list_insert(VAR_0->ranges, cur); cur = NULL; VAR_3 = NULL; } else if (*VAR_6 == ',') { VAR_3 = VAR_6 + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_5 + 1; VAR_0->ranges = range_list_insert(VAR_0->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } else if (*VAR_6 == ',') { VAR_3 = VAR_6 + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_4 + 1; VAR_0->ranges = range_list_insert(VAR_0->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } while (VAR_3); return 0; error: g_list_foreach(VAR_0->ranges, free_range, NULL); g_list_free(VAR_0->ranges); VAR_0->ranges = NULL; error_setg(VAR_2, QERR_INVALID_PARAMETER_VALUE, VAR_1 ? VAR_1 : "null", "an int64 value or range"); return -1; }
[ "static int FUNC_0(StringInputVisitor *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "char *VAR_3 = (char *) VAR_0->string;", "long long VAR_4, VAR_5;", "Range *cur;", "char *VAR_6;", "if (VAR_0->ranges) {", "return 0;", "}", "do {", "errno = 0;", "VAR_4 = strtoll(VAR_3, &VAR_6, 0);", "if (errno == 0 && VAR_6 > VAR_3) {", "if (*VAR_6 == '\\0') {", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_4 + 1;", "VAR_0->ranges = range_list_insert(VAR_0->ranges, cur);", "cur = NULL;", "VAR_3 = NULL;", "} else if (*VAR_6 == '-') {", "VAR_3 = VAR_6 + 1;", "errno = 0;", "VAR_5 = strtoll(VAR_3, &VAR_6, 0);", "if (errno == 0 && VAR_6 > VAR_3 && VAR_4 <= VAR_5 &&\n(VAR_4 > INT64_MAX - 65536 ||\nVAR_5 < VAR_4 + 65536)) {", "if (*VAR_6 == '\\0') {", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_5 + 1;", "VAR_0->ranges = range_list_insert(VAR_0->ranges, cur);", "cur = NULL;", "VAR_3 = NULL;", "} else if (*VAR_6 == ',') {", "VAR_3 = VAR_6 + 1;", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_5 + 1;", "VAR_0->ranges = range_list_insert(VAR_0->ranges, cur);", "cur = NULL;", "} else {", "goto error;", "}", "} else {", "goto error;", "}", "} else if (*VAR_6 == ',') {", "VAR_3 = VAR_6 + 1;", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_4 + 1;", "VAR_0->ranges = range_list_insert(VAR_0->ranges, cur);", "cur = NULL;", "} else {", "goto error;", "}", "} else {", "goto error;", "}", "} while (VAR_3);", "return 0;", "error:\ng_list_foreach(VAR_0->ranges, free_range, NULL);", "g_list_free(VAR_0->ranges);", "VAR_0->ranges = NULL;", "error_setg(VAR_2, QERR_INVALID_PARAMETER_VALUE, VAR_1 ? VAR_1 : \"null\",\n\"an int64 value or range\");", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ] ]
9,716
static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_BFE(mm6); __asm__ volatile( "lea (%3, %3), %%"REG_a" \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" "movq (%1, %3), %%mm2 \n\t" "movq 1(%1, %3), %%mm3 \n\t" PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) "movq %%mm4, (%2) \n\t" "movq %%mm5, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" "movq (%1, %3), %%mm2 \n\t" "movq 1(%1, %3), %%mm3 \n\t" PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) "movq %%mm4, (%2) \n\t" "movq %%mm5, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "subl $4, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels), "+D"(block) :"r"((x86_reg)line_size) :REG_a, "memory"); }
false
FFmpeg
92fabca427ff2d8fffa4bd4f09839d8d3822ef31
static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_BFE(mm6); __asm__ volatile( "lea (%3, %3), %%"REG_a" \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" "movq (%1, %3), %%mm2 \n\t" "movq 1(%1, %3), %%mm3 \n\t" PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) "movq %%mm4, (%2) \n\t" "movq %%mm5, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" "movq (%1, %3), %%mm2 \n\t" "movq 1(%1, %3), %%mm3 \n\t" PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) "movq %%mm4, (%2) \n\t" "movq %%mm5, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "subl $4, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels), "+D"(block) :"r"((x86_reg)line_size) :REG_a, "memory"); }
{ "code": [], "line_no": [] }
static void FUNC_0(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_BFE(mm6); __asm__ volatile( "lea (%3, %3), %%"REG_a" \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" "movq (%1, %3), %%mm2 \n\t" "movq 1(%1, %3), %%mm3 \n\t" PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) "movq %%mm4, (%2) \n\t" "movq %%mm5, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" "movq (%1, %3), %%mm2 \n\t" "movq 1(%1, %3), %%mm3 \n\t" PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) "movq %%mm4, (%2) \n\t" "movq %%mm5, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "subl $4, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels), "+D"(block) :"r"((x86_reg)line_size) :REG_a, "memory"); }
[ "static void FUNC_0(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\n{", "MOVQ_BFE(mm6);", "__asm__ volatile(\n\"lea (%3, %3), %%\"REG_a\" \\n\\t\"\n\".p2align 3 \\n\\t\"\n\"1: \\n\\t\"\n\"movq (%1), %%mm0 \\n\\t\"\n\"movq 1(%1), %%mm1 \\n\\t\"\n\"movq (%1, %3), %%mm2 \\n\\t\"\n\"movq 1(%1, %3), %%mm3 \\n\\t\"\nPAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)\n\"movq %%mm4, (%2) \\n\\t\"\n\"movq %%mm5, (%2, %3) \\n\\t\"\n\"add %%\"REG_a\", %1 \\n\\t\"\n\"add %%\"REG_a\", %2 \\n\\t\"\n\"movq (%1), %%mm0 \\n\\t\"\n\"movq 1(%1), %%mm1 \\n\\t\"\n\"movq (%1, %3), %%mm2 \\n\\t\"\n\"movq 1(%1, %3), %%mm3 \\n\\t\"\nPAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)\n\"movq %%mm4, (%2) \\n\\t\"\n\"movq %%mm5, (%2, %3) \\n\\t\"\n\"add %%\"REG_a\", %1 \\n\\t\"\n\"add %%\"REG_a\", %2 \\n\\t\"\n\"subl $4, %0 \\n\\t\"\n\"jnz 1b \\n\\t\"\n:\"+g\"(h), \"+S\"(pixels), \"+D\"(block)\n:\"r\"((x86_reg)line_size)\n:REG_a, \"memory\");", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59 ], [ 61 ] ]
9,717
static void address_space_update_topology(AddressSpace *as) { FlatView old_view = as->current_map; FlatView new_view = generate_memory_topology(as->root); address_space_update_topology_pass(as, old_view, new_view, false); address_space_update_topology_pass(as, old_view, new_view, true); as->current_map = new_view; flatview_destroy(&old_view); address_space_update_ioeventfds(as); }
true
qemu
8786db7cb96f8ce5c75c6e1e074319c9dca8d356
static void address_space_update_topology(AddressSpace *as) { FlatView old_view = as->current_map; FlatView new_view = generate_memory_topology(as->root); address_space_update_topology_pass(as, old_view, new_view, false); address_space_update_topology_pass(as, old_view, new_view, true); as->current_map = new_view; flatview_destroy(&old_view); address_space_update_ioeventfds(as); }
{ "code": [ " FlatView old_view = as->current_map;", " as->current_map = new_view;" ], "line_no": [ 5, 17 ] }
static void FUNC_0(AddressSpace *VAR_0) { FlatView old_view = VAR_0->current_map; FlatView new_view = generate_memory_topology(VAR_0->root); address_space_update_topology_pass(VAR_0, old_view, new_view, false); address_space_update_topology_pass(VAR_0, old_view, new_view, true); VAR_0->current_map = new_view; flatview_destroy(&old_view); address_space_update_ioeventfds(VAR_0); }
[ "static void FUNC_0(AddressSpace *VAR_0)\n{", "FlatView old_view = VAR_0->current_map;", "FlatView new_view = generate_memory_topology(VAR_0->root);", "address_space_update_topology_pass(VAR_0, old_view, new_view, false);", "address_space_update_topology_pass(VAR_0, old_view, new_view, true);", "VAR_0->current_map = new_view;", "flatview_destroy(&old_view);", "address_space_update_ioeventfds(VAR_0);", "}" ]
[ 0, 1, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
9,718
static int vqf_probe(AVProbeData *probe_packet) { if (AV_RL32(probe_packet->buf) != MKTAG('T','W','I','N')) return 0; if (!memcmp(probe_packet->buf + 4, "97012000", 8)) return AVPROBE_SCORE_MAX; if (!memcmp(probe_packet->buf + 4, "00052200", 8)) return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_EXTENSION; }
true
FFmpeg
e3fc4481b6dd60acdb9f3e370ee9a1d1bd4ddd73
static int vqf_probe(AVProbeData *probe_packet) { if (AV_RL32(probe_packet->buf) != MKTAG('T','W','I','N')) return 0; if (!memcmp(probe_packet->buf + 4, "97012000", 8)) return AVPROBE_SCORE_MAX; if (!memcmp(probe_packet->buf + 4, "00052200", 8)) return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_EXTENSION; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (AV_RL32(VAR_0->buf) != MKTAG('T','W','I','N')) return 0; if (!memcmp(VAR_0->buf + 4, "97012000", 8)) return AVPROBE_SCORE_MAX; if (!memcmp(VAR_0->buf + 4, "00052200", 8)) return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_EXTENSION; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (AV_RL32(VAR_0->buf) != MKTAG('T','W','I','N'))\nreturn 0;", "if (!memcmp(VAR_0->buf + 4, \"97012000\", 8))\nreturn AVPROBE_SCORE_MAX;", "if (!memcmp(VAR_0->buf + 4, \"00052200\", 8))\nreturn AVPROBE_SCORE_MAX;", "return AVPROBE_SCORE_EXTENSION;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ], [ 10 ] ]
9,719
static void boston_platreg_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { if (size != 4) { qemu_log_mask(LOG_UNIMP, "%uB platform register write", size); return; } switch (addr & 0xffff) { case PLAT_FPGA_BUILD: case PLAT_CORE_CL: case PLAT_WRAPPER_CL: case PLAT_DDR3_STATUS: case PLAT_PCIE_STATUS: case PLAT_MMCM_DIV: case PLAT_BUILD_CFG: case PLAT_DDR_CFG: /* read only */ break; case PLAT_SOFTRST_CTL: if (val & PLAT_SOFTRST_CTL_SYSRESET) { qemu_system_reset_request(); } break; default: qemu_log_mask(LOG_UNIMP, "Write platform register 0x%" HWADDR_PRIx " = 0x%" PRIx64, addr & 0xffff, val); break; } }
true
qemu
2d896b454a0e19ec4c1ddbb0e0b65b7e54fcedf3
static void boston_platreg_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { if (size != 4) { qemu_log_mask(LOG_UNIMP, "%uB platform register write", size); return; } switch (addr & 0xffff) { case PLAT_FPGA_BUILD: case PLAT_CORE_CL: case PLAT_WRAPPER_CL: case PLAT_DDR3_STATUS: case PLAT_PCIE_STATUS: case PLAT_MMCM_DIV: case PLAT_BUILD_CFG: case PLAT_DDR_CFG: break; case PLAT_SOFTRST_CTL: if (val & PLAT_SOFTRST_CTL_SYSRESET) { qemu_system_reset_request(); } break; default: qemu_log_mask(LOG_UNIMP, "Write platform register 0x%" HWADDR_PRIx " = 0x%" PRIx64, addr & 0xffff, val); break; } }
{ "code": [ " break;", " break;", " if (size != 4) {", " switch (addr & 0xffff) {", " case PLAT_FPGA_BUILD:", " case PLAT_CORE_CL:", " case PLAT_WRAPPER_CL:", " case PLAT_DDR3_STATUS:", " case PLAT_MMCM_DIV:", " case PLAT_BUILD_CFG:", " case PLAT_DDR_CFG:", " default:", "static void boston_platreg_write(void *opaque, hwaddr addr,", " uint64_t val, unsigned size)", " if (size != 4) {", " qemu_log_mask(LOG_UNIMP, \"%uB platform register write\", size);", " switch (addr & 0xffff) {", " case PLAT_FPGA_BUILD:", " case PLAT_CORE_CL:", " case PLAT_WRAPPER_CL:", " case PLAT_DDR3_STATUS:", " case PLAT_PCIE_STATUS:", " case PLAT_MMCM_DIV:", " case PLAT_BUILD_CFG:", " case PLAT_DDR_CFG:", " break;", " case PLAT_SOFTRST_CTL:", " if (val & PLAT_SOFTRST_CTL_SYSRESET) {", " qemu_system_reset_request();", " break;", " default:", " qemu_log_mask(LOG_UNIMP, \"Write platform register 0x%\" HWADDR_PRIx", " \" = 0x%\" PRIx64, addr & 0xffff, val);", " break;" ], "line_no": [ 37, 37, 7, 17, 19, 21, 23, 25, 29, 31, 33, 49, 1, 3, 7, 9, 17, 19, 21, 23, 25, 27, 29, 31, 33, 37, 39, 41, 43, 37, 49, 51, 53, 37 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { if (VAR_3 != 4) { qemu_log_mask(LOG_UNIMP, "%uB platform register write", VAR_3); return; } switch (VAR_1 & 0xffff) { case PLAT_FPGA_BUILD: case PLAT_CORE_CL: case PLAT_WRAPPER_CL: case PLAT_DDR3_STATUS: case PLAT_PCIE_STATUS: case PLAT_MMCM_DIV: case PLAT_BUILD_CFG: case PLAT_DDR_CFG: break; case PLAT_SOFTRST_CTL: if (VAR_2 & PLAT_SOFTRST_CTL_SYSRESET) { qemu_system_reset_request(); } break; default: qemu_log_mask(LOG_UNIMP, "Write platform register 0x%" HWADDR_PRIx " = 0x%" PRIx64, VAR_1 & 0xffff, VAR_2); break; } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "if (VAR_3 != 4) {", "qemu_log_mask(LOG_UNIMP, \"%uB platform register write\", VAR_3);", "return;", "}", "switch (VAR_1 & 0xffff) {", "case PLAT_FPGA_BUILD:\ncase PLAT_CORE_CL:\ncase PLAT_WRAPPER_CL:\ncase PLAT_DDR3_STATUS:\ncase PLAT_PCIE_STATUS:\ncase PLAT_MMCM_DIV:\ncase PLAT_BUILD_CFG:\ncase PLAT_DDR_CFG:\nbreak;", "case PLAT_SOFTRST_CTL:\nif (VAR_2 & PLAT_SOFTRST_CTL_SYSRESET) {", "qemu_system_reset_request();", "}", "break;", "default:\nqemu_log_mask(LOG_UNIMP, \"Write platform register 0x%\" HWADDR_PRIx\n\" = 0x%\" PRIx64, VAR_1 & 0xffff, VAR_2);", "break;", "}", "}" ]
[ 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 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 ] ]
9,720
static int nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply, int len) { NBDClient *client = req->client; int csock = client->sock; int rc, ret; qemu_co_mutex_lock(&client->send_lock); qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, nbd_restart_write, client); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(csock, reply); if (rc == -1) { rc = -errno; } } else { socket_set_cork(csock, 1); rc = nbd_send_reply(csock, reply); if (rc != -1) { ret = qemu_co_send(csock, req->data, len); if (ret != len) { errno = EIO; rc = -1; } } if (rc == -1) { rc = -errno; } socket_set_cork(csock, 0); } client->send_coroutine = NULL; qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, NULL, client); qemu_co_mutex_unlock(&client->send_lock); return rc; }
true
qemu
94e7340b5db8bce7866e44e700ffa8fd26585c7e
static int nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply, int len) { NBDClient *client = req->client; int csock = client->sock; int rc, ret; qemu_co_mutex_lock(&client->send_lock); qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, nbd_restart_write, client); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(csock, reply); if (rc == -1) { rc = -errno; } } else { socket_set_cork(csock, 1); rc = nbd_send_reply(csock, reply); if (rc != -1) { ret = qemu_co_send(csock, req->data, len); if (ret != len) { errno = EIO; rc = -1; } } if (rc == -1) { rc = -errno; } socket_set_cork(csock, 0); } client->send_coroutine = NULL; qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, NULL, client); qemu_co_mutex_unlock(&client->send_lock); return rc; }
{ "code": [ "static int nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply,", " int len)", " int rc, ret;" ], "line_no": [ 1, 3, 11 ] }
static int FUNC_0(NBDRequest *VAR_0, struct nbd_reply *VAR_1, int VAR_2) { NBDClient *client = VAR_0->client; int VAR_3 = client->sock; int VAR_4, VAR_5; qemu_co_mutex_lock(&client->send_lock); qemu_set_fd_handler2(VAR_3, nbd_can_read, nbd_read, nbd_restart_write, client); client->send_coroutine = qemu_coroutine_self(); if (!VAR_2) { VAR_4 = nbd_send_reply(VAR_3, VAR_1); if (VAR_4 == -1) { VAR_4 = -errno; } } else { socket_set_cork(VAR_3, 1); VAR_4 = nbd_send_reply(VAR_3, VAR_1); if (VAR_4 != -1) { VAR_5 = qemu_co_send(VAR_3, VAR_0->data, VAR_2); if (VAR_5 != VAR_2) { errno = EIO; VAR_4 = -1; } } if (VAR_4 == -1) { VAR_4 = -errno; } socket_set_cork(VAR_3, 0); } client->send_coroutine = NULL; qemu_set_fd_handler2(VAR_3, nbd_can_read, nbd_read, NULL, client); qemu_co_mutex_unlock(&client->send_lock); return VAR_4; }
[ "static int FUNC_0(NBDRequest *VAR_0, struct nbd_reply *VAR_1,\nint VAR_2)\n{", "NBDClient *client = VAR_0->client;", "int VAR_3 = client->sock;", "int VAR_4, VAR_5;", "qemu_co_mutex_lock(&client->send_lock);", "qemu_set_fd_handler2(VAR_3, nbd_can_read, nbd_read,\nnbd_restart_write, client);", "client->send_coroutine = qemu_coroutine_self();", "if (!VAR_2) {", "VAR_4 = nbd_send_reply(VAR_3, VAR_1);", "if (VAR_4 == -1) {", "VAR_4 = -errno;", "}", "} else {", "socket_set_cork(VAR_3, 1);", "VAR_4 = nbd_send_reply(VAR_3, VAR_1);", "if (VAR_4 != -1) {", "VAR_5 = qemu_co_send(VAR_3, VAR_0->data, VAR_2);", "if (VAR_5 != VAR_2) {", "errno = EIO;", "VAR_4 = -1;", "}", "}", "if (VAR_4 == -1) {", "VAR_4 = -errno;", "}", "socket_set_cork(VAR_3, 0);", "}", "client->send_coroutine = NULL;", "qemu_set_fd_handler2(VAR_3, nbd_can_read, nbd_read, NULL, client);", "qemu_co_mutex_unlock(&client->send_lock);", "return VAR_4;", "}" ]
[ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
9,723
static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) { const uint8_t *buf_ptr, *end_ptr; uint8_t *data_ptr; int i; if (length > 61444) /* worst case PAL 1920 samples 8 channels */ return -1; av_new_packet(pkt, length); avio_read(pb, pkt->data, length); data_ptr = pkt->data; end_ptr = pkt->data + length; buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */ for (; buf_ptr < end_ptr; ) { for (i = 0; i < st->codec->channels; i++) { uint32_t sample = bytestream_get_le32(&buf_ptr); if (st->codec->bits_per_coded_sample == 24) bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff); else bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff); } buf_ptr += 32 - st->codec->channels*4; // always 8 channels stored SMPTE 331M } pkt->size = data_ptr - pkt->data; return 0; }
true
FFmpeg
0c46e958d1fd3817b8e9fa048d0450d509c80378
static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) { const uint8_t *buf_ptr, *end_ptr; uint8_t *data_ptr; int i; if (length > 61444) return -1; av_new_packet(pkt, length); avio_read(pb, pkt->data, length); data_ptr = pkt->data; end_ptr = pkt->data + length; buf_ptr = pkt->data + 4; for (; buf_ptr < end_ptr; ) { for (i = 0; i < st->codec->channels; i++) { uint32_t sample = bytestream_get_le32(&buf_ptr); if (st->codec->bits_per_coded_sample == 24) bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff); else bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff); } buf_ptr += 32 - st->codec->channels*4; } pkt->size = data_ptr - pkt->data; return 0; }
{ "code": [ " av_new_packet(pkt, length);", " avio_read(pb, pkt->data, length);", " for (; buf_ptr < end_ptr; ) {", " pkt->size = data_ptr - pkt->data;" ], "line_no": [ 17, 19, 27, 47 ] }
static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1, AVPacket *VAR_2, int64_t VAR_3) { const uint8_t *VAR_4, *end_ptr; uint8_t *data_ptr; int VAR_5; if (VAR_3 > 61444) return -1; av_new_packet(VAR_2, VAR_3); avio_read(VAR_0, VAR_2->data, VAR_3); data_ptr = VAR_2->data; end_ptr = VAR_2->data + VAR_3; VAR_4 = VAR_2->data + 4; for (; VAR_4 < end_ptr; ) { for (VAR_5 = 0; VAR_5 < VAR_1->codec->channels; VAR_5++) { uint32_t sample = bytestream_get_le32(&VAR_4); if (VAR_1->codec->bits_per_coded_sample == 24) bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff); else bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff); } VAR_4 += 32 - VAR_1->codec->channels*4; } VAR_2->size = data_ptr - VAR_2->data; return 0; }
[ "static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1, AVPacket *VAR_2, int64_t VAR_3)\n{", "const uint8_t *VAR_4, *end_ptr;", "uint8_t *data_ptr;", "int VAR_5;", "if (VAR_3 > 61444)\nreturn -1;", "av_new_packet(VAR_2, VAR_3);", "avio_read(VAR_0, VAR_2->data, VAR_3);", "data_ptr = VAR_2->data;", "end_ptr = VAR_2->data + VAR_3;", "VAR_4 = VAR_2->data + 4;", "for (; VAR_4 < end_ptr; ) {", "for (VAR_5 = 0; VAR_5 < VAR_1->codec->channels; VAR_5++) {", "uint32_t sample = bytestream_get_le32(&VAR_4);", "if (VAR_1->codec->bits_per_coded_sample == 24)\nbytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff);", "else\nbytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff);", "}", "VAR_4 += 32 - VAR_1->codec->channels*4;", "}", "VAR_2->size = data_ptr - VAR_2->data;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
9,724
static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, uint8_t * buf, int buf_size) { AVSContext *h = avctx->priv_data; MpegEncContext *s = &h->s; int input_size; const uint8_t *buf_end; const uint8_t *buf_ptr; AVFrame *picture = data; uint32_t stc; s->avctx = avctx; if (buf_size == 0) { if(!s->low_delay && h->DPB[0].data[0]) { *data_size = sizeof(AVPicture); *picture = *(AVFrame *) &h->DPB[0]; } return 0; } buf_ptr = buf; buf_end = buf + buf_size; for(;;) { buf_ptr = ff_find_start_code(buf_ptr,buf_end, &stc); if(stc & 0xFFFFFE00) return FFMAX(0, buf_ptr - buf - s->parse_context.last_index); input_size = (buf_end - buf_ptr)*8; switch(stc) { case CAVS_START_CODE: init_get_bits(&s->gb, buf_ptr, input_size); decode_seq_header(h); break; case PIC_I_START_CODE: if(!h->got_keyframe) { if(h->DPB[0].data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]); if(h->DPB[1].data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]); h->got_keyframe = 1; } case PIC_PB_START_CODE: *data_size = 0; if(!h->got_keyframe) break; init_get_bits(&s->gb, buf_ptr, input_size); h->stc = stc; if(decode_pic(h)) break; *data_size = sizeof(AVPicture); if(h->pic_type != FF_B_TYPE) { if(h->DPB[1].data[0]) { *picture = *(AVFrame *) &h->DPB[1]; } else { *data_size = 0; } } else *picture = *(AVFrame *) &h->picture; break; case EXT_START_CODE: //mpeg_decode_extension(avctx,buf_ptr, input_size); break; case USER_START_CODE: //mpeg_decode_user_data(avctx,buf_ptr, input_size); break; default: if (stc >= SLICE_MIN_START_CODE && stc <= SLICE_MAX_START_CODE) { init_get_bits(&s->gb, buf_ptr, input_size); decode_slice_header(h, &s->gb); } break; } } }
false
FFmpeg
e02f7490da1ce126c679e513791071e56617b69a
static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, uint8_t * buf, int buf_size) { AVSContext *h = avctx->priv_data; MpegEncContext *s = &h->s; int input_size; const uint8_t *buf_end; const uint8_t *buf_ptr; AVFrame *picture = data; uint32_t stc; s->avctx = avctx; if (buf_size == 0) { if(!s->low_delay && h->DPB[0].data[0]) { *data_size = sizeof(AVPicture); *picture = *(AVFrame *) &h->DPB[0]; } return 0; } buf_ptr = buf; buf_end = buf + buf_size; for(;;) { buf_ptr = ff_find_start_code(buf_ptr,buf_end, &stc); if(stc & 0xFFFFFE00) return FFMAX(0, buf_ptr - buf - s->parse_context.last_index); input_size = (buf_end - buf_ptr)*8; switch(stc) { case CAVS_START_CODE: init_get_bits(&s->gb, buf_ptr, input_size); decode_seq_header(h); break; case PIC_I_START_CODE: if(!h->got_keyframe) { if(h->DPB[0].data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]); if(h->DPB[1].data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]); h->got_keyframe = 1; } case PIC_PB_START_CODE: *data_size = 0; if(!h->got_keyframe) break; init_get_bits(&s->gb, buf_ptr, input_size); h->stc = stc; if(decode_pic(h)) break; *data_size = sizeof(AVPicture); if(h->pic_type != FF_B_TYPE) { if(h->DPB[1].data[0]) { *picture = *(AVFrame *) &h->DPB[1]; } else { *data_size = 0; } } else *picture = *(AVFrame *) &h->picture; break; case EXT_START_CODE: break; case USER_START_CODE: break; default: if (stc >= SLICE_MIN_START_CODE && stc <= SLICE_MAX_START_CODE) { init_get_bits(&s->gb, buf_ptr, input_size); decode_slice_header(h, &s->gb); } break; } } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0,void *VAR_1, int *VAR_2, uint8_t * VAR_3, int VAR_4) { AVSContext *h = VAR_0->priv_data; MpegEncContext *s = &h->s; int VAR_5; const uint8_t *VAR_6; const uint8_t *VAR_7; AVFrame *picture = VAR_1; uint32_t stc; s->VAR_0 = VAR_0; if (VAR_4 == 0) { if(!s->low_delay && h->DPB[0].VAR_1[0]) { *VAR_2 = sizeof(AVPicture); *picture = *(AVFrame *) &h->DPB[0]; } return 0; } VAR_7 = VAR_3; VAR_6 = VAR_3 + VAR_4; for(;;) { VAR_7 = ff_find_start_code(VAR_7,VAR_6, &stc); if(stc & 0xFFFFFE00) return FFMAX(0, VAR_7 - VAR_3 - s->parse_context.last_index); VAR_5 = (VAR_6 - VAR_7)*8; switch(stc) { case CAVS_START_CODE: init_get_bits(&s->gb, VAR_7, VAR_5); decode_seq_header(h); break; case PIC_I_START_CODE: if(!h->got_keyframe) { if(h->DPB[0].VAR_1[0]) VAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[0]); if(h->DPB[1].VAR_1[0]) VAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[1]); h->got_keyframe = 1; } case PIC_PB_START_CODE: *VAR_2 = 0; if(!h->got_keyframe) break; init_get_bits(&s->gb, VAR_7, VAR_5); h->stc = stc; if(decode_pic(h)) break; *VAR_2 = sizeof(AVPicture); if(h->pic_type != FF_B_TYPE) { if(h->DPB[1].VAR_1[0]) { *picture = *(AVFrame *) &h->DPB[1]; } else { *VAR_2 = 0; } } else *picture = *(AVFrame *) &h->picture; break; case EXT_START_CODE: break; case USER_START_CODE: break; default: if (stc >= SLICE_MIN_START_CODE && stc <= SLICE_MAX_START_CODE) { init_get_bits(&s->gb, VAR_7, VAR_5); decode_slice_header(h, &s->gb); } break; } } }
[ "static int FUNC_0(AVCodecContext * VAR_0,void *VAR_1, int *VAR_2,\nuint8_t * VAR_3, int VAR_4) {", "AVSContext *h = VAR_0->priv_data;", "MpegEncContext *s = &h->s;", "int VAR_5;", "const uint8_t *VAR_6;", "const uint8_t *VAR_7;", "AVFrame *picture = VAR_1;", "uint32_t stc;", "s->VAR_0 = VAR_0;", "if (VAR_4 == 0) {", "if(!s->low_delay && h->DPB[0].VAR_1[0]) {", "*VAR_2 = sizeof(AVPicture);", "*picture = *(AVFrame *) &h->DPB[0];", "}", "return 0;", "}", "VAR_7 = VAR_3;", "VAR_6 = VAR_3 + VAR_4;", "for(;;) {", "VAR_7 = ff_find_start_code(VAR_7,VAR_6, &stc);", "if(stc & 0xFFFFFE00)\nreturn FFMAX(0, VAR_7 - VAR_3 - s->parse_context.last_index);", "VAR_5 = (VAR_6 - VAR_7)*8;", "switch(stc) {", "case CAVS_START_CODE:\ninit_get_bits(&s->gb, VAR_7, VAR_5);", "decode_seq_header(h);", "break;", "case PIC_I_START_CODE:\nif(!h->got_keyframe) {", "if(h->DPB[0].VAR_1[0])\nVAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[0]);", "if(h->DPB[1].VAR_1[0])\nVAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[1]);", "h->got_keyframe = 1;", "}", "case PIC_PB_START_CODE:\n*VAR_2 = 0;", "if(!h->got_keyframe)\nbreak;", "init_get_bits(&s->gb, VAR_7, VAR_5);", "h->stc = stc;", "if(decode_pic(h))\nbreak;", "*VAR_2 = sizeof(AVPicture);", "if(h->pic_type != FF_B_TYPE) {", "if(h->DPB[1].VAR_1[0]) {", "*picture = *(AVFrame *) &h->DPB[1];", "} else {", "*VAR_2 = 0;", "}", "} else", "*picture = *(AVFrame *) &h->picture;", "break;", "case EXT_START_CODE:\nbreak;", "case USER_START_CODE:\nbreak;", "default:\nif (stc >= SLICE_MIN_START_CODE &&\nstc <= SLICE_MAX_START_CODE) {", "init_get_bits(&s->gb, VAR_7, VAR_5);", "decode_slice_header(h, &s->gb);", "}", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 121 ], [ 123, 127 ], [ 129, 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ] ]
9,725
static int decode_end(AVCodecContext *avctx) { SmackVContext * const smk = (SmackVContext *)avctx->priv_data; if(smk->mmap_tbl) av_free(smk->mmap_tbl); if(smk->mclr_tbl) av_free(smk->mclr_tbl); if(smk->full_tbl) av_free(smk->full_tbl); if(smk->type_tbl) av_free(smk->type_tbl); if (smk->pic.data[0]) avctx->release_buffer(avctx, &smk->pic); return 0; }
false
FFmpeg
34a8dcd031d637273cdea021e5a79cf720c4c51c
static int decode_end(AVCodecContext *avctx) { SmackVContext * const smk = (SmackVContext *)avctx->priv_data; if(smk->mmap_tbl) av_free(smk->mmap_tbl); if(smk->mclr_tbl) av_free(smk->mclr_tbl); if(smk->full_tbl) av_free(smk->full_tbl); if(smk->type_tbl) av_free(smk->type_tbl); if (smk->pic.data[0]) avctx->release_buffer(avctx, &smk->pic); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { SmackVContext * const smk = (SmackVContext *)VAR_0->priv_data; if(smk->mmap_tbl) av_free(smk->mmap_tbl); if(smk->mclr_tbl) av_free(smk->mclr_tbl); if(smk->full_tbl) av_free(smk->full_tbl); if(smk->type_tbl) av_free(smk->type_tbl); if (smk->pic.data[0]) VAR_0->release_buffer(VAR_0, &smk->pic); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "SmackVContext * const smk = (SmackVContext *)VAR_0->priv_data;", "if(smk->mmap_tbl)\nav_free(smk->mmap_tbl);", "if(smk->mclr_tbl)\nav_free(smk->mclr_tbl);", "if(smk->full_tbl)\nav_free(smk->full_tbl);", "if(smk->type_tbl)\nav_free(smk->type_tbl);", "if (smk->pic.data[0])\nVAR_0->release_buffer(VAR_0, &smk->pic);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 27, 29 ], [ 33 ], [ 35 ] ]
9,726
static void test_sum_square(void) { INTFLOAT res0; INTFLOAT res1; LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]); declare_func(INTFLOAT, INTFLOAT (*x)[2], int n); randomize((INTFLOAT *)src, 256 * 2); res0 = call_ref(src, 256); res1 = call_new(src, 256); if (!float_near_abs_eps(res0, res1, EPS)) fail(); bench_new(src, 256); }
false
FFmpeg
3d3243577cfdca6dec39a8c4e75feefd2a170f90
static void test_sum_square(void) { INTFLOAT res0; INTFLOAT res1; LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]); declare_func(INTFLOAT, INTFLOAT (*x)[2], int n); randomize((INTFLOAT *)src, 256 * 2); res0 = call_ref(src, 256); res1 = call_new(src, 256); if (!float_near_abs_eps(res0, res1, EPS)) fail(); bench_new(src, 256); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { INTFLOAT res0; INTFLOAT res1; LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]); declare_func(INTFLOAT, INTFLOAT (*x)[2], int n); randomize((INTFLOAT *)src, 256 * 2); res0 = call_ref(src, 256); res1 = call_new(src, 256); if (!float_near_abs_eps(res0, res1, EPS)) fail(); bench_new(src, 256); }
[ "static void FUNC_0(void)\n{", "INTFLOAT res0;", "INTFLOAT res1;", "LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]);", "declare_func(INTFLOAT, INTFLOAT (*x)[2], int n);", "randomize((INTFLOAT *)src, 256 * 2);", "res0 = call_ref(src, 256);", "res1 = call_new(src, 256);", "if (!float_near_abs_eps(res0, res1, EPS))\nfail();", "bench_new(src, 256);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ] ]
9,728
static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order) { int i, tmp, partition, method_type, rice_order; int rice_bits, rice_esc; int samples; method_type = get_bits(&s->gb, 2); if (method_type > 1) { av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n", method_type); return AVERROR_INVALIDDATA; } rice_order = get_bits(&s->gb, 4); samples= s->blocksize >> rice_order; if (samples << rice_order != s->blocksize) { av_log(s->avctx, AV_LOG_ERROR, "invalid rice order: %i blocksize %i\n", rice_order, s->blocksize); return AVERROR_INVALIDDATA; } if (pred_order > samples) { av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n", pred_order, samples); return AVERROR_INVALIDDATA; } rice_bits = 4 + method_type; rice_esc = (1 << rice_bits) - 1; decoded += pred_order; i= pred_order; for (partition = 0; partition < (1 << rice_order); partition++) { tmp = get_bits(&s->gb, rice_bits); if (tmp == rice_esc) { tmp = get_bits(&s->gb, 5); for (; i < samples; i++) *decoded++ = get_sbits_long(&s->gb, tmp); } else { for (; i < samples; i++) { *decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0); } } i= 0; } return 0; }
false
FFmpeg
fd00203554334f602ee1d7c5416ff25f356f4fb7
static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order) { int i, tmp, partition, method_type, rice_order; int rice_bits, rice_esc; int samples; method_type = get_bits(&s->gb, 2); if (method_type > 1) { av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n", method_type); return AVERROR_INVALIDDATA; } rice_order = get_bits(&s->gb, 4); samples= s->blocksize >> rice_order; if (samples << rice_order != s->blocksize) { av_log(s->avctx, AV_LOG_ERROR, "invalid rice order: %i blocksize %i\n", rice_order, s->blocksize); return AVERROR_INVALIDDATA; } if (pred_order > samples) { av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n", pred_order, samples); return AVERROR_INVALIDDATA; } rice_bits = 4 + method_type; rice_esc = (1 << rice_bits) - 1; decoded += pred_order; i= pred_order; for (partition = 0; partition < (1 << rice_order); partition++) { tmp = get_bits(&s->gb, rice_bits); if (tmp == rice_esc) { tmp = get_bits(&s->gb, 5); for (; i < samples; i++) *decoded++ = get_sbits_long(&s->gb, tmp); } else { for (; i < samples; i++) { *decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0); } } i= 0; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FLACContext *VAR_0, int32_t *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8, VAR_9; int VAR_10; VAR_6 = get_bits(&VAR_0->gb, 2); if (VAR_6 > 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n", VAR_6); return AVERROR_INVALIDDATA; } VAR_7 = get_bits(&VAR_0->gb, 4); VAR_10= VAR_0->blocksize >> VAR_7; if (VAR_10 << VAR_7 != VAR_0->blocksize) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid rice order: %VAR_3 blocksize %VAR_3\n", VAR_7, VAR_0->blocksize); return AVERROR_INVALIDDATA; } if (VAR_2 > VAR_10) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid predictor order: %VAR_3 > %VAR_3\n", VAR_2, VAR_10); return AVERROR_INVALIDDATA; } VAR_8 = 4 + VAR_6; VAR_9 = (1 << VAR_8) - 1; VAR_1 += VAR_2; VAR_3= VAR_2; for (VAR_5 = 0; VAR_5 < (1 << VAR_7); VAR_5++) { VAR_4 = get_bits(&VAR_0->gb, VAR_8); if (VAR_4 == VAR_9) { VAR_4 = get_bits(&VAR_0->gb, 5); for (; VAR_3 < VAR_10; VAR_3++) *VAR_1++ = get_sbits_long(&VAR_0->gb, VAR_4); } else { for (; VAR_3 < VAR_10; VAR_3++) { *VAR_1++ = get_sr_golomb_flac(&VAR_0->gb, VAR_4, INT_MAX, 0); } } VAR_3= 0; } return 0; }
[ "static int FUNC_0(FLACContext *VAR_0, int32_t *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "int VAR_8, VAR_9;", "int VAR_10;", "VAR_6 = get_bits(&VAR_0->gb, 2);", "if (VAR_6 > 1) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal residual coding method %d\\n\",\nVAR_6);", "return AVERROR_INVALIDDATA;", "}", "VAR_7 = get_bits(&VAR_0->gb, 4);", "VAR_10= VAR_0->blocksize >> VAR_7;", "if (VAR_10 << VAR_7 != VAR_0->blocksize) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid rice order: %VAR_3 blocksize %VAR_3\\n\",\nVAR_7, VAR_0->blocksize);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_2 > VAR_10) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid predictor order: %VAR_3 > %VAR_3\\n\",\nVAR_2, VAR_10);", "return AVERROR_INVALIDDATA;", "}", "VAR_8 = 4 + VAR_6;", "VAR_9 = (1 << VAR_8) - 1;", "VAR_1 += VAR_2;", "VAR_3= VAR_2;", "for (VAR_5 = 0; VAR_5 < (1 << VAR_7); VAR_5++) {", "VAR_4 = get_bits(&VAR_0->gb, VAR_8);", "if (VAR_4 == VAR_9) {", "VAR_4 = get_bits(&VAR_0->gb, 5);", "for (; VAR_3 < VAR_10; VAR_3++)", "*VAR_1++ = get_sbits_long(&VAR_0->gb, VAR_4);", "} else {", "for (; VAR_3 < VAR_10; VAR_3++) {", "*VAR_1++ = get_sr_golomb_flac(&VAR_0->gb, VAR_4, INT_MAX, 0);", "}", "}", "VAR_3= 0;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ] ]
9,729
MemoryRegion *pci_address_space(PCIDevice *dev) { return dev->bus->address_space_mem; }
false
qemu
fd56e0612b6454a282fa6a953fdb09281a98c589
MemoryRegion *pci_address_space(PCIDevice *dev) { return dev->bus->address_space_mem; }
{ "code": [], "line_no": [] }
MemoryRegion *FUNC_0(PCIDevice *dev) { return dev->bus->address_space_mem; }
[ "MemoryRegion *FUNC_0(PCIDevice *dev)\n{", "return dev->bus->address_space_mem;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
9,730
static void net_socket_accept(void *opaque) { NetSocketListenState *s = opaque; NetSocketState *s1; struct sockaddr_in saddr; socklen_t len; int fd; for(;;) { len = sizeof(saddr); fd = qemu_accept(s->fd, (struct sockaddr *)&saddr, &len); if (fd < 0 && errno != EINTR) { return; } else if (fd >= 0) { break; } } s1 = net_socket_fd_init(s->peer, s->model, s->name, fd, 1); if (s1) { snprintf(s1->nc.info_str, sizeof(s1->nc.info_str), "socket: connection from %s:%d", inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); } }
false
qemu
011de2b512a83aa5e9f8899ed5bbf2f31995b90e
static void net_socket_accept(void *opaque) { NetSocketListenState *s = opaque; NetSocketState *s1; struct sockaddr_in saddr; socklen_t len; int fd; for(;;) { len = sizeof(saddr); fd = qemu_accept(s->fd, (struct sockaddr *)&saddr, &len); if (fd < 0 && errno != EINTR) { return; } else if (fd >= 0) { break; } } s1 = net_socket_fd_init(s->peer, s->model, s->name, fd, 1); if (s1) { snprintf(s1->nc.info_str, sizeof(s1->nc.info_str), "socket: connection from %s:%d", inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { NetSocketListenState *s = VAR_0; NetSocketState *s1; struct sockaddr_in VAR_1; socklen_t len; int VAR_2; for(;;) { len = sizeof(VAR_1); VAR_2 = qemu_accept(s->VAR_2, (struct sockaddr *)&VAR_1, &len); if (VAR_2 < 0 && errno != EINTR) { return; } else if (VAR_2 >= 0) { break; } } s1 = net_socket_fd_init(s->peer, s->model, s->name, VAR_2, 1); if (s1) { snprintf(s1->nc.info_str, sizeof(s1->nc.info_str), "socket: connection from %s:%d", inet_ntoa(VAR_1.sin_addr), ntohs(VAR_1.sin_port)); } }
[ "static void FUNC_0(void *VAR_0)\n{", "NetSocketListenState *s = VAR_0;", "NetSocketState *s1;", "struct sockaddr_in VAR_1;", "socklen_t len;", "int VAR_2;", "for(;;) {", "len = sizeof(VAR_1);", "VAR_2 = qemu_accept(s->VAR_2, (struct sockaddr *)&VAR_1, &len);", "if (VAR_2 < 0 && errno != EINTR) {", "return;", "} else if (VAR_2 >= 0) {", "break;", "}", "}", "s1 = net_socket_fd_init(s->peer, s->model, s->name, VAR_2, 1);", "if (s1) {", "snprintf(s1->nc.info_str, sizeof(s1->nc.info_str),\n\"socket: connection from %s:%d\",\ninet_ntoa(VAR_1.sin_addr), ntohs(VAR_1.sin_port));", "}", "}" ]
[ 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 ] ]
9,731
static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVVVFATState *s = bs->opaque; int cyls, heads, secs; bool floppy; const char *dirname, *label; QemuOpts *opts; Error *local_err = NULL; int ret; #ifdef DEBUG vvv = s; #endif opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } dirname = qemu_opt_get(opts, "dir"); if (!dirname) { error_setg(errp, "vvfat block driver requires a 'dir' option"); ret = -EINVAL; goto fail; } s->fat_type = qemu_opt_get_number(opts, "fat-type", 0); floppy = qemu_opt_get_bool(opts, "floppy", false); memset(s->volume_label, ' ', sizeof(s->volume_label)); label = qemu_opt_get(opts, "label"); if (label) { size_t label_length = strlen(label); if (label_length > 11) { error_setg(errp, "vvfat label cannot be longer than 11 bytes"); ret = -EINVAL; goto fail; } memcpy(s->volume_label, label, label_length); } else { memcpy(s->volume_label, "QEMU VVFAT", 10); } if (floppy) { /* 1.44MB or 2.88MB floppy. 2.88MB can be FAT12 (default) or FAT16. */ if (!s->fat_type) { s->fat_type = 12; secs = 36; s->sectors_per_cluster = 2; } else { secs = s->fat_type == 12 ? 18 : 36; s->sectors_per_cluster = 1; } cyls = 80; heads = 2; } else { /* 32MB or 504MB disk*/ if (!s->fat_type) { s->fat_type = 16; } s->offset_to_bootsector = 0x3f; cyls = s->fat_type == 12 ? 64 : 1024; heads = 16; secs = 63; } switch (s->fat_type) { case 32: fprintf(stderr, "Big fat greek warning: FAT32 has not been tested. " "You are welcome to do so!\n"); break; case 16: case 12: break; default: error_setg(errp, "Valid FAT types are only 12, 16 and 32"); ret = -EINVAL; goto fail; } s->bs = bs; /* LATER TODO: if FAT32, adjust */ s->sectors_per_cluster=0x10; s->current_cluster=0xffffffff; s->qcow = NULL; s->qcow_filename = NULL; s->fat2 = NULL; s->downcase_short_names = 1; fprintf(stderr, "vvfat %s chs %d,%d,%d\n", dirname, cyls, heads, secs); s->sector_count = cyls * heads * secs - s->offset_to_bootsector; if (qemu_opt_get_bool(opts, "rw", false)) { if (!bdrv_is_read_only(bs)) { ret = enable_write_target(bs, errp); if (ret < 0) { goto fail; } } else { ret = -EPERM; error_setg(errp, "Unable to set VVFAT to 'rw' when drive is read-only"); goto fail; } } else { /* read only is the default for safety */ ret = bdrv_set_read_only(bs, true, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto fail; } } bs->total_sectors = cyls * heads * secs; if (init_directories(s, dirname, heads, secs, errp)) { ret = -EIO; goto fail; } s->sector_count = s->offset_to_root_dir + s->sectors_per_cluster * s->cluster_count; /* Disable migration when vvfat is used rw */ if (s->qcow) { error_setg(&s->migration_blocker, "The vvfat (rw) format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); ret = migrate_add_blocker(s->migration_blocker, &local_err); if (local_err) { error_propagate(errp, local_err); error_free(s->migration_blocker); goto fail; } } if (s->offset_to_bootsector > 0) { init_mbr(s, cyls, heads, secs); } qemu_co_mutex_init(&s->lock); ret = 0; fail: qemu_opts_del(opts); return ret; }
false
qemu
8297be80f7cf71e09617669a8bd8b2836dcfd4c3
static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVVVFATState *s = bs->opaque; int cyls, heads, secs; bool floppy; const char *dirname, *label; QemuOpts *opts; Error *local_err = NULL; int ret; #ifdef DEBUG vvv = s; #endif opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } dirname = qemu_opt_get(opts, "dir"); if (!dirname) { error_setg(errp, "vvfat block driver requires a 'dir' option"); ret = -EINVAL; goto fail; } s->fat_type = qemu_opt_get_number(opts, "fat-type", 0); floppy = qemu_opt_get_bool(opts, "floppy", false); memset(s->volume_label, ' ', sizeof(s->volume_label)); label = qemu_opt_get(opts, "label"); if (label) { size_t label_length = strlen(label); if (label_length > 11) { error_setg(errp, "vvfat label cannot be longer than 11 bytes"); ret = -EINVAL; goto fail; } memcpy(s->volume_label, label, label_length); } else { memcpy(s->volume_label, "QEMU VVFAT", 10); } if (floppy) { if (!s->fat_type) { s->fat_type = 12; secs = 36; s->sectors_per_cluster = 2; } else { secs = s->fat_type == 12 ? 18 : 36; s->sectors_per_cluster = 1; } cyls = 80; heads = 2; } else { if (!s->fat_type) { s->fat_type = 16; } s->offset_to_bootsector = 0x3f; cyls = s->fat_type == 12 ? 64 : 1024; heads = 16; secs = 63; } switch (s->fat_type) { case 32: fprintf(stderr, "Big fat greek warning: FAT32 has not been tested. " "You are welcome to do so!\n"); break; case 16: case 12: break; default: error_setg(errp, "Valid FAT types are only 12, 16 and 32"); ret = -EINVAL; goto fail; } s->bs = bs; s->sectors_per_cluster=0x10; s->current_cluster=0xffffffff; s->qcow = NULL; s->qcow_filename = NULL; s->fat2 = NULL; s->downcase_short_names = 1; fprintf(stderr, "vvfat %s chs %d,%d,%d\n", dirname, cyls, heads, secs); s->sector_count = cyls * heads * secs - s->offset_to_bootsector; if (qemu_opt_get_bool(opts, "rw", false)) { if (!bdrv_is_read_only(bs)) { ret = enable_write_target(bs, errp); if (ret < 0) { goto fail; } } else { ret = -EPERM; error_setg(errp, "Unable to set VVFAT to 'rw' when drive is read-only"); goto fail; } } else { ret = bdrv_set_read_only(bs, true, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto fail; } } bs->total_sectors = cyls * heads * secs; if (init_directories(s, dirname, heads, secs, errp)) { ret = -EIO; goto fail; } s->sector_count = s->offset_to_root_dir + s->sectors_per_cluster * s->cluster_count; if (s->qcow) { error_setg(&s->migration_blocker, "The vvfat (rw) format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); ret = migrate_add_blocker(s->migration_blocker, &local_err); if (local_err) { error_propagate(errp, local_err); error_free(s->migration_blocker); goto fail; } } if (s->offset_to_bootsector > 0) { init_mbr(s, cyls, heads, secs); } qemu_co_mutex_init(&s->lock); ret = 0; fail: qemu_opts_del(opts); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVVVFATState *s = VAR_0->opaque; int VAR_4, VAR_5, VAR_6; bool floppy; const char *VAR_7, *VAR_8; QemuOpts *opts; Error *local_err = NULL; int VAR_9; #ifdef DEBUG vvv = s; #endif opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, VAR_1, &local_err); if (local_err) { error_propagate(VAR_3, local_err); VAR_9 = -EINVAL; goto fail; } VAR_7 = qemu_opt_get(opts, "dir"); if (!VAR_7) { error_setg(VAR_3, "vvfat block driver requires a 'dir' option"); VAR_9 = -EINVAL; goto fail; } s->fat_type = qemu_opt_get_number(opts, "fat-type", 0); floppy = qemu_opt_get_bool(opts, "floppy", false); memset(s->volume_label, ' ', sizeof(s->volume_label)); VAR_8 = qemu_opt_get(opts, "VAR_8"); if (VAR_8) { size_t label_length = strlen(VAR_8); if (label_length > 11) { error_setg(VAR_3, "vvfat VAR_8 cannot be longer than 11 bytes"); VAR_9 = -EINVAL; goto fail; } memcpy(s->volume_label, VAR_8, label_length); } else { memcpy(s->volume_label, "QEMU VVFAT", 10); } if (floppy) { if (!s->fat_type) { s->fat_type = 12; VAR_6 = 36; s->sectors_per_cluster = 2; } else { VAR_6 = s->fat_type == 12 ? 18 : 36; s->sectors_per_cluster = 1; } VAR_4 = 80; VAR_5 = 2; } else { if (!s->fat_type) { s->fat_type = 16; } s->offset_to_bootsector = 0x3f; VAR_4 = s->fat_type == 12 ? 64 : 1024; VAR_5 = 16; VAR_6 = 63; } switch (s->fat_type) { case 32: fprintf(stderr, "Big fat greek warning: FAT32 has not been tested. " "You are welcome to do so!\n"); break; case 16: case 12: break; default: error_setg(VAR_3, "Valid FAT types are only 12, 16 and 32"); VAR_9 = -EINVAL; goto fail; } s->VAR_0 = VAR_0; s->sectors_per_cluster=0x10; s->current_cluster=0xffffffff; s->qcow = NULL; s->qcow_filename = NULL; s->fat2 = NULL; s->downcase_short_names = 1; fprintf(stderr, "vvfat %s chs %d,%d,%d\n", VAR_7, VAR_4, VAR_5, VAR_6); s->sector_count = VAR_4 * VAR_5 * VAR_6 - s->offset_to_bootsector; if (qemu_opt_get_bool(opts, "rw", false)) { if (!bdrv_is_read_only(VAR_0)) { VAR_9 = enable_write_target(VAR_0, VAR_3); if (VAR_9 < 0) { goto fail; } } else { VAR_9 = -EPERM; error_setg(VAR_3, "Unable to set VVFAT to 'rw' when drive is read-only"); goto fail; } } else { VAR_9 = bdrv_set_read_only(VAR_0, true, &local_err); if (VAR_9 < 0) { error_propagate(VAR_3, local_err); goto fail; } } VAR_0->total_sectors = VAR_4 * VAR_5 * VAR_6; if (init_directories(s, VAR_7, VAR_5, VAR_6, VAR_3)) { VAR_9 = -EIO; goto fail; } s->sector_count = s->offset_to_root_dir + s->sectors_per_cluster * s->cluster_count; if (s->qcow) { error_setg(&s->migration_blocker, "The vvfat (rw) format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(VAR_0)); VAR_9 = migrate_add_blocker(s->migration_blocker, &local_err); if (local_err) { error_propagate(VAR_3, local_err); error_free(s->migration_blocker); goto fail; } } if (s->offset_to_bootsector > 0) { init_mbr(s, VAR_4, VAR_5, VAR_6); } qemu_co_mutex_init(&s->lock); VAR_9 = 0; fail: qemu_opts_del(opts); return VAR_9; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVVVFATState *s = VAR_0->opaque;", "int VAR_4, VAR_5, VAR_6;", "bool floppy;", "const char *VAR_7, *VAR_8;", "QemuOpts *opts;", "Error *local_err = NULL;", "int VAR_9;", "#ifdef DEBUG\nvvv = s;", "#endif\nopts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, VAR_1, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "VAR_9 = -EINVAL;", "goto fail;", "}", "VAR_7 = qemu_opt_get(opts, \"dir\");", "if (!VAR_7) {", "error_setg(VAR_3, \"vvfat block driver requires a 'dir' option\");", "VAR_9 = -EINVAL;", "goto fail;", "}", "s->fat_type = qemu_opt_get_number(opts, \"fat-type\", 0);", "floppy = qemu_opt_get_bool(opts, \"floppy\", false);", "memset(s->volume_label, ' ', sizeof(s->volume_label));", "VAR_8 = qemu_opt_get(opts, \"VAR_8\");", "if (VAR_8) {", "size_t label_length = strlen(VAR_8);", "if (label_length > 11) {", "error_setg(VAR_3, \"vvfat VAR_8 cannot be longer than 11 bytes\");", "VAR_9 = -EINVAL;", "goto fail;", "}", "memcpy(s->volume_label, VAR_8, label_length);", "} else {", "memcpy(s->volume_label, \"QEMU VVFAT\", 10);", "}", "if (floppy) {", "if (!s->fat_type) {", "s->fat_type = 12;", "VAR_6 = 36;", "s->sectors_per_cluster = 2;", "} else {", "VAR_6 = s->fat_type == 12 ? 18 : 36;", "s->sectors_per_cluster = 1;", "}", "VAR_4 = 80;", "VAR_5 = 2;", "} else {", "if (!s->fat_type) {", "s->fat_type = 16;", "}", "s->offset_to_bootsector = 0x3f;", "VAR_4 = s->fat_type == 12 ? 64 : 1024;", "VAR_5 = 16;", "VAR_6 = 63;", "}", "switch (s->fat_type) {", "case 32:\nfprintf(stderr, \"Big fat greek warning: FAT32 has not been tested. \"\n\"You are welcome to do so!\\n\");", "break;", "case 16:\ncase 12:\nbreak;", "default:\nerror_setg(VAR_3, \"Valid FAT types are only 12, 16 and 32\");", "VAR_9 = -EINVAL;", "goto fail;", "}", "s->VAR_0 = VAR_0;", "s->sectors_per_cluster=0x10;", "s->current_cluster=0xffffffff;", "s->qcow = NULL;", "s->qcow_filename = NULL;", "s->fat2 = NULL;", "s->downcase_short_names = 1;", "fprintf(stderr, \"vvfat %s chs %d,%d,%d\\n\",\nVAR_7, VAR_4, VAR_5, VAR_6);", "s->sector_count = VAR_4 * VAR_5 * VAR_6 - s->offset_to_bootsector;", "if (qemu_opt_get_bool(opts, \"rw\", false)) {", "if (!bdrv_is_read_only(VAR_0)) {", "VAR_9 = enable_write_target(VAR_0, VAR_3);", "if (VAR_9 < 0) {", "goto fail;", "}", "} else {", "VAR_9 = -EPERM;", "error_setg(VAR_3,\n\"Unable to set VVFAT to 'rw' when drive is read-only\");", "goto fail;", "}", "} else {", "VAR_9 = bdrv_set_read_only(VAR_0, true, &local_err);", "if (VAR_9 < 0) {", "error_propagate(VAR_3, local_err);", "goto fail;", "}", "}", "VAR_0->total_sectors = VAR_4 * VAR_5 * VAR_6;", "if (init_directories(s, VAR_7, VAR_5, VAR_6, VAR_3)) {", "VAR_9 = -EIO;", "goto fail;", "}", "s->sector_count = s->offset_to_root_dir\n+ s->sectors_per_cluster * s->cluster_count;", "if (s->qcow) {", "error_setg(&s->migration_blocker,\n\"The vvfat (rw) format used by node '%s' \"\n\"does not support live migration\",\nbdrv_get_device_or_node_name(VAR_0));", "VAR_9 = migrate_add_blocker(s->migration_blocker, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "error_free(s->migration_blocker);", "goto fail;", "}", "}", "if (s->offset_to_bootsector > 0) {", "init_mbr(s, VAR_4, VAR_5, VAR_6);", "}", "qemu_co_mutex_init(&s->lock);", "VAR_9 = 0;", "fail:\nqemu_opts_del(opts);", "return VAR_9;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151, 153, 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 171 ], [ 177 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195, 197 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261, 263 ], [ 269 ], [ 271, 273, 275, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 307 ], [ 309, 311 ], [ 313 ], [ 315 ] ]
9,732
static void qemu_opt_del(QemuOpt *opt) { TAILQ_REMOVE(&opt->opts->head, opt, next); qemu_free((/* !const */ char*)opt->name); qemu_free((/* !const */ char*)opt->str); qemu_free(opt); }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static void qemu_opt_del(QemuOpt *opt) { TAILQ_REMOVE(&opt->opts->head, opt, next); qemu_free(( char*)opt->name); qemu_free(( char*)opt->str); qemu_free(opt); }
{ "code": [], "line_no": [] }
static void FUNC_0(QemuOpt *VAR_0) { TAILQ_REMOVE(&VAR_0->opts->head, VAR_0, next); qemu_free(( char*)VAR_0->name); qemu_free(( char*)VAR_0->str); qemu_free(VAR_0); }
[ "static void FUNC_0(QemuOpt *VAR_0)\n{", "TAILQ_REMOVE(&VAR_0->opts->head, VAR_0, next);", "qemu_free(( char*)VAR_0->name);", "qemu_free(( char*)VAR_0->str);", "qemu_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
9,733
static void bamboo_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 }; PCIBus *pcibus; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; target_phys_addr_t entry = 0; target_phys_addr_t loadaddr = 0; target_long kernel_size = 0; target_ulong initrd_base = 0; target_long initrd_size = 0; target_ulong dt_base = 0; void *fdt; int i; /* Setup CPU. */ env = ppc440ep_init(&ram_size, &pcibus, pci_irq_nrs, 1, cpu_model); if (pcibus) { /* Register network interfaces. */ for (i = 0; i < nb_nics; i++) { /* There are no PCI NICs on the Bamboo board, but there are * PCI slots, so we can pick whatever default model we want. */ pci_nic_init_nofail(&nd_table[i], "e1000", NULL); } } /* Load kernel. */ if (kernel_filename) { kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL); if (kernel_size < 0) { kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); entry = elf_entry; loadaddr = elf_lowaddr; } /* XXX try again as binary */ if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } /* Load initrd. */ if (initrd_filename) { initrd_base = kernel_size + loadaddr; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } /* If we're loading a kernel directly, we must load the device tree too. */ if (kernel_filename) { if (initrd_base) dt_base = initrd_base + initrd_size; else dt_base = kernel_size + loadaddr; fdt = bamboo_load_device_tree(dt_base, ram_size, initrd_base, initrd_size, kernel_cmdline); if (fdt == NULL) { fprintf(stderr, "couldn't load device tree\n"); exit(1); } cpu_synchronize_state(env); /* Set initial guest state. */ env->gpr[1] = (16<<20) - 8; env->gpr[3] = dt_base; env->nip = entry; /* XXX we currently depend on KVM to create some initial TLB entries. */ } if (kvm_enabled()) kvmppc_init(); }
false
qemu
04088adbe0c5adca66adb6022723362ad90ed0fc
static void bamboo_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 }; PCIBus *pcibus; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; target_phys_addr_t entry = 0; target_phys_addr_t loadaddr = 0; target_long kernel_size = 0; target_ulong initrd_base = 0; target_long initrd_size = 0; target_ulong dt_base = 0; void *fdt; int i; env = ppc440ep_init(&ram_size, &pcibus, pci_irq_nrs, 1, cpu_model); if (pcibus) { for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], "e1000", NULL); } } if (kernel_filename) { kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL); if (kernel_size < 0) { kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); entry = elf_entry; loadaddr = elf_lowaddr; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } if (initrd_filename) { initrd_base = kernel_size + loadaddr; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } if (kernel_filename) { if (initrd_base) dt_base = initrd_base + initrd_size; else dt_base = kernel_size + loadaddr; fdt = bamboo_load_device_tree(dt_base, ram_size, initrd_base, initrd_size, kernel_cmdline); if (fdt == NULL) { fprintf(stderr, "couldn't load device tree\n"); exit(1); } cpu_synchronize_state(env); env->gpr[1] = (16<<20) - 8; env->gpr[3] = dt_base; env->nip = entry; } if (kvm_enabled()) kvmppc_init(); }
{ "code": [], "line_no": [] }
static void FUNC_0(ram_addr_t VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5) { unsigned int VAR_6[4] = { 28, 27, 26, 25 }; PCIBus *pcibus; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; target_phys_addr_t entry = 0; target_phys_addr_t loadaddr = 0; target_long kernel_size = 0; target_ulong initrd_base = 0; target_long initrd_size = 0; target_ulong dt_base = 0; void *VAR_7; int VAR_8; env = ppc440ep_init(&VAR_0, &pcibus, VAR_6, 1, VAR_5); if (pcibus) { for (VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) { pci_nic_init_nofail(&nd_table[VAR_8], "e1000", NULL); } } if (VAR_2) { kernel_size = load_uimage(VAR_2, &entry, &loadaddr, NULL); if (kernel_size < 0) { kernel_size = load_elf(VAR_2, 0, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); entry = elf_entry; loadaddr = elf_lowaddr; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_2); exit(1); } } if (VAR_4) { initrd_base = kernel_size + loadaddr; initrd_size = load_image_targphys(VAR_4, initrd_base, VAR_0 - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", VAR_4); exit(1); } } if (VAR_2) { if (initrd_base) dt_base = initrd_base + initrd_size; else dt_base = kernel_size + loadaddr; VAR_7 = bamboo_load_device_tree(dt_base, VAR_0, initrd_base, initrd_size, VAR_3); if (VAR_7 == NULL) { fprintf(stderr, "couldn't load device tree\n"); exit(1); } cpu_synchronize_state(env); env->gpr[1] = (16<<20) - 8; env->gpr[3] = dt_base; env->nip = entry; } if (kvm_enabled()) kvmppc_init(); }
[ "static void FUNC_0(ram_addr_t VAR_0,\nconst char *VAR_1,\nconst char *VAR_2,\nconst char *VAR_3,\nconst char *VAR_4,\nconst char *VAR_5)\n{", "unsigned int VAR_6[4] = { 28, 27, 26, 25 };", "PCIBus *pcibus;", "CPUState *env;", "uint64_t elf_entry;", "uint64_t elf_lowaddr;", "target_phys_addr_t entry = 0;", "target_phys_addr_t loadaddr = 0;", "target_long kernel_size = 0;", "target_ulong initrd_base = 0;", "target_long initrd_size = 0;", "target_ulong dt_base = 0;", "void *VAR_7;", "int VAR_8;", "env = ppc440ep_init(&VAR_0, &pcibus, VAR_6, 1, VAR_5);", "if (pcibus) {", "for (VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) {", "pci_nic_init_nofail(&nd_table[VAR_8], \"e1000\", NULL);", "}", "}", "if (VAR_2) {", "kernel_size = load_uimage(VAR_2, &entry, &loadaddr, NULL);", "if (kernel_size < 0) {", "kernel_size = load_elf(VAR_2, 0, &elf_entry, &elf_lowaddr,\nNULL, 1, ELF_MACHINE, 0);", "entry = elf_entry;", "loadaddr = elf_lowaddr;", "}", "if (kernel_size < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_2);", "exit(1);", "}", "}", "if (VAR_4) {", "initrd_base = kernel_size + loadaddr;", "initrd_size = load_image_targphys(VAR_4, initrd_base,\nVAR_0 - initrd_base);", "if (initrd_size < 0) {", "fprintf(stderr, \"qemu: could not load initial ram disk '%s'\\n\",\nVAR_4);", "exit(1);", "}", "}", "if (VAR_2) {", "if (initrd_base)\ndt_base = initrd_base + initrd_size;", "else\ndt_base = kernel_size + loadaddr;", "VAR_7 = bamboo_load_device_tree(dt_base, VAR_0,\ninitrd_base, initrd_size, VAR_3);", "if (VAR_7 == NULL) {", "fprintf(stderr, \"couldn't load device tree\\n\");", "exit(1);", "}", "cpu_synchronize_state(env);", "env->gpr[1] = (16<<20) - 8;", "env->gpr[3] = dt_base;", "env->nip = entry;", "}", "if (kvm_enabled())\nkvmppc_init();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 45 ], [ 49 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 129 ], [ 131, 133 ], [ 135, 137 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 173, 175 ], [ 177 ] ]
9,734
static int bochs_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVBochsState *s = bs->opaque; uint32_t i; struct bochs_header bochs; int ret; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } bdrv_set_read_only(bs, true); /* no write support yet */ ret = bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)); if (ret < 0) { return ret; } if (strcmp(bochs.magic, HEADER_MAGIC) || strcmp(bochs.type, REDOLOG_TYPE) || strcmp(bochs.subtype, GROWING_TYPE) || ((le32_to_cpu(bochs.version) != HEADER_VERSION) && (le32_to_cpu(bochs.version) != HEADER_V1))) { error_setg(errp, "Image not in Bochs format"); return -EINVAL; } if (le32_to_cpu(bochs.version) == HEADER_V1) { bs->total_sectors = le64_to_cpu(bochs.extra.redolog_v1.disk) / 512; } else { bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512; } /* Limit to 1M entries to avoid unbounded allocation. This is what is * needed for the largest image that bximage can create (~8 TB). */ s->catalog_size = le32_to_cpu(bochs.catalog); if (s->catalog_size > 0x100000) { error_setg(errp, "Catalog size is too large"); return -EFBIG; } s->catalog_bitmap = g_try_new(uint32_t, s->catalog_size); if (s->catalog_size && s->catalog_bitmap == NULL) { error_setg(errp, "Could not allocate memory for catalog"); return -ENOMEM; } ret = bdrv_pread(bs->file, le32_to_cpu(bochs.header), s->catalog_bitmap, s->catalog_size * 4); if (ret < 0) { goto fail; } for (i = 0; i < s->catalog_size; i++) le32_to_cpus(&s->catalog_bitmap[i]); s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); s->bitmap_blocks = 1 + (le32_to_cpu(bochs.bitmap) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(bochs.extent) - 1) / 512; s->extent_size = le32_to_cpu(bochs.extent); if (s->extent_size < BDRV_SECTOR_SIZE) { /* bximage actually never creates extents smaller than 4k */ error_setg(errp, "Extent size must be at least 512"); ret = -EINVAL; goto fail; } else if (!is_power_of_2(s->extent_size)) { error_setg(errp, "Extent size %" PRIu32 " is not a power of two", s->extent_size); ret = -EINVAL; goto fail; } else if (s->extent_size > 0x800000) { error_setg(errp, "Extent size %" PRIu32 " is too large", s->extent_size); ret = -EINVAL; goto fail; } if (s->catalog_size < DIV_ROUND_UP(bs->total_sectors, s->extent_size / BDRV_SECTOR_SIZE)) { error_setg(errp, "Catalog size is too small for this disk size"); ret = -EINVAL; goto fail; } qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->catalog_bitmap); return ret; }
false
qemu
e2b8247a322cd92945785edf25f09e6b3e8285f9
static int bochs_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVBochsState *s = bs->opaque; uint32_t i; struct bochs_header bochs; int ret; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } bdrv_set_read_only(bs, true); ret = bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)); if (ret < 0) { return ret; } if (strcmp(bochs.magic, HEADER_MAGIC) || strcmp(bochs.type, REDOLOG_TYPE) || strcmp(bochs.subtype, GROWING_TYPE) || ((le32_to_cpu(bochs.version) != HEADER_VERSION) && (le32_to_cpu(bochs.version) != HEADER_V1))) { error_setg(errp, "Image not in Bochs format"); return -EINVAL; } if (le32_to_cpu(bochs.version) == HEADER_V1) { bs->total_sectors = le64_to_cpu(bochs.extra.redolog_v1.disk) / 512; } else { bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512; } s->catalog_size = le32_to_cpu(bochs.catalog); if (s->catalog_size > 0x100000) { error_setg(errp, "Catalog size is too large"); return -EFBIG; } s->catalog_bitmap = g_try_new(uint32_t, s->catalog_size); if (s->catalog_size && s->catalog_bitmap == NULL) { error_setg(errp, "Could not allocate memory for catalog"); return -ENOMEM; } ret = bdrv_pread(bs->file, le32_to_cpu(bochs.header), s->catalog_bitmap, s->catalog_size * 4); if (ret < 0) { goto fail; } for (i = 0; i < s->catalog_size; i++) le32_to_cpus(&s->catalog_bitmap[i]); s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); s->bitmap_blocks = 1 + (le32_to_cpu(bochs.bitmap) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(bochs.extent) - 1) / 512; s->extent_size = le32_to_cpu(bochs.extent); if (s->extent_size < BDRV_SECTOR_SIZE) { error_setg(errp, "Extent size must be at least 512"); ret = -EINVAL; goto fail; } else if (!is_power_of_2(s->extent_size)) { error_setg(errp, "Extent size %" PRIu32 " is not a power of two", s->extent_size); ret = -EINVAL; goto fail; } else if (s->extent_size > 0x800000) { error_setg(errp, "Extent size %" PRIu32 " is too large", s->extent_size); ret = -EINVAL; goto fail; } if (s->catalog_size < DIV_ROUND_UP(bs->total_sectors, s->extent_size / BDRV_SECTOR_SIZE)) { error_setg(errp, "Catalog size is too small for this disk size"); ret = -EINVAL; goto fail; } qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->catalog_bitmap); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVBochsState *s = VAR_0->opaque; uint32_t i; struct bochs_header VAR_4; int VAR_5; VAR_0->file = bdrv_open_child(NULL, VAR_1, "file", VAR_0, &child_file, false, VAR_3); if (!VAR_0->file) { return -EINVAL; } bdrv_set_read_only(VAR_0, true); VAR_5 = bdrv_pread(VAR_0->file, 0, &VAR_4, sizeof(VAR_4)); if (VAR_5 < 0) { return VAR_5; } if (strcmp(VAR_4.magic, HEADER_MAGIC) || strcmp(VAR_4.type, REDOLOG_TYPE) || strcmp(VAR_4.subtype, GROWING_TYPE) || ((le32_to_cpu(VAR_4.version) != HEADER_VERSION) && (le32_to_cpu(VAR_4.version) != HEADER_V1))) { error_setg(VAR_3, "Image not in Bochs format"); return -EINVAL; } if (le32_to_cpu(VAR_4.version) == HEADER_V1) { VAR_0->total_sectors = le64_to_cpu(VAR_4.extra.redolog_v1.disk) / 512; } else { VAR_0->total_sectors = le64_to_cpu(VAR_4.extra.redolog.disk) / 512; } s->catalog_size = le32_to_cpu(VAR_4.catalog); if (s->catalog_size > 0x100000) { error_setg(VAR_3, "Catalog size is too large"); return -EFBIG; } s->catalog_bitmap = g_try_new(uint32_t, s->catalog_size); if (s->catalog_size && s->catalog_bitmap == NULL) { error_setg(VAR_3, "Could not allocate memory for catalog"); return -ENOMEM; } VAR_5 = bdrv_pread(VAR_0->file, le32_to_cpu(VAR_4.header), s->catalog_bitmap, s->catalog_size * 4); if (VAR_5 < 0) { goto fail; } for (i = 0; i < s->catalog_size; i++) le32_to_cpus(&s->catalog_bitmap[i]); s->data_offset = le32_to_cpu(VAR_4.header) + (s->catalog_size * 4); s->bitmap_blocks = 1 + (le32_to_cpu(VAR_4.bitmap) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(VAR_4.extent) - 1) / 512; s->extent_size = le32_to_cpu(VAR_4.extent); if (s->extent_size < BDRV_SECTOR_SIZE) { error_setg(VAR_3, "Extent size must be at least 512"); VAR_5 = -EINVAL; goto fail; } else if (!is_power_of_2(s->extent_size)) { error_setg(VAR_3, "Extent size %" PRIu32 " is not a power of two", s->extent_size); VAR_5 = -EINVAL; goto fail; } else if (s->extent_size > 0x800000) { error_setg(VAR_3, "Extent size %" PRIu32 " is too large", s->extent_size); VAR_5 = -EINVAL; goto fail; } if (s->catalog_size < DIV_ROUND_UP(VAR_0->total_sectors, s->extent_size / BDRV_SECTOR_SIZE)) { error_setg(VAR_3, "Catalog size is too small for this disk size"); VAR_5 = -EINVAL; goto fail; } qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->catalog_bitmap); return VAR_5; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVBochsState *s = VAR_0->opaque;", "uint32_t i;", "struct bochs_header VAR_4;", "int VAR_5;", "VAR_0->file = bdrv_open_child(NULL, VAR_1, \"file\", VAR_0, &child_file,\nfalse, VAR_3);", "if (!VAR_0->file) {", "return -EINVAL;", "}", "bdrv_set_read_only(VAR_0, true);", "VAR_5 = bdrv_pread(VAR_0->file, 0, &VAR_4, sizeof(VAR_4));", "if (VAR_5 < 0) {", "return VAR_5;", "}", "if (strcmp(VAR_4.magic, HEADER_MAGIC) ||\nstrcmp(VAR_4.type, REDOLOG_TYPE) ||\nstrcmp(VAR_4.subtype, GROWING_TYPE) ||\n((le32_to_cpu(VAR_4.version) != HEADER_VERSION) &&\n(le32_to_cpu(VAR_4.version) != HEADER_V1))) {", "error_setg(VAR_3, \"Image not in Bochs format\");", "return -EINVAL;", "}", "if (le32_to_cpu(VAR_4.version) == HEADER_V1) {", "VAR_0->total_sectors = le64_to_cpu(VAR_4.extra.redolog_v1.disk) / 512;", "} else {", "VAR_0->total_sectors = le64_to_cpu(VAR_4.extra.redolog.disk) / 512;", "}", "s->catalog_size = le32_to_cpu(VAR_4.catalog);", "if (s->catalog_size > 0x100000) {", "error_setg(VAR_3, \"Catalog size is too large\");", "return -EFBIG;", "}", "s->catalog_bitmap = g_try_new(uint32_t, s->catalog_size);", "if (s->catalog_size && s->catalog_bitmap == NULL) {", "error_setg(VAR_3, \"Could not allocate memory for catalog\");", "return -ENOMEM;", "}", "VAR_5 = bdrv_pread(VAR_0->file, le32_to_cpu(VAR_4.header), s->catalog_bitmap,\ns->catalog_size * 4);", "if (VAR_5 < 0) {", "goto fail;", "}", "for (i = 0; i < s->catalog_size; i++)", "le32_to_cpus(&s->catalog_bitmap[i]);", "s->data_offset = le32_to_cpu(VAR_4.header) + (s->catalog_size * 4);", "s->bitmap_blocks = 1 + (le32_to_cpu(VAR_4.bitmap) - 1) / 512;", "s->extent_blocks = 1 + (le32_to_cpu(VAR_4.extent) - 1) / 512;", "s->extent_size = le32_to_cpu(VAR_4.extent);", "if (s->extent_size < BDRV_SECTOR_SIZE) {", "error_setg(VAR_3, \"Extent size must be at least 512\");", "VAR_5 = -EINVAL;", "goto fail;", "} else if (!is_power_of_2(s->extent_size)) {", "error_setg(VAR_3, \"Extent size %\" PRIu32 \" is not a power of two\",\ns->extent_size);", "VAR_5 = -EINVAL;", "goto fail;", "} else if (s->extent_size > 0x800000) {", "error_setg(VAR_3, \"Extent size %\" PRIu32 \" is too large\",\ns->extent_size);", "VAR_5 = -EINVAL;", "goto fail;", "}", "if (s->catalog_size < DIV_ROUND_UP(VAR_0->total_sectors,\ns->extent_size / BDRV_SECTOR_SIZE))\n{", "error_setg(VAR_3, \"Catalog size is too small for this disk size\");", "VAR_5 = -EINVAL;", "goto fail;", "}", "qemu_co_mutex_init(&s->lock);", "return 0;", "fail:\ng_free(s->catalog_bitmap);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 119 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 193 ] ]
9,735
static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode, const char *name, V9fsSynthNodeAttr *attr, int inode) { V9fsSynthNode *node; /* Add directory type and remove write bits */ mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH); node = g_malloc0(sizeof(V9fsSynthNode)); if (attr) { /* We are adding .. or . entries */ node->attr = attr; node->attr->nlink++; } else { node->attr = &node->actual_attr; node->attr->inode = inode; node->attr->nlink = 1; /* We don't allow write to directories */ node->attr->mode = mode; node->attr->write = NULL; node->attr->read = NULL; } node->private = node; pstrcpy(node->name, sizeof(node->name), name); QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling); return node; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode, const char *name, V9fsSynthNodeAttr *attr, int inode) { V9fsSynthNode *node; mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH); node = g_malloc0(sizeof(V9fsSynthNode)); if (attr) { node->attr = attr; node->attr->nlink++; } else { node->attr = &node->actual_attr; node->attr->inode = inode; node->attr->nlink = 1; node->attr->mode = mode; node->attr->write = NULL; node->attr->read = NULL; } node->private = node; pstrcpy(node->name, sizeof(node->name), name); QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling); return node; }
{ "code": [], "line_no": [] }
static V9fsSynthNode *FUNC_0(V9fsSynthNode *parent, int mode, const char *name, V9fsSynthNodeAttr *attr, int inode) { V9fsSynthNode *node; mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH); node = g_malloc0(sizeof(V9fsSynthNode)); if (attr) { node->attr = attr; node->attr->nlink++; } else { node->attr = &node->actual_attr; node->attr->inode = inode; node->attr->nlink = 1; node->attr->mode = mode; node->attr->write = NULL; node->attr->read = NULL; } node->private = node; pstrcpy(node->name, sizeof(node->name), name); QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling); return node; }
[ "static V9fsSynthNode *FUNC_0(V9fsSynthNode *parent, int mode,\nconst char *name,\nV9fsSynthNodeAttr *attr, int inode)\n{", "V9fsSynthNode *node;", "mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH);", "node = g_malloc0(sizeof(V9fsSynthNode));", "if (attr) {", "node->attr = attr;", "node->attr->nlink++;", "} else {", "node->attr = &node->actual_attr;", "node->attr->inode = inode;", "node->attr->nlink = 1;", "node->attr->mode = mode;", "node->attr->write = NULL;", "node->attr->read = NULL;", "}", "node->private = node;", "pstrcpy(node->name, sizeof(node->name), name);", "QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling);", "return node;", "}" ]
[ 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 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
9,736
void ff_eac3_output_frame_header(AC3EncodeContext *s) { int blk, ch; AC3EncOptions *opt = &s->options; put_bits(&s->pb, 16, 0x0b77); /* sync word */ /* BSI header */ put_bits(&s->pb, 2, 0); /* stream type = independent */ put_bits(&s->pb, 3, 0); /* substream id = 0 */ put_bits(&s->pb, 11, (s->frame_size / 2) - 1); /* frame size */ if (s->bit_alloc.sr_shift) { put_bits(&s->pb, 2, 0x3); /* fscod2 */ put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ } else { put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ put_bits(&s->pb, 2, 0x3); /* number of blocks = 6 */ } put_bits(&s->pb, 3, s->channel_mode); /* audio coding mode */ put_bits(&s->pb, 1, s->lfe_on); /* LFE channel indicator */ put_bits(&s->pb, 5, s->bitstream_id); /* bitstream id (EAC3=16) */ put_bits(&s->pb, 5, -opt->dialogue_level); /* dialogue normalization level */ put_bits(&s->pb, 1, 0); /* no compression gain */ put_bits(&s->pb, 1, 0); /* no mixing metadata */ /* TODO: mixing metadata */ put_bits(&s->pb, 1, 0); /* no info metadata */ /* TODO: info metadata */ put_bits(&s->pb, 1, 0); /* no additional bit stream info */ /* frame header */ put_bits(&s->pb, 1, 1); /* exponent strategy syntax = each block */ put_bits(&s->pb, 1, 0); /* aht enabled = no */ put_bits(&s->pb, 2, 0); /* snr offset strategy = 1 */ put_bits(&s->pb, 1, 0); /* transient pre-noise processing enabled = no */ put_bits(&s->pb, 1, 0); /* block switch syntax enabled = no */ put_bits(&s->pb, 1, 0); /* dither flag syntax enabled = no */ put_bits(&s->pb, 1, 0); /* bit allocation model syntax enabled = no */ put_bits(&s->pb, 1, 0); /* fast gain codes enabled = no */ put_bits(&s->pb, 1, 0); /* dba syntax enabled = no */ put_bits(&s->pb, 1, 0); /* skip field syntax enabled = no */ put_bits(&s->pb, 1, 0); /* spx enabled = no */ /* coupling strategy use flags */ if (s->channel_mode > AC3_CHMODE_MONO) { put_bits(&s->pb, 1, s->blocks[0].cpl_in_use); for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; put_bits(&s->pb, 1, block->new_cpl_strategy); if (block->new_cpl_strategy) put_bits(&s->pb, 1, block->cpl_in_use); } } /* exponent strategy */ for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) for (ch = !s->blocks[blk].cpl_in_use; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 2, s->exp_strategy[ch][blk]); if (s->lfe_on) { for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][blk]); } /* E-AC-3 to AC-3 converter exponent strategy (unfortunately not optional...) */ for (ch = 1; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 5, 0); /* snr offsets */ put_bits(&s->pb, 6, s->coarse_snr_offset); put_bits(&s->pb, 4, s->fine_snr_offset[1]); /* block start info */ put_bits(&s->pb, 1, 0); }
false
FFmpeg
08a747afb98c11da48b89339c2f1c5fdc56ced7e
void ff_eac3_output_frame_header(AC3EncodeContext *s) { int blk, ch; AC3EncOptions *opt = &s->options; put_bits(&s->pb, 16, 0x0b77); put_bits(&s->pb, 2, 0); put_bits(&s->pb, 3, 0); put_bits(&s->pb, 11, (s->frame_size / 2) - 1); if (s->bit_alloc.sr_shift) { put_bits(&s->pb, 2, 0x3); put_bits(&s->pb, 2, s->bit_alloc.sr_code); } else { put_bits(&s->pb, 2, s->bit_alloc.sr_code); put_bits(&s->pb, 2, 0x3); } put_bits(&s->pb, 3, s->channel_mode); put_bits(&s->pb, 1, s->lfe_on); put_bits(&s->pb, 5, s->bitstream_id); put_bits(&s->pb, 5, -opt->dialogue_level); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 2, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); if (s->channel_mode > AC3_CHMODE_MONO) { put_bits(&s->pb, 1, s->blocks[0].cpl_in_use); for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; put_bits(&s->pb, 1, block->new_cpl_strategy); if (block->new_cpl_strategy) put_bits(&s->pb, 1, block->cpl_in_use); } } for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) for (ch = !s->blocks[blk].cpl_in_use; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 2, s->exp_strategy[ch][blk]); if (s->lfe_on) { for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][blk]); } for (ch = 1; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 5, 0); put_bits(&s->pb, 6, s->coarse_snr_offset); put_bits(&s->pb, 4, s->fine_snr_offset[1]); put_bits(&s->pb, 1, 0); }
{ "code": [], "line_no": [] }
void FUNC_0(AC3EncodeContext *VAR_0) { int VAR_1, VAR_2; AC3EncOptions *opt = &VAR_0->options; put_bits(&VAR_0->pb, 16, 0x0b77); put_bits(&VAR_0->pb, 2, 0); put_bits(&VAR_0->pb, 3, 0); put_bits(&VAR_0->pb, 11, (VAR_0->frame_size / 2) - 1); if (VAR_0->bit_alloc.sr_shift) { put_bits(&VAR_0->pb, 2, 0x3); put_bits(&VAR_0->pb, 2, VAR_0->bit_alloc.sr_code); } else { put_bits(&VAR_0->pb, 2, VAR_0->bit_alloc.sr_code); put_bits(&VAR_0->pb, 2, 0x3); } put_bits(&VAR_0->pb, 3, VAR_0->channel_mode); put_bits(&VAR_0->pb, 1, VAR_0->lfe_on); put_bits(&VAR_0->pb, 5, VAR_0->bitstream_id); put_bits(&VAR_0->pb, 5, -opt->dialogue_level); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 2, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); if (VAR_0->channel_mode > AC3_CHMODE_MONO) { put_bits(&VAR_0->pb, 1, VAR_0->blocks[0].cpl_in_use); for (VAR_1 = 1; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) { AC3Block *block = &VAR_0->blocks[VAR_1]; put_bits(&VAR_0->pb, 1, block->new_cpl_strategy); if (block->new_cpl_strategy) put_bits(&VAR_0->pb, 1, block->cpl_in_use); } } for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) for (VAR_2 = !VAR_0->blocks[VAR_1].cpl_in_use; VAR_2 <= VAR_0->fbw_channels; VAR_2++) put_bits(&VAR_0->pb, 2, VAR_0->exp_strategy[VAR_2][VAR_1]); if (VAR_0->lfe_on) { for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) put_bits(&VAR_0->pb, 1, VAR_0->exp_strategy[VAR_0->lfe_channel][VAR_1]); } for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++) put_bits(&VAR_0->pb, 5, 0); put_bits(&VAR_0->pb, 6, VAR_0->coarse_snr_offset); put_bits(&VAR_0->pb, 4, VAR_0->fine_snr_offset[1]); put_bits(&VAR_0->pb, 1, 0); }
[ "void FUNC_0(AC3EncodeContext *VAR_0)\n{", "int VAR_1, VAR_2;", "AC3EncOptions *opt = &VAR_0->options;", "put_bits(&VAR_0->pb, 16, 0x0b77);", "put_bits(&VAR_0->pb, 2, 0);", "put_bits(&VAR_0->pb, 3, 0);", "put_bits(&VAR_0->pb, 11, (VAR_0->frame_size / 2) - 1);", "if (VAR_0->bit_alloc.sr_shift) {", "put_bits(&VAR_0->pb, 2, 0x3);", "put_bits(&VAR_0->pb, 2, VAR_0->bit_alloc.sr_code);", "} else {", "put_bits(&VAR_0->pb, 2, VAR_0->bit_alloc.sr_code);", "put_bits(&VAR_0->pb, 2, 0x3);", "}", "put_bits(&VAR_0->pb, 3, VAR_0->channel_mode);", "put_bits(&VAR_0->pb, 1, VAR_0->lfe_on);", "put_bits(&VAR_0->pb, 5, VAR_0->bitstream_id);", "put_bits(&VAR_0->pb, 5, -opt->dialogue_level);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 2, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "if (VAR_0->channel_mode > AC3_CHMODE_MONO) {", "put_bits(&VAR_0->pb, 1, VAR_0->blocks[0].cpl_in_use);", "for (VAR_1 = 1; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) {", "AC3Block *block = &VAR_0->blocks[VAR_1];", "put_bits(&VAR_0->pb, 1, block->new_cpl_strategy);", "if (block->new_cpl_strategy)\nput_bits(&VAR_0->pb, 1, block->cpl_in_use);", "}", "}", "for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++)", "for (VAR_2 = !VAR_0->blocks[VAR_1].cpl_in_use; VAR_2 <= VAR_0->fbw_channels; VAR_2++)", "put_bits(&VAR_0->pb, 2, VAR_0->exp_strategy[VAR_2][VAR_1]);", "if (VAR_0->lfe_on) {", "for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++)", "put_bits(&VAR_0->pb, 1, VAR_0->exp_strategy[VAR_0->lfe_channel][VAR_1]);", "}", "for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++)", "put_bits(&VAR_0->pb, 5, 0);", "put_bits(&VAR_0->pb, 6, VAR_0->coarse_snr_offset);", "put_bits(&VAR_0->pb, 4, VAR_0->fine_snr_offset[1]);", "put_bits(&VAR_0->pb, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
9,737
static inline void gen_lods(DisasContext *s, int ot) { gen_string_movl_A0_ESI(s); gen_op_ld_T0_A0(ot + s->mem_index); gen_op_mov_reg_T0(ot, R_EAX); gen_op_movl_T0_Dshift[ot](); #ifdef TARGET_X86_64 if (s->aflag == 2) { gen_op_addq_ESI_T0(); } else #endif if (s->aflag) { gen_op_addl_ESI_T0(); } else { gen_op_addw_ESI_T0(); } }
false
qemu
6e0d8677cb443e7408c0b7a25a93c6596d7fa380
static inline void gen_lods(DisasContext *s, int ot) { gen_string_movl_A0_ESI(s); gen_op_ld_T0_A0(ot + s->mem_index); gen_op_mov_reg_T0(ot, R_EAX); gen_op_movl_T0_Dshift[ot](); #ifdef TARGET_X86_64 if (s->aflag == 2) { gen_op_addq_ESI_T0(); } else #endif if (s->aflag) { gen_op_addl_ESI_T0(); } else { gen_op_addw_ESI_T0(); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0, int VAR_1) { gen_string_movl_A0_ESI(VAR_0); gen_op_ld_T0_A0(VAR_1 + VAR_0->mem_index); gen_op_mov_reg_T0(VAR_1, R_EAX); gen_op_movl_T0_Dshift[VAR_1](); #ifdef TARGET_X86_64 if (VAR_0->aflag == 2) { gen_op_addq_ESI_T0(); } else #endif if (VAR_0->aflag) { gen_op_addl_ESI_T0(); } else { gen_op_addw_ESI_T0(); } }
[ "static inline void FUNC_0(DisasContext *VAR_0, int VAR_1)\n{", "gen_string_movl_A0_ESI(VAR_0);", "gen_op_ld_T0_A0(VAR_1 + VAR_0->mem_index);", "gen_op_mov_reg_T0(VAR_1, R_EAX);", "gen_op_movl_T0_Dshift[VAR_1]();", "#ifdef TARGET_X86_64\nif (VAR_0->aflag == 2) {", "gen_op_addq_ESI_T0();", "} else", "#endif\nif (VAR_0->aflag) {", "gen_op_addl_ESI_T0();", "} else {", "gen_op_addw_ESI_T0();", "}", "}" ]
[ 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 ] ]
9,738
static uint64_t hb_regs_read(void *opaque, target_phys_addr_t offset, unsigned size) { uint32_t *regs = opaque; uint32_t value = regs[offset/4]; if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) { value |= 0x30000000; } return value; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t hb_regs_read(void *opaque, target_phys_addr_t offset, unsigned size) { uint32_t *regs = opaque; uint32_t value = regs[offset/4]; if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) { value |= 0x30000000; } return value; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { uint32_t *regs = opaque; uint32_t value = regs[offset/4]; if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) { value |= 0x30000000; } return value; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "uint32_t *regs = opaque;", "uint32_t value = regs[offset/4];", "if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) {", "value |= 0x30000000;", "}", "return value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
9,739
size_t nbd_wr_sync(int fd, void *buffer, size_t size, bool do_read) { size_t offset = 0; if (qemu_in_coroutine()) { if (do_read) { return qemu_co_recv(fd, buffer, size); } else { return qemu_co_send(fd, buffer, size); } } while (offset < size) { ssize_t len; if (do_read) { len = qemu_recv(fd, buffer + offset, size - offset, 0); } else { len = send(fd, buffer + offset, size - offset, 0); } if (len == -1) errno = socket_error(); /* recoverable error */ if (len == -1 && (errno == EAGAIN || errno == EINTR)) { continue; } /* eof */ if (len == 0) { break; } /* unrecoverable error */ if (len == -1) { return 0; } offset += len; } return offset; }
false
qemu
fc19f8a02e45c4d8ad24dd7eb374330b03dfc28e
size_t nbd_wr_sync(int fd, void *buffer, size_t size, bool do_read) { size_t offset = 0; if (qemu_in_coroutine()) { if (do_read) { return qemu_co_recv(fd, buffer, size); } else { return qemu_co_send(fd, buffer, size); } } while (offset < size) { ssize_t len; if (do_read) { len = qemu_recv(fd, buffer + offset, size - offset, 0); } else { len = send(fd, buffer + offset, size - offset, 0); } if (len == -1) errno = socket_error(); if (len == -1 && (errno == EAGAIN || errno == EINTR)) { continue; } if (len == 0) { break; } if (len == -1) { return 0; } offset += len; } return offset; }
{ "code": [], "line_no": [] }
size_t FUNC_0(int fd, void *buffer, size_t size, bool do_read) { size_t offset = 0; if (qemu_in_coroutine()) { if (do_read) { return qemu_co_recv(fd, buffer, size); } else { return qemu_co_send(fd, buffer, size); } } while (offset < size) { ssize_t len; if (do_read) { len = qemu_recv(fd, buffer + offset, size - offset, 0); } else { len = send(fd, buffer + offset, size - offset, 0); } if (len == -1) errno = socket_error(); if (len == -1 && (errno == EAGAIN || errno == EINTR)) { continue; } if (len == 0) { break; } if (len == -1) { return 0; } offset += len; } return offset; }
[ "size_t FUNC_0(int fd, void *buffer, size_t size, bool do_read)\n{", "size_t offset = 0;", "if (qemu_in_coroutine()) {", "if (do_read) {", "return qemu_co_recv(fd, buffer, size);", "} else {", "return qemu_co_send(fd, buffer, size);", "}", "}", "while (offset < size) {", "ssize_t len;", "if (do_read) {", "len = qemu_recv(fd, buffer + offset, size - offset, 0);", "} else {", "len = send(fd, buffer + offset, size - offset, 0);", "}", "if (len == -1)\nerrno = socket_error();", "if (len == -1 && (errno == EAGAIN || errno == EINTR)) {", "continue;", "}", "if (len == 0) {", "break;", "}", "if (len == -1) {", "return 0;", "}", "offset += len;", "}", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ] ]
9,740
static uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len) { VFIODevice *vdev = DO_UPCAST(VFIODevice, pdev, pdev); uint32_t val = 0; /* * We only need QEMU PCI config support for the ROM BAR, the MSI and MSIX * capabilities, and the multifunction bit below. We let VFIO handle * virtualizing everything else. Performance is not a concern here. */ if (ranges_overlap(addr, len, PCI_ROM_ADDRESS, 4) || (pdev->cap_present & QEMU_PCI_CAP_MSIX && ranges_overlap(addr, len, pdev->msix_cap, MSIX_CAP_LENGTH)) || (pdev->cap_present & QEMU_PCI_CAP_MSI && ranges_overlap(addr, len, pdev->msi_cap, vdev->msi_cap_size))) { val = pci_default_read_config(pdev, addr, len); } else { if (pread(vdev->fd, &val, len, vdev->config_offset + addr) != len) { error_report("%s(%04x:%02x:%02x.%x, 0x%x, 0x%x) failed: %m", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, addr, len); return -errno; } val = le32_to_cpu(val); } /* Multifunction bit is virualized in QEMU */ if (unlikely(ranges_overlap(addr, len, PCI_HEADER_TYPE, 1))) { uint32_t mask = PCI_HEADER_TYPE_MULTI_FUNCTION; if (len == 4) { mask <<= 16; } if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { val |= mask; } else { val &= ~mask; } } DPRINTF("%s(%04x:%02x:%02x.%x, @0x%x, len=0x%x) %x\n", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, addr, len, val); return val; }
false
qemu
4b5d5e87c7ab2e979a2cad6c8e01bcae55b85f1c
static uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len) { VFIODevice *vdev = DO_UPCAST(VFIODevice, pdev, pdev); uint32_t val = 0; if (ranges_overlap(addr, len, PCI_ROM_ADDRESS, 4) || (pdev->cap_present & QEMU_PCI_CAP_MSIX && ranges_overlap(addr, len, pdev->msix_cap, MSIX_CAP_LENGTH)) || (pdev->cap_present & QEMU_PCI_CAP_MSI && ranges_overlap(addr, len, pdev->msi_cap, vdev->msi_cap_size))) { val = pci_default_read_config(pdev, addr, len); } else { if (pread(vdev->fd, &val, len, vdev->config_offset + addr) != len) { error_report("%s(%04x:%02x:%02x.%x, 0x%x, 0x%x) failed: %m", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, addr, len); return -errno; } val = le32_to_cpu(val); } if (unlikely(ranges_overlap(addr, len, PCI_HEADER_TYPE, 1))) { uint32_t mask = PCI_HEADER_TYPE_MULTI_FUNCTION; if (len == 4) { mask <<= 16; } if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { val |= mask; } else { val &= ~mask; } } DPRINTF("%s(%04x:%02x:%02x.%x, @0x%x, len=0x%x) %x\n", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, addr, len, val); return val; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(PCIDevice *pdev, uint32_t addr, int len) { VFIODevice *vdev = DO_UPCAST(VFIODevice, pdev, pdev); uint32_t val = 0; if (ranges_overlap(addr, len, PCI_ROM_ADDRESS, 4) || (pdev->cap_present & QEMU_PCI_CAP_MSIX && ranges_overlap(addr, len, pdev->msix_cap, MSIX_CAP_LENGTH)) || (pdev->cap_present & QEMU_PCI_CAP_MSI && ranges_overlap(addr, len, pdev->msi_cap, vdev->msi_cap_size))) { val = pci_default_read_config(pdev, addr, len); } else { if (pread(vdev->fd, &val, len, vdev->config_offset + addr) != len) { error_report("%s(%04x:%02x:%02x.%x, 0x%x, 0x%x) failed: %m", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, addr, len); return -errno; } val = le32_to_cpu(val); } if (unlikely(ranges_overlap(addr, len, PCI_HEADER_TYPE, 1))) { uint32_t mask = PCI_HEADER_TYPE_MULTI_FUNCTION; if (len == 4) { mask <<= 16; } if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { val |= mask; } else { val &= ~mask; } } DPRINTF("%s(%04x:%02x:%02x.%x, @0x%x, len=0x%x) %x\n", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, addr, len, val); return val; }
[ "static uint32_t FUNC_0(PCIDevice *pdev, uint32_t addr, int len)\n{", "VFIODevice *vdev = DO_UPCAST(VFIODevice, pdev, pdev);", "uint32_t val = 0;", "if (ranges_overlap(addr, len, PCI_ROM_ADDRESS, 4) ||\n(pdev->cap_present & QEMU_PCI_CAP_MSIX &&\nranges_overlap(addr, len, pdev->msix_cap, MSIX_CAP_LENGTH)) ||\n(pdev->cap_present & QEMU_PCI_CAP_MSI &&\nranges_overlap(addr, len, pdev->msi_cap, vdev->msi_cap_size))) {", "val = pci_default_read_config(pdev, addr, len);", "} else {", "if (pread(vdev->fd, &val, len, vdev->config_offset + addr) != len) {", "error_report(\"%s(%04x:%02x:%02x.%x, 0x%x, 0x%x) failed: %m\",\n__func__, vdev->host.domain, vdev->host.bus,\nvdev->host.slot, vdev->host.function, addr, len);", "return -errno;", "}", "val = le32_to_cpu(val);", "}", "if (unlikely(ranges_overlap(addr, len, PCI_HEADER_TYPE, 1))) {", "uint32_t mask = PCI_HEADER_TYPE_MULTI_FUNCTION;", "if (len == 4) {", "mask <<= 16;", "}", "if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) {", "val |= mask;", "} else {", "val &= ~mask;", "}", "}", "DPRINTF(\"%s(%04x:%02x:%02x.%x, @0x%x, len=0x%x) %x\\n\", __func__,\nvdev->host.domain, vdev->host.bus, vdev->host.slot,\nvdev->host.function, addr, len, val);", "return val;", "}" ]
[ 0, 0, 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 ], [ 21, 23, 25, 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87, 89 ], [ 93 ], [ 95 ] ]
9,741
static void x86_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); X86CPU *cpu = X86_CPU(dev); X86CPUClass *xcc = X86_CPU_GET_CLASS(dev); CPUX86State *env = &cpu->env; Error *local_err = NULL; static bool ht_warned; if (xcc->kvm_required && !kvm_enabled()) { char *name = x86_cpu_class_get_model_name(xcc); error_setg(&local_err, "CPU model '%s' requires KVM", name); g_free(name); goto out; } if (cpu->apic_id == UNASSIGNED_APIC_ID) { error_setg(errp, "apic-id property was not initialized properly"); return; } x86_cpu_expand_features(cpu, &local_err); if (local_err) { goto out; } if (x86_cpu_filter_features(cpu) && (cpu->check_cpuid || cpu->enforce_cpuid)) { x86_cpu_report_filtered_features(cpu); if (cpu->enforce_cpuid) { error_setg(&local_err, kvm_enabled() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); goto out; } } /* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on * CPUID[1].EDX. */ if (IS_AMD_CPU(env)) { env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES; env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX] & CPUID_EXT2_AMD_ALIASES); } /* For 64bit systems think about the number of physical bits to present. * ideally this should be the same as the host; anything other than matching * the host can cause incorrect guest behaviour. * QEMU used to pick the magic value of 40 bits that corresponds to * consumer AMD devices but nothing else. */ if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { if (kvm_enabled()) { uint32_t host_phys_bits = x86_host_phys_bits(); static bool warned; if (cpu->host_phys_bits) { /* The user asked for us to use the host physical bits */ cpu->phys_bits = host_phys_bits; } /* Print a warning if the user set it to a value that's not the * host value. */ if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 && !warned) { error_report("Warning: Host physical bits (%u)" " does not match phys-bits property (%u)", host_phys_bits, cpu->phys_bits); warned = true; } if (cpu->phys_bits && (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS || cpu->phys_bits < 32)) { error_setg(errp, "phys-bits should be between 32 and %u " " (but is %u)", TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits); return; } } else { if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) { error_setg(errp, "TCG only supports phys-bits=%u", TCG_PHYS_ADDR_BITS); return; } } /* 0 means it was not explicitly set by the user (or by machine * compat_props or by the host code above). In this case, the default * is the value used by TCG (40). */ if (cpu->phys_bits == 0) { cpu->phys_bits = TCG_PHYS_ADDR_BITS; } } else { /* For 32 bit systems don't use the user set value, but keep * phys_bits consistent with what we tell the guest. */ if (cpu->phys_bits != 0) { error_setg(errp, "phys-bits is not user-configurable in 32 bit"); return; } if (env->features[FEAT_1_EDX] & CPUID_PSE36) { cpu->phys_bits = 36; } else { cpu->phys_bits = 32; } } cpu_exec_realizefn(cs, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } if (tcg_enabled()) { tcg_x86_init(); } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_create(cpu, &local_err); if (local_err != NULL) { goto out; } } #endif mce_init(cpu); #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { AddressSpace *as_normal = address_space_init_shareable(cs->memory, "cpu-memory"); AddressSpace *as_smm = g_new(AddressSpace, 1); cpu->cpu_as_mem = g_new(MemoryRegion, 1); cpu->cpu_as_root = g_new(MemoryRegion, 1); /* Outer container... */ memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull); memory_region_set_enabled(cpu->cpu_as_root, true); /* ... with two regions inside: normal system memory with low * priority, and... */ memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory", get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); address_space_init(as_smm, cpu->cpu_as_root, "CPU"); cs->num_ases = 2; cpu_address_space_init(cs, as_normal, 0); cpu_address_space_init(cs, as_smm, 1); /* ... SMRAM with higher priority, linked from /machine/smram. */ cpu->machine_done.notify = x86_cpu_machine_done; qemu_add_machine_init_done_notifier(&cpu->machine_done); } #endif qemu_init_vcpu(cs); /* Only Intel CPUs support hyperthreading. Even though QEMU fixes this * issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX * based on inputs (sockets,cores,threads), it is still better to gives * users a warning. * * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise * cs->nr_threads hasn't be populated yet and the checking is incorrect. */ if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) { error_report("AMD CPU doesn't support hyperthreading. Please configure" " -smp options properly."); ht_warned = true; } x86_cpu_apic_realize(cpu, &local_err); if (local_err != NULL) { goto out; } cpu_reset(cs); xcc->parent_realize(dev, &local_err); out: if (local_err != NULL) { error_propagate(errp, local_err); return; } }
false
qemu
3dc6f8693694a649a9c83f1e2746565b47683923
static void x86_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); X86CPU *cpu = X86_CPU(dev); X86CPUClass *xcc = X86_CPU_GET_CLASS(dev); CPUX86State *env = &cpu->env; Error *local_err = NULL; static bool ht_warned; if (xcc->kvm_required && !kvm_enabled()) { char *name = x86_cpu_class_get_model_name(xcc); error_setg(&local_err, "CPU model '%s' requires KVM", name); g_free(name); goto out; } if (cpu->apic_id == UNASSIGNED_APIC_ID) { error_setg(errp, "apic-id property was not initialized properly"); return; } x86_cpu_expand_features(cpu, &local_err); if (local_err) { goto out; } if (x86_cpu_filter_features(cpu) && (cpu->check_cpuid || cpu->enforce_cpuid)) { x86_cpu_report_filtered_features(cpu); if (cpu->enforce_cpuid) { error_setg(&local_err, kvm_enabled() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); goto out; } } if (IS_AMD_CPU(env)) { env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES; env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX] & CPUID_EXT2_AMD_ALIASES); } if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { if (kvm_enabled()) { uint32_t host_phys_bits = x86_host_phys_bits(); static bool warned; if (cpu->host_phys_bits) { cpu->phys_bits = host_phys_bits; } if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 && !warned) { error_report("Warning: Host physical bits (%u)" " does not match phys-bits property (%u)", host_phys_bits, cpu->phys_bits); warned = true; } if (cpu->phys_bits && (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS || cpu->phys_bits < 32)) { error_setg(errp, "phys-bits should be between 32 and %u " " (but is %u)", TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits); return; } } else { if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) { error_setg(errp, "TCG only supports phys-bits=%u", TCG_PHYS_ADDR_BITS); return; } } if (cpu->phys_bits == 0) { cpu->phys_bits = TCG_PHYS_ADDR_BITS; } } else { if (cpu->phys_bits != 0) { error_setg(errp, "phys-bits is not user-configurable in 32 bit"); return; } if (env->features[FEAT_1_EDX] & CPUID_PSE36) { cpu->phys_bits = 36; } else { cpu->phys_bits = 32; } } cpu_exec_realizefn(cs, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } if (tcg_enabled()) { tcg_x86_init(); } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_create(cpu, &local_err); if (local_err != NULL) { goto out; } } #endif mce_init(cpu); #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { AddressSpace *as_normal = address_space_init_shareable(cs->memory, "cpu-memory"); AddressSpace *as_smm = g_new(AddressSpace, 1); cpu->cpu_as_mem = g_new(MemoryRegion, 1); cpu->cpu_as_root = g_new(MemoryRegion, 1); memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull); memory_region_set_enabled(cpu->cpu_as_root, true); memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory", get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); address_space_init(as_smm, cpu->cpu_as_root, "CPU"); cs->num_ases = 2; cpu_address_space_init(cs, as_normal, 0); cpu_address_space_init(cs, as_smm, 1); cpu->machine_done.notify = x86_cpu_machine_done; qemu_add_machine_init_done_notifier(&cpu->machine_done); } #endif qemu_init_vcpu(cs); if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) { error_report("AMD CPU doesn't support hyperthreading. Please configure" " -smp options properly."); ht_warned = true; } x86_cpu_apic_realize(cpu, &local_err); if (local_err != NULL) { goto out; } cpu_reset(cs); xcc->parent_realize(dev, &local_err); out: if (local_err != NULL) { error_propagate(errp, local_err); return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { CPUState *cs = CPU(VAR_0); X86CPU *cpu = X86_CPU(VAR_0); X86CPUClass *xcc = X86_CPU_GET_CLASS(VAR_0); CPUX86State *env = &cpu->env; Error *local_err = NULL; static bool VAR_2; if (xcc->kvm_required && !kvm_enabled()) { char *VAR_3 = x86_cpu_class_get_model_name(xcc); error_setg(&local_err, "CPU model '%s' requires KVM", VAR_3); g_free(VAR_3); goto out; } if (cpu->apic_id == UNASSIGNED_APIC_ID) { error_setg(VAR_1, "apic-id property was not initialized properly"); return; } x86_cpu_expand_features(cpu, &local_err); if (local_err) { goto out; } if (x86_cpu_filter_features(cpu) && (cpu->check_cpuid || cpu->enforce_cpuid)) { x86_cpu_report_filtered_features(cpu); if (cpu->enforce_cpuid) { error_setg(&local_err, kvm_enabled() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); goto out; } } if (IS_AMD_CPU(env)) { env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES; env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX] & CPUID_EXT2_AMD_ALIASES); } if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { if (kvm_enabled()) { uint32_t host_phys_bits = x86_host_phys_bits(); static bool VAR_4; if (cpu->host_phys_bits) { cpu->phys_bits = host_phys_bits; } if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 && !VAR_4) { error_report("Warning: Host physical bits (%u)" " does not match phys-bits property (%u)", host_phys_bits, cpu->phys_bits); VAR_4 = true; } if (cpu->phys_bits && (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS || cpu->phys_bits < 32)) { error_setg(VAR_1, "phys-bits should be between 32 and %u " " (but is %u)", TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits); return; } } else { if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) { error_setg(VAR_1, "TCG only supports phys-bits=%u", TCG_PHYS_ADDR_BITS); return; } } if (cpu->phys_bits == 0) { cpu->phys_bits = TCG_PHYS_ADDR_BITS; } } else { if (cpu->phys_bits != 0) { error_setg(VAR_1, "phys-bits is not user-configurable in 32 bit"); return; } if (env->features[FEAT_1_EDX] & CPUID_PSE36) { cpu->phys_bits = 36; } else { cpu->phys_bits = 32; } } cpu_exec_realizefn(cs, &local_err); if (local_err != NULL) { error_propagate(VAR_1, local_err); return; } if (tcg_enabled()) { tcg_x86_init(); } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_create(cpu, &local_err); if (local_err != NULL) { goto out; } } #endif mce_init(cpu); #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { AddressSpace *as_normal = address_space_init_shareable(cs->memory, "cpu-memory"); AddressSpace *as_smm = g_new(AddressSpace, 1); cpu->cpu_as_mem = g_new(MemoryRegion, 1); cpu->cpu_as_root = g_new(MemoryRegion, 1); memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull); memory_region_set_enabled(cpu->cpu_as_root, true); memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory", get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); address_space_init(as_smm, cpu->cpu_as_root, "CPU"); cs->num_ases = 2; cpu_address_space_init(cs, as_normal, 0); cpu_address_space_init(cs, as_smm, 1); cpu->machine_done.notify = x86_cpu_machine_done; qemu_add_machine_init_done_notifier(&cpu->machine_done); } #endif qemu_init_vcpu(cs); if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !VAR_2) { error_report("AMD CPU doesn't support hyperthreading. Please configure" " -smp options properly."); VAR_2 = true; } x86_cpu_apic_realize(cpu, &local_err); if (local_err != NULL) { goto out; } cpu_reset(cs); xcc->parent_realize(VAR_0, &local_err); out: if (local_err != NULL) { error_propagate(VAR_1, local_err); return; } }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "CPUState *cs = CPU(VAR_0);", "X86CPU *cpu = X86_CPU(VAR_0);", "X86CPUClass *xcc = X86_CPU_GET_CLASS(VAR_0);", "CPUX86State *env = &cpu->env;", "Error *local_err = NULL;", "static bool VAR_2;", "if (xcc->kvm_required && !kvm_enabled()) {", "char *VAR_3 = x86_cpu_class_get_model_name(xcc);", "error_setg(&local_err, \"CPU model '%s' requires KVM\", VAR_3);", "g_free(VAR_3);", "goto out;", "}", "if (cpu->apic_id == UNASSIGNED_APIC_ID) {", "error_setg(VAR_1, \"apic-id property was not initialized properly\");", "return;", "}", "x86_cpu_expand_features(cpu, &local_err);", "if (local_err) {", "goto out;", "}", "if (x86_cpu_filter_features(cpu) &&\n(cpu->check_cpuid || cpu->enforce_cpuid)) {", "x86_cpu_report_filtered_features(cpu);", "if (cpu->enforce_cpuid) {", "error_setg(&local_err,\nkvm_enabled() ?\n\"Host doesn't support requested features\" :\n\"TCG doesn't support requested features\");", "goto out;", "}", "}", "if (IS_AMD_CPU(env)) {", "env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES;", "env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX]\n& CPUID_EXT2_AMD_ALIASES);", "}", "if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) {", "if (kvm_enabled()) {", "uint32_t host_phys_bits = x86_host_phys_bits();", "static bool VAR_4;", "if (cpu->host_phys_bits) {", "cpu->phys_bits = host_phys_bits;", "}", "if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 &&\n!VAR_4) {", "error_report(\"Warning: Host physical bits (%u)\"\n\" does not match phys-bits property (%u)\",\nhost_phys_bits, cpu->phys_bits);", "VAR_4 = true;", "}", "if (cpu->phys_bits &&\n(cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS ||\ncpu->phys_bits < 32)) {", "error_setg(VAR_1, \"phys-bits should be between 32 and %u \"\n\" (but is %u)\",\nTARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits);", "return;", "}", "} else {", "if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) {", "error_setg(VAR_1, \"TCG only supports phys-bits=%u\",\nTCG_PHYS_ADDR_BITS);", "return;", "}", "}", "if (cpu->phys_bits == 0) {", "cpu->phys_bits = TCG_PHYS_ADDR_BITS;", "}", "} else {", "if (cpu->phys_bits != 0) {", "error_setg(VAR_1, \"phys-bits is not user-configurable in 32 bit\");", "return;", "}", "if (env->features[FEAT_1_EDX] & CPUID_PSE36) {", "cpu->phys_bits = 36;", "} else {", "cpu->phys_bits = 32;", "}", "}", "cpu_exec_realizefn(cs, &local_err);", "if (local_err != NULL) {", "error_propagate(VAR_1, local_err);", "return;", "}", "if (tcg_enabled()) {", "tcg_x86_init();", "}", "#ifndef CONFIG_USER_ONLY\nqemu_register_reset(x86_cpu_machine_reset_cb, cpu);", "if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) {", "x86_cpu_apic_create(cpu, &local_err);", "if (local_err != NULL) {", "goto out;", "}", "}", "#endif\nmce_init(cpu);", "#ifndef CONFIG_USER_ONLY\nif (tcg_enabled()) {", "AddressSpace *as_normal = address_space_init_shareable(cs->memory,\n\"cpu-memory\");", "AddressSpace *as_smm = g_new(AddressSpace, 1);", "cpu->cpu_as_mem = g_new(MemoryRegion, 1);", "cpu->cpu_as_root = g_new(MemoryRegion, 1);", "memory_region_init(cpu->cpu_as_root, OBJECT(cpu), \"memory\", ~0ull);", "memory_region_set_enabled(cpu->cpu_as_root, true);", "memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), \"memory\",\nget_system_memory(), 0, ~0ull);", "memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0);", "memory_region_set_enabled(cpu->cpu_as_mem, true);", "address_space_init(as_smm, cpu->cpu_as_root, \"CPU\");", "cs->num_ases = 2;", "cpu_address_space_init(cs, as_normal, 0);", "cpu_address_space_init(cs, as_smm, 1);", "cpu->machine_done.notify = x86_cpu_machine_done;", "qemu_add_machine_init_done_notifier(&cpu->machine_done);", "}", "#endif\nqemu_init_vcpu(cs);", "if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !VAR_2) {", "error_report(\"AMD CPU doesn't support hyperthreading. Please configure\"\n\" -smp options properly.\");", "VAR_2 = true;", "}", "x86_cpu_apic_realize(cpu, &local_err);", "if (local_err != NULL) {", "goto out;", "}", "cpu_reset(cs);", "xcc->parent_realize(VAR_0, &local_err);", "out:\nif (local_err != NULL) {", "error_propagate(VAR_1, local_err);", "return;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 133, 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 149, 151, 153 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 243, 245 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 265 ], [ 269, 271 ], [ 273, 275 ], [ 277 ], [ 281 ], [ 283 ], [ 289 ], [ 291 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315 ], [ 317 ], [ 323 ], [ 325 ], [ 327 ], [ 329, 333 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 377 ], [ 381, 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ] ]
9,742
static void pci_realview_class_init(ObjectClass *class, void *data) { DeviceClass *dc = DEVICE_CLASS(class); /* Reason: object_unref() hangs */ dc->cannot_destroy_with_object_finalize_yet = true; }
false
qemu
d28fca153bb27ff965b9eb26d73327fa4d2402c8
static void pci_realview_class_init(ObjectClass *class, void *data) { DeviceClass *dc = DEVICE_CLASS(class); dc->cannot_destroy_with_object_finalize_yet = true; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->cannot_destroy_with_object_finalize_yet = true; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->cannot_destroy_with_object_finalize_yet = true;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ] ]
9,746
static int disas_thumb2_insn(DisasContext *s, uint32_t insn) { uint32_t imm, shift, offset; uint32_t rd, rn, rm, rs; TCGv_i32 tmp; TCGv_i32 tmp2; TCGv_i32 tmp3; TCGv_i32 addr; TCGv_i64 tmp64; int op; int shiftop; int conds; int logic_cc; /* The only 32 bit insn that's allowed for Thumb1 is the combined * BL/BLX prefix and suffix. */ if ((insn & 0xf800e800) != 0xf000e800) { ARCH(6T2); } rn = (insn >> 16) & 0xf; rs = (insn >> 12) & 0xf; rd = (insn >> 8) & 0xf; rm = insn & 0xf; switch ((insn >> 25) & 0xf) { case 0: case 1: case 2: case 3: /* 16-bit instructions. Should never happen. */ abort(); case 4: if (insn & (1 << 22)) { /* 0b1110_100x_x1xx_xxxx_xxxx_xxxx_xxxx_xxxx * - load/store doubleword, load/store exclusive, ldacq/strel, * table branch. */ if (insn == 0xe97fe97f && arm_dc_feature(s, ARM_FEATURE_M) && arm_dc_feature(s, ARM_FEATURE_V8)) { /* 0b1110_1001_0111_1111_1110_1001_0111_111 * - SG (v8M only) * The bulk of the behaviour for this instruction is implemented * in v7m_handle_execute_nsc(), which deals with the insn when * it is executed by a CPU in non-secure state from memory * which is Secure & NonSecure-Callable. * Here we only need to handle the remaining cases: * * in NS memory (including the "security extension not * implemented" case) : NOP * * in S memory but CPU already secure (clear IT bits) * We know that the attribute for the memory this insn is * in must match the current CPU state, because otherwise * get_phys_addr_pmsav8 would have generated an exception. */ if (s->v8m_secure) { /* Like the IT insn, we don't need to generate any code */ s->condexec_cond = 0; s->condexec_mask = 0; } } else if (insn & 0x01200000) { /* 0b1110_1000_x11x_xxxx_xxxx_xxxx_xxxx_xxxx * - load/store dual (post-indexed) * 0b1111_1001_x10x_xxxx_xxxx_xxxx_xxxx_xxxx * - load/store dual (literal and immediate) * 0b1111_1001_x11x_xxxx_xxxx_xxxx_xxxx_xxxx * - load/store dual (pre-indexed) */ if (rn == 15) { if (insn & (1 << 21)) { /* UNPREDICTABLE */ goto illegal_op; } addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, s->pc & ~3); } else { addr = load_reg(s, rn); } offset = (insn & 0xff) * 4; if ((insn & (1 << 23)) == 0) offset = -offset; if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, offset); offset = 0; } if (insn & (1 << 20)) { /* ldrd */ tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); store_reg(s, rs, tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); store_reg(s, rd, tmp); } else { /* strd */ tmp = load_reg(s, rs); gen_aa32_st32(s, tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = load_reg(s, rd); gen_aa32_st32(s, tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } if (insn & (1 << 21)) { /* Base writeback. */ tcg_gen_addi_i32(addr, addr, offset - 4); store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } } else if ((insn & (1 << 23)) == 0) { /* 0b1110_1000_010x_xxxx_xxxx_xxxx_xxxx_xxxx * - load/store exclusive word */ if (rs == 15) { goto illegal_op; } addr = tcg_temp_local_new_i32(); load_reg_var(s, addr, rn); tcg_gen_addi_i32(addr, addr, (insn & 0xff) << 2); if (insn & (1 << 20)) { gen_load_exclusive(s, rs, 15, addr, 2); } else { gen_store_exclusive(s, rd, rs, 15, addr, 2); } tcg_temp_free_i32(addr); } else if ((insn & (7 << 5)) == 0) { /* Table Branch. */ if (rn == 15) { addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, s->pc); } else { addr = load_reg(s, rn); } tmp = load_reg(s, rm); tcg_gen_add_i32(addr, addr, tmp); if (insn & (1 << 4)) { /* tbh */ tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); tmp = tcg_temp_new_i32(); gen_aa32_ld16u(s, tmp, addr, get_mem_index(s)); } else { /* tbb */ tcg_temp_free_i32(tmp); tmp = tcg_temp_new_i32(); gen_aa32_ld8u(s, tmp, addr, get_mem_index(s)); } tcg_temp_free_i32(addr); tcg_gen_shli_i32(tmp, tmp, 1); tcg_gen_addi_i32(tmp, tmp, s->pc); store_reg(s, 15, tmp); } else { int op2 = (insn >> 6) & 0x3; op = (insn >> 4) & 0x3; switch (op2) { case 0: goto illegal_op; case 1: /* Load/store exclusive byte/halfword/doubleword */ if (op == 2) { goto illegal_op; } ARCH(7); break; case 2: /* Load-acquire/store-release */ if (op == 3) { goto illegal_op; } /* Fall through */ case 3: /* Load-acquire/store-release exclusive */ ARCH(8); break; } addr = tcg_temp_local_new_i32(); load_reg_var(s, addr, rn); if (!(op2 & 1)) { if (insn & (1 << 20)) { tmp = tcg_temp_new_i32(); switch (op) { case 0: /* ldab */ gen_aa32_ld8u_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 1: /* ldah */ gen_aa32_ld16u_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 2: /* lda */ gen_aa32_ld32u_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; default: abort(); } store_reg(s, rs, tmp); } else { tmp = load_reg(s, rs); switch (op) { case 0: /* stlb */ gen_aa32_st8_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 1: /* stlh */ gen_aa32_st16_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 2: /* stl */ gen_aa32_st32_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; default: abort(); } tcg_temp_free_i32(tmp); } } else if (insn & (1 << 20)) { gen_load_exclusive(s, rs, rd, addr, op); } else { gen_store_exclusive(s, rm, rs, rd, addr, op); } tcg_temp_free_i32(addr); } } else { /* Load/store multiple, RFE, SRS. */ if (((insn >> 23) & 1) == ((insn >> 24) & 1)) { /* RFE, SRS: not available in user mode or on M profile */ if (IS_USER(s) || arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (insn & (1 << 20)) { /* rfe */ addr = load_reg(s, rn); if ((insn & (1 << 24)) == 0) tcg_gen_addi_i32(addr, addr, -8); /* Load PC into tmp and CPSR into tmp2. */ tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); tcg_gen_addi_i32(addr, addr, 4); tmp2 = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp2, addr, get_mem_index(s)); if (insn & (1 << 21)) { /* Base writeback. */ if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, 4); } else { tcg_gen_addi_i32(addr, addr, -4); } store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } gen_rfe(s, tmp, tmp2); } else { /* srs */ gen_srs(s, (insn & 0x1f), (insn & (1 << 24)) ? 1 : 2, insn & (1 << 21)); } } else { int i, loaded_base = 0; TCGv_i32 loaded_var; /* Load/store multiple. */ addr = load_reg(s, rn); offset = 0; for (i = 0; i < 16; i++) { if (insn & (1 << i)) offset += 4; } if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, -offset); } TCGV_UNUSED_I32(loaded_var); for (i = 0; i < 16; i++) { if ((insn & (1 << i)) == 0) continue; if (insn & (1 << 20)) { /* Load. */ tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); if (i == 15) { gen_bx_excret(s, tmp); } else if (i == rn) { loaded_var = tmp; loaded_base = 1; } else { store_reg(s, i, tmp); } } else { /* Store. */ tmp = load_reg(s, i); gen_aa32_st32(s, tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } tcg_gen_addi_i32(addr, addr, 4); } if (loaded_base) { store_reg(s, rn, loaded_var); } if (insn & (1 << 21)) { /* Base register writeback. */ if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, -offset); } /* Fault if writeback register is in register list. */ if (insn & (1 << rn)) goto illegal_op; store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } } } break; case 5: op = (insn >> 21) & 0xf; if (op == 6) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } /* Halfword pack. */ tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); shift = ((insn >> 10) & 0x1c) | ((insn >> 6) & 0x3); if (insn & (1 << 5)) { /* pkhtb */ if (shift == 0) shift = 31; tcg_gen_sari_i32(tmp2, tmp2, shift); tcg_gen_andi_i32(tmp, tmp, 0xffff0000); tcg_gen_ext16u_i32(tmp2, tmp2); } else { /* pkhbt */ if (shift) tcg_gen_shli_i32(tmp2, tmp2, shift); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); } tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else { /* Data processing register constant shift. */ if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(s, rn); } tmp2 = load_reg(s, rm); shiftop = (insn >> 4) & 3; shift = ((insn >> 6) & 3) | ((insn >> 10) & 0x1c); conds = (insn & (1 << 20)) != 0; logic_cc = (conds && thumb2_logic_op(op)); gen_arm_shift_im(tmp2, shiftop, shift, logic_cc); if (gen_thumb2_data_op(s, op, conds, 0, tmp, tmp2)) goto illegal_op; tcg_temp_free_i32(tmp2); if (rd != 15) { store_reg(s, rd, tmp); } else { tcg_temp_free_i32(tmp); } } break; case 13: /* Misc data processing. */ op = ((insn >> 22) & 6) | ((insn >> 7) & 1); if (op < 4 && (insn & 0xf000) != 0xf000) goto illegal_op; switch (op) { case 0: /* Register controlled shift. */ tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); if ((insn & 0x70) != 0) goto illegal_op; op = (insn >> 21) & 3; logic_cc = (insn & (1 << 20)) != 0; gen_arm_shift_reg(tmp, op, tmp2, logic_cc); if (logic_cc) gen_logic_CC(tmp); store_reg(s, rd, tmp); break; case 1: /* Sign/zero extend. */ op = (insn >> 20) & 7; switch (op) { case 0: /* SXTAH, SXTH */ case 1: /* UXTAH, UXTH */ case 4: /* SXTAB, SXTB */ case 5: /* UXTAB, UXTB */ break; case 2: /* SXTAB16, SXTB16 */ case 3: /* UXTAB16, UXTB16 */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; default: goto illegal_op; } if (rn != 15) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } } tmp = load_reg(s, rm); shift = (insn >> 4) & 3; /* ??? In many cases it's not necessary to do a rotate, a shift is sufficient. */ if (shift != 0) tcg_gen_rotri_i32(tmp, tmp, shift * 8); op = (insn >> 20) & 7; switch (op) { case 0: gen_sxth(tmp); break; case 1: gen_uxth(tmp); break; case 2: gen_sxtb16(tmp); break; case 3: gen_uxtb16(tmp); break; case 4: gen_sxtb(tmp); break; case 5: gen_uxtb(tmp); break; default: g_assert_not_reached(); } if (rn != 15) { tmp2 = load_reg(s, rn); if ((op >> 1) == 1) { gen_add16(tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } } store_reg(s, rd, tmp); break; case 2: /* SIMD add/subtract. */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } op = (insn >> 20) & 7; shift = (insn >> 4) & 7; if ((op & 3) == 3 || (shift & 3) == 3) goto illegal_op; tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); gen_thumb2_parallel_addsub(op, shift, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 3: /* Other data processing. */ op = ((insn >> 17) & 0x38) | ((insn >> 4) & 7); if (op < 4) { /* Saturating add/subtract. */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); if (op & 1) gen_helper_double_saturate(tmp, cpu_env, tmp); if (op & 2) gen_helper_sub_saturate(tmp, cpu_env, tmp2, tmp); else gen_helper_add_saturate(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } else { switch (op) { case 0x0a: /* rbit */ case 0x08: /* rev */ case 0x09: /* rev16 */ case 0x0b: /* revsh */ case 0x18: /* clz */ break; case 0x10: /* sel */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; case 0x20: /* crc32/crc32c */ case 0x21: case 0x22: case 0x28: case 0x29: case 0x2a: if (!arm_dc_feature(s, ARM_FEATURE_CRC)) { goto illegal_op; } break; default: goto illegal_op; } tmp = load_reg(s, rn); switch (op) { case 0x0a: /* rbit */ gen_helper_rbit(tmp, tmp); break; case 0x08: /* rev */ tcg_gen_bswap32_i32(tmp, tmp); break; case 0x09: /* rev16 */ gen_rev16(tmp); break; case 0x0b: /* revsh */ gen_revsh(tmp); break; case 0x10: /* sel */ tmp2 = load_reg(s, rm); tmp3 = tcg_temp_new_i32(); tcg_gen_ld_i32(tmp3, cpu_env, offsetof(CPUARMState, GE)); gen_helper_sel_flags(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); tcg_temp_free_i32(tmp2); break; case 0x18: /* clz */ tcg_gen_clzi_i32(tmp, tmp, 32); break; case 0x20: case 0x21: case 0x22: case 0x28: case 0x29: case 0x2a: { /* crc32/crc32c */ uint32_t sz = op & 0x3; uint32_t c = op & 0x8; tmp2 = load_reg(s, rm); if (sz == 0) { tcg_gen_andi_i32(tmp2, tmp2, 0xff); } else if (sz == 1) { tcg_gen_andi_i32(tmp2, tmp2, 0xffff); } tmp3 = tcg_const_i32(1 << sz); if (c) { gen_helper_crc32c(tmp, tmp, tmp2, tmp3); } else { gen_helper_crc32(tmp, tmp, tmp2, tmp3); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; } default: g_assert_not_reached(); } } store_reg(s, rd, tmp); break; case 4: case 5: /* 32-bit multiply. Sum of absolute differences. */ switch ((insn >> 20) & 7) { case 0: /* 32 x 32 -> 32 */ case 7: /* Unsigned sum of absolute differences. */ break; case 1: /* 16 x 16 -> 32 */ case 2: /* Dual multiply add. */ case 3: /* 32 * 16 -> 32msb */ case 4: /* Dual multiply subtract. */ case 5: case 6: /* 32 * 32 -> 32msb (SMMUL, SMMLA, SMMLS) */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; } op = (insn >> 4) & 0xf; tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); switch ((insn >> 20) & 7) { case 0: /* 32 x 32 -> 32 */ tcg_gen_mul_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); if (op) tcg_gen_sub_i32(tmp, tmp2, tmp); else tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 1: /* 16 x 16 -> 32 */ gen_mulxy(tmp, tmp2, op & 2, op & 1); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 2: /* Dual multiply add. */ case 4: /* Dual multiply subtract. */ if (op) gen_swap_half(tmp2); gen_smul_dual(tmp, tmp2); if (insn & (1 << 22)) { /* This subtraction cannot overflow. */ tcg_gen_sub_i32(tmp, tmp, tmp2); } else { /* This addition cannot overflow 32 bits; * however it may overflow considered as a signed * operation, in which case we must set the Q flag. */ gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); } tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 3: /* 32 * 16 -> 32msb */ if (op) tcg_gen_sari_i32(tmp2, tmp2, 16); else gen_sxth(tmp2); tmp64 = gen_muls_i64_i32(tmp, tmp2); tcg_gen_shri_i64(tmp64, tmp64, 16); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); if (rs != 15) { tmp2 = load_reg(s, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 5: case 6: /* 32 * 32 -> 32msb (SMMUL, SMMLA, SMMLS) */ tmp64 = gen_muls_i64_i32(tmp, tmp2); if (rs != 15) { tmp = load_reg(s, rs); if (insn & (1 << 20)) { tmp64 = gen_addq_msw(tmp64, tmp); } else { tmp64 = gen_subq_msw(tmp64, tmp); } } if (insn & (1 << 4)) { tcg_gen_addi_i64(tmp64, tmp64, 0x80000000u); } tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); break; case 7: /* Unsigned sum of absolute differences. */ gen_helper_usad8(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; } store_reg(s, rd, tmp); break; case 6: case 7: /* 64-bit multiply, Divide. */ op = ((insn >> 4) & 0xf) | ((insn >> 16) & 0x70); tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); if ((op & 0x50) == 0x10) { /* sdiv, udiv */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DIV)) { goto illegal_op; } if (op & 0x20) gen_helper_udiv(tmp, tmp, tmp2); else gen_helper_sdiv(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else if ((op & 0xe) == 0xc) { /* Dual multiply accumulate long. */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } if (op & 1) gen_swap_half(tmp2); gen_smul_dual(tmp, tmp2); if (op & 0x10) { tcg_gen_sub_i32(tmp, tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp2); /* BUGFIX */ tmp64 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_temp_free_i32(tmp); gen_addq(s, tmp64, rs, rd); gen_storeq_reg(s, rs, rd, tmp64); tcg_temp_free_i64(tmp64); } else { if (op & 0x20) { /* Unsigned 64-bit multiply */ tmp64 = gen_mulu_i64_i32(tmp, tmp2); } else { if (op & 8) { /* smlalxy */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); goto illegal_op; } gen_mulxy(tmp, tmp2, op & 2, op & 1); tcg_temp_free_i32(tmp2); tmp64 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_temp_free_i32(tmp); } else { /* Signed 64-bit multiply */ tmp64 = gen_muls_i64_i32(tmp, tmp2); } } if (op & 4) { /* umaal */ if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i64(tmp64); goto illegal_op; } gen_addq_lo(s, tmp64, rs); gen_addq_lo(s, tmp64, rd); } else if (op & 0x40) { /* 64-bit accumulate. */ gen_addq(s, tmp64, rs, rd); } gen_storeq_reg(s, rs, rd, tmp64); tcg_temp_free_i64(tmp64); } break; } break; case 6: case 7: case 14: case 15: /* Coprocessor. */ if (arm_dc_feature(s, ARM_FEATURE_M)) { /* We don't currently implement M profile FP support, * so this entire space should give a NOCP fault. */ gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), default_exception_el(s)); break; } if (((insn >> 24) & 3) == 3) { /* Translate into the equivalent ARM encoding. */ insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); if (disas_neon_data_insn(s, insn)) { goto illegal_op; } } else if (((insn >> 8) & 0xe) == 10) { if (disas_vfp_insn(s, insn)) { goto illegal_op; } } else { if (insn & (1 << 28)) goto illegal_op; if (disas_coproc_insn(s, insn)) { goto illegal_op; } } break; case 8: case 9: case 10: case 11: if (insn & (1 << 15)) { /* Branches, misc control. */ if (insn & 0x5000) { /* Unconditional branch. */ /* signextend(hw1[10:0]) -> offset[:12]. */ offset = ((int32_t)insn << 5) >> 9 & ~(int32_t)0xfff; /* hw1[10:0] -> offset[11:1]. */ offset |= (insn & 0x7ff) << 1; /* (~hw2[13, 11] ^ offset[24]) -> offset[23,22] offset[24:22] already have the same value because of the sign extension above. */ offset ^= ((~insn) & (1 << 13)) << 10; offset ^= ((~insn) & (1 << 11)) << 11; if (insn & (1 << 14)) { /* Branch and link. */ tcg_gen_movi_i32(cpu_R[14], s->pc | 1); } offset += s->pc; if (insn & (1 << 12)) { /* b/bl */ gen_jmp(s, offset); } else { /* blx */ offset &= ~(uint32_t)2; /* thumb2 bx, no need to check */ gen_bx_im(s, offset); } } else if (((insn >> 23) & 7) == 7) { /* Misc control */ if (insn & (1 << 13)) goto illegal_op; if (insn & (1 << 26)) { if (arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (!(insn & (1 << 20))) { /* Hypervisor call (v7) */ int imm16 = extract32(insn, 16, 4) << 12 | extract32(insn, 0, 12); ARCH(7); if (IS_USER(s)) { goto illegal_op; } gen_hvc(s, imm16); } else { /* Secure monitor call (v6+) */ ARCH(6K); if (IS_USER(s)) { goto illegal_op; } gen_smc(s); } } else { op = (insn >> 20) & 7; switch (op) { case 0: /* msr cpsr. */ if (arm_dc_feature(s, ARM_FEATURE_M)) { tmp = load_reg(s, rn); /* the constant is the mask and SYSm fields */ addr = tcg_const_i32(insn & 0xfff); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); tcg_temp_free_i32(tmp); gen_lookup_tb(s); break; } /* fall through */ case 1: /* msr spsr. */ if (arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (extract32(insn, 5, 1)) { /* MSR (banked) */ int sysm = extract32(insn, 8, 4) | (extract32(insn, 4, 1) << 4); int r = op & 1; gen_msr_banked(s, r, sysm, rm); break; } /* MSR (for PSRs) */ tmp = load_reg(s, rn); if (gen_set_psr(s, msr_mask(s, (insn >> 8) & 0xf, op == 1), op == 1, tmp)) goto illegal_op; break; case 2: /* cps, nop-hint. */ if (((insn >> 8) & 7) == 0) { gen_nop_hint(s, insn & 0xff); } /* Implemented as NOP in user mode. */ if (IS_USER(s)) break; offset = 0; imm = 0; if (insn & (1 << 10)) { if (insn & (1 << 7)) offset |= CPSR_A; if (insn & (1 << 6)) offset |= CPSR_I; if (insn & (1 << 5)) offset |= CPSR_F; if (insn & (1 << 9)) imm = CPSR_A | CPSR_I | CPSR_F; } if (insn & (1 << 8)) { offset |= 0x1f; imm |= (insn & 0x1f); } if (offset) { gen_set_psr_im(s, offset, 0, imm); } break; case 3: /* Special control operations. */ ARCH(7); op = (insn >> 4) & 0xf; switch (op) { case 2: /* clrex */ gen_clrex(s); break; case 4: /* dsb */ case 5: /* dmb */ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); break; case 6: /* isb */ /* We need to break the TB after this insn * to execute self-modifying code correctly * and also to take any pending interrupts * immediately. */ gen_goto_tb(s, 0, s->pc & ~1); break; default: goto illegal_op; } break; case 4: /* bxj */ /* Trivial implementation equivalent to bx. * This instruction doesn't exist at all for M-profile. */ if (arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } tmp = load_reg(s, rn); gen_bx(s, tmp); break; case 5: /* Exception return. */ if (IS_USER(s)) { goto illegal_op; } if (rn != 14 || rd != 15) { goto illegal_op; } tmp = load_reg(s, rn); tcg_gen_subi_i32(tmp, tmp, insn & 0xff); gen_exception_return(s, tmp); break; case 6: /* MRS */ if (extract32(insn, 5, 1) && !arm_dc_feature(s, ARM_FEATURE_M)) { /* MRS (banked) */ int sysm = extract32(insn, 16, 4) | (extract32(insn, 4, 1) << 4); gen_mrs_banked(s, 0, sysm, rd); break; } if (extract32(insn, 16, 4) != 0xf) { goto illegal_op; } if (!arm_dc_feature(s, ARM_FEATURE_M) && extract32(insn, 0, 8) != 0) { goto illegal_op; } /* mrs cpsr */ tmp = tcg_temp_new_i32(); if (arm_dc_feature(s, ARM_FEATURE_M)) { addr = tcg_const_i32(insn & 0xff); gen_helper_v7m_mrs(tmp, cpu_env, addr); tcg_temp_free_i32(addr); } else { gen_helper_cpsr_read(tmp, cpu_env); } store_reg(s, rd, tmp); break; case 7: /* MRS */ if (extract32(insn, 5, 1) && !arm_dc_feature(s, ARM_FEATURE_M)) { /* MRS (banked) */ int sysm = extract32(insn, 16, 4) | (extract32(insn, 4, 1) << 4); gen_mrs_banked(s, 1, sysm, rd); break; } /* mrs spsr. */ /* Not accessible in user mode. */ if (IS_USER(s) || arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (extract32(insn, 16, 4) != 0xf || extract32(insn, 0, 8) != 0) { goto illegal_op; } tmp = load_cpu_field(spsr); store_reg(s, rd, tmp); break; } } } else { /* Conditional branch. */ op = (insn >> 22) & 0xf; /* Generate a conditional jump to next instruction. */ s->condlabel = gen_new_label(); arm_gen_test_cc(op ^ 1, s->condlabel); s->condjmp = 1; /* offset[11:1] = insn[10:0] */ offset = (insn & 0x7ff) << 1; /* offset[17:12] = insn[21:16]. */ offset |= (insn & 0x003f0000) >> 4; /* offset[31:20] = insn[26]. */ offset |= ((int32_t)((insn << 5) & 0x80000000)) >> 11; /* offset[18] = insn[13]. */ offset |= (insn & (1 << 13)) << 5; /* offset[19] = insn[11]. */ offset |= (insn & (1 << 11)) << 8; /* jump to the offset */ gen_jmp(s, s->pc + offset); } } else { /* Data processing immediate. */ if (insn & (1 << 25)) { if (insn & (1 << 24)) { if (insn & (1 << 20)) goto illegal_op; /* Bitfield/Saturate. */ op = (insn >> 21) & 7; imm = insn & 0x1f; shift = ((insn >> 6) & 3) | ((insn >> 10) & 0x1c); if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(s, rn); } switch (op) { case 2: /* Signed bitfield extract. */ imm++; if (shift + imm > 32) goto illegal_op; if (imm < 32) { tcg_gen_sextract_i32(tmp, tmp, shift, imm); } break; case 6: /* Unsigned bitfield extract. */ imm++; if (shift + imm > 32) goto illegal_op; if (imm < 32) { tcg_gen_extract_i32(tmp, tmp, shift, imm); } break; case 3: /* Bitfield insert/clear. */ if (imm < shift) goto illegal_op; imm = imm + 1 - shift; if (imm != 32) { tmp2 = load_reg(s, rd); tcg_gen_deposit_i32(tmp, tmp2, tmp, shift, imm); tcg_temp_free_i32(tmp2); } break; case 7: goto illegal_op; default: /* Saturate. */ if (shift) { if (op & 1) tcg_gen_sari_i32(tmp, tmp, shift); else tcg_gen_shli_i32(tmp, tmp, shift); } tmp2 = tcg_const_i32(imm); if (op & 4) { /* Unsigned. */ if ((op & 1) && shift == 0) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } gen_helper_usat16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_usat(tmp, cpu_env, tmp, tmp2); } } else { /* Signed. */ if ((op & 1) && shift == 0) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } gen_helper_ssat16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_ssat(tmp, cpu_env, tmp, tmp2); } } tcg_temp_free_i32(tmp2); break; } store_reg(s, rd, tmp); } else { imm = ((insn & 0x04000000) >> 15) | ((insn & 0x7000) >> 4) | (insn & 0xff); if (insn & (1 << 22)) { /* 16-bit immediate. */ imm |= (insn >> 4) & 0xf000; if (insn & (1 << 23)) { /* movt */ tmp = load_reg(s, rd); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_ori_i32(tmp, tmp, imm << 16); } else { /* movw */ tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, imm); } } else { /* Add/sub 12-bit immediate. */ if (rn == 15) { offset = s->pc & ~(uint32_t)3; if (insn & (1 << 23)) offset -= imm; else offset += imm; tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, offset); } else { tmp = load_reg(s, rn); if (insn & (1 << 23)) tcg_gen_subi_i32(tmp, tmp, imm); else tcg_gen_addi_i32(tmp, tmp, imm); } } store_reg(s, rd, tmp); } } else { int shifter_out = 0; /* modified 12-bit immediate. */ shift = ((insn & 0x04000000) >> 23) | ((insn & 0x7000) >> 12); imm = (insn & 0xff); switch (shift) { case 0: /* XY */ /* Nothing to do. */ break; case 1: /* 00XY00XY */ imm |= imm << 16; break; case 2: /* XY00XY00 */ imm |= imm << 16; imm <<= 8; break; case 3: /* XYXYXYXY */ imm |= imm << 16; imm |= imm << 8; break; default: /* Rotated constant. */ shift = (shift << 1) | (imm >> 7); imm |= 0x80; imm = imm << (32 - shift); shifter_out = 1; break; } tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); rn = (insn >> 16) & 0xf; if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(s, rn); } op = (insn >> 21) & 0xf; if (gen_thumb2_data_op(s, op, (insn & (1 << 20)) != 0, shifter_out, tmp, tmp2)) goto illegal_op; tcg_temp_free_i32(tmp2); rd = (insn >> 8) & 0xf; if (rd != 15) { store_reg(s, rd, tmp); } else { tcg_temp_free_i32(tmp); } } } break; case 12: /* Load/store single data item. */ { int postinc = 0; int writeback = 0; int memidx; ISSInfo issinfo; if ((insn & 0x01100000) == 0x01000000) { if (disas_neon_ls_insn(s, insn)) { goto illegal_op; } break; } op = ((insn >> 21) & 3) | ((insn >> 22) & 4); if (rs == 15) { if (!(insn & (1 << 20))) { goto illegal_op; } if (op != 2) { /* Byte or halfword load space with dest == r15 : memory hints. * Catch them early so we don't emit pointless addressing code. * This space is a mix of: * PLD/PLDW/PLI, which we implement as NOPs (note that unlike * the ARM encodings, PLDW space doesn't UNDEF for non-v7MP * cores) * unallocated hints, which must be treated as NOPs * UNPREDICTABLE space, which we NOP or UNDEF depending on * which is easiest for the decoding logic * Some space which must UNDEF */ int op1 = (insn >> 23) & 3; int op2 = (insn >> 6) & 0x3f; if (op & 2) { goto illegal_op; } if (rn == 15) { /* UNPREDICTABLE, unallocated hint or * PLD/PLDW/PLI (literal) */ return 0; } if (op1 & 1) { return 0; /* PLD/PLDW/PLI or unallocated hint */ } if ((op2 == 0) || ((op2 & 0x3c) == 0x30)) { return 0; /* PLD/PLDW/PLI or unallocated hint */ } /* UNDEF space, or an UNPREDICTABLE */ return 1; } } memidx = get_mem_index(s); if (rn == 15) { addr = tcg_temp_new_i32(); /* PC relative. */ /* s->pc has already been incremented by 4. */ imm = s->pc & 0xfffffffc; if (insn & (1 << 23)) imm += insn & 0xfff; else imm -= insn & 0xfff; tcg_gen_movi_i32(addr, imm); } else { addr = load_reg(s, rn); if (insn & (1 << 23)) { /* Positive offset. */ imm = insn & 0xfff; tcg_gen_addi_i32(addr, addr, imm); } else { imm = insn & 0xff; switch ((insn >> 8) & 0xf) { case 0x0: /* Shifted Register. */ shift = (insn >> 4) & 0xf; if (shift > 3) { tcg_temp_free_i32(addr); goto illegal_op; } tmp = load_reg(s, rm); if (shift) tcg_gen_shli_i32(tmp, tmp, shift); tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); break; case 0xc: /* Negative offset. */ tcg_gen_addi_i32(addr, addr, -imm); break; case 0xe: /* User privilege. */ tcg_gen_addi_i32(addr, addr, imm); memidx = get_a32_user_mem_index(s); break; case 0x9: /* Post-decrement. */ imm = -imm; /* Fall through. */ case 0xb: /* Post-increment. */ postinc = 1; writeback = 1; break; case 0xd: /* Pre-decrement. */ imm = -imm; /* Fall through. */ case 0xf: /* Pre-increment. */ tcg_gen_addi_i32(addr, addr, imm); writeback = 1; break; default: tcg_temp_free_i32(addr); goto illegal_op; } } } issinfo = writeback ? ISSInvalid : rs; if (insn & (1 << 20)) { /* Load. */ tmp = tcg_temp_new_i32(); switch (op) { case 0: gen_aa32_ld8u_iss(s, tmp, addr, memidx, issinfo); break; case 4: gen_aa32_ld8s_iss(s, tmp, addr, memidx, issinfo); break; case 1: gen_aa32_ld16u_iss(s, tmp, addr, memidx, issinfo); break; case 5: gen_aa32_ld16s_iss(s, tmp, addr, memidx, issinfo); break; case 2: gen_aa32_ld32u_iss(s, tmp, addr, memidx, issinfo); break; default: tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); goto illegal_op; } if (rs == 15) { gen_bx_excret(s, tmp); } else { store_reg(s, rs, tmp); } } else { /* Store. */ tmp = load_reg(s, rs); switch (op) { case 0: gen_aa32_st8_iss(s, tmp, addr, memidx, issinfo); break; case 1: gen_aa32_st16_iss(s, tmp, addr, memidx, issinfo); break; case 2: gen_aa32_st32_iss(s, tmp, addr, memidx, issinfo); break; default: tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); goto illegal_op; } tcg_temp_free_i32(tmp); } if (postinc) tcg_gen_addi_i32(addr, addr, imm); if (writeback) { store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } } break; default: goto illegal_op; } return 0; illegal_op: return 1; }
false
qemu
5158de241b0fb344a6c948dfcbc4e611ab5fafbe
static int disas_thumb2_insn(DisasContext *s, uint32_t insn) { uint32_t imm, shift, offset; uint32_t rd, rn, rm, rs; TCGv_i32 tmp; TCGv_i32 tmp2; TCGv_i32 tmp3; TCGv_i32 addr; TCGv_i64 tmp64; int op; int shiftop; int conds; int logic_cc; if ((insn & 0xf800e800) != 0xf000e800) { ARCH(6T2); } rn = (insn >> 16) & 0xf; rs = (insn >> 12) & 0xf; rd = (insn >> 8) & 0xf; rm = insn & 0xf; switch ((insn >> 25) & 0xf) { case 0: case 1: case 2: case 3: abort(); case 4: if (insn & (1 << 22)) { if (insn == 0xe97fe97f && arm_dc_feature(s, ARM_FEATURE_M) && arm_dc_feature(s, ARM_FEATURE_V8)) { if (s->v8m_secure) { s->condexec_cond = 0; s->condexec_mask = 0; } } else if (insn & 0x01200000) { if (rn == 15) { if (insn & (1 << 21)) { goto illegal_op; } addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, s->pc & ~3); } else { addr = load_reg(s, rn); } offset = (insn & 0xff) * 4; if ((insn & (1 << 23)) == 0) offset = -offset; if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, offset); offset = 0; } if (insn & (1 << 20)) { tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); store_reg(s, rs, tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rs); gen_aa32_st32(s, tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = load_reg(s, rd); gen_aa32_st32(s, tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } if (insn & (1 << 21)) { tcg_gen_addi_i32(addr, addr, offset - 4); store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } } else if ((insn & (1 << 23)) == 0) { if (rs == 15) { goto illegal_op; } addr = tcg_temp_local_new_i32(); load_reg_var(s, addr, rn); tcg_gen_addi_i32(addr, addr, (insn & 0xff) << 2); if (insn & (1 << 20)) { gen_load_exclusive(s, rs, 15, addr, 2); } else { gen_store_exclusive(s, rd, rs, 15, addr, 2); } tcg_temp_free_i32(addr); } else if ((insn & (7 << 5)) == 0) { if (rn == 15) { addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, s->pc); } else { addr = load_reg(s, rn); } tmp = load_reg(s, rm); tcg_gen_add_i32(addr, addr, tmp); if (insn & (1 << 4)) { tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); tmp = tcg_temp_new_i32(); gen_aa32_ld16u(s, tmp, addr, get_mem_index(s)); } else { tcg_temp_free_i32(tmp); tmp = tcg_temp_new_i32(); gen_aa32_ld8u(s, tmp, addr, get_mem_index(s)); } tcg_temp_free_i32(addr); tcg_gen_shli_i32(tmp, tmp, 1); tcg_gen_addi_i32(tmp, tmp, s->pc); store_reg(s, 15, tmp); } else { int op2 = (insn >> 6) & 0x3; op = (insn >> 4) & 0x3; switch (op2) { case 0: goto illegal_op; case 1: if (op == 2) { goto illegal_op; } ARCH(7); break; case 2: if (op == 3) { goto illegal_op; } case 3: ARCH(8); break; } addr = tcg_temp_local_new_i32(); load_reg_var(s, addr, rn); if (!(op2 & 1)) { if (insn & (1 << 20)) { tmp = tcg_temp_new_i32(); switch (op) { case 0: gen_aa32_ld8u_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 1: gen_aa32_ld16u_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 2: gen_aa32_ld32u_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; default: abort(); } store_reg(s, rs, tmp); } else { tmp = load_reg(s, rs); switch (op) { case 0: gen_aa32_st8_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 1: gen_aa32_st16_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; case 2: gen_aa32_st32_iss(s, tmp, addr, get_mem_index(s), rs | ISSIsAcqRel); break; default: abort(); } tcg_temp_free_i32(tmp); } } else if (insn & (1 << 20)) { gen_load_exclusive(s, rs, rd, addr, op); } else { gen_store_exclusive(s, rm, rs, rd, addr, op); } tcg_temp_free_i32(addr); } } else { if (((insn >> 23) & 1) == ((insn >> 24) & 1)) { if (IS_USER(s) || arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (insn & (1 << 20)) { addr = load_reg(s, rn); if ((insn & (1 << 24)) == 0) tcg_gen_addi_i32(addr, addr, -8); tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); tcg_gen_addi_i32(addr, addr, 4); tmp2 = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp2, addr, get_mem_index(s)); if (insn & (1 << 21)) { if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, 4); } else { tcg_gen_addi_i32(addr, addr, -4); } store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } gen_rfe(s, tmp, tmp2); } else { gen_srs(s, (insn & 0x1f), (insn & (1 << 24)) ? 1 : 2, insn & (1 << 21)); } } else { int i, loaded_base = 0; TCGv_i32 loaded_var; addr = load_reg(s, rn); offset = 0; for (i = 0; i < 16; i++) { if (insn & (1 << i)) offset += 4; } if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, -offset); } TCGV_UNUSED_I32(loaded_var); for (i = 0; i < 16; i++) { if ((insn & (1 << i)) == 0) continue; if (insn & (1 << 20)) { tmp = tcg_temp_new_i32(); gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); if (i == 15) { gen_bx_excret(s, tmp); } else if (i == rn) { loaded_var = tmp; loaded_base = 1; } else { store_reg(s, i, tmp); } } else { tmp = load_reg(s, i); gen_aa32_st32(s, tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } tcg_gen_addi_i32(addr, addr, 4); } if (loaded_base) { store_reg(s, rn, loaded_var); } if (insn & (1 << 21)) { if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, -offset); } if (insn & (1 << rn)) goto illegal_op; store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } } } break; case 5: op = (insn >> 21) & 0xf; if (op == 6) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); shift = ((insn >> 10) & 0x1c) | ((insn >> 6) & 0x3); if (insn & (1 << 5)) { if (shift == 0) shift = 31; tcg_gen_sari_i32(tmp2, tmp2, shift); tcg_gen_andi_i32(tmp, tmp, 0xffff0000); tcg_gen_ext16u_i32(tmp2, tmp2); } else { if (shift) tcg_gen_shli_i32(tmp2, tmp2, shift); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); } tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else { if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(s, rn); } tmp2 = load_reg(s, rm); shiftop = (insn >> 4) & 3; shift = ((insn >> 6) & 3) | ((insn >> 10) & 0x1c); conds = (insn & (1 << 20)) != 0; logic_cc = (conds && thumb2_logic_op(op)); gen_arm_shift_im(tmp2, shiftop, shift, logic_cc); if (gen_thumb2_data_op(s, op, conds, 0, tmp, tmp2)) goto illegal_op; tcg_temp_free_i32(tmp2); if (rd != 15) { store_reg(s, rd, tmp); } else { tcg_temp_free_i32(tmp); } } break; case 13: op = ((insn >> 22) & 6) | ((insn >> 7) & 1); if (op < 4 && (insn & 0xf000) != 0xf000) goto illegal_op; switch (op) { case 0: tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); if ((insn & 0x70) != 0) goto illegal_op; op = (insn >> 21) & 3; logic_cc = (insn & (1 << 20)) != 0; gen_arm_shift_reg(tmp, op, tmp2, logic_cc); if (logic_cc) gen_logic_CC(tmp); store_reg(s, rd, tmp); break; case 1: op = (insn >> 20) & 7; switch (op) { case 0: case 1: case 4: case 5: break; case 2: case 3: if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; default: goto illegal_op; } if (rn != 15) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } } tmp = load_reg(s, rm); shift = (insn >> 4) & 3; if (shift != 0) tcg_gen_rotri_i32(tmp, tmp, shift * 8); op = (insn >> 20) & 7; switch (op) { case 0: gen_sxth(tmp); break; case 1: gen_uxth(tmp); break; case 2: gen_sxtb16(tmp); break; case 3: gen_uxtb16(tmp); break; case 4: gen_sxtb(tmp); break; case 5: gen_uxtb(tmp); break; default: g_assert_not_reached(); } if (rn != 15) { tmp2 = load_reg(s, rn); if ((op >> 1) == 1) { gen_add16(tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } } store_reg(s, rd, tmp); break; case 2: if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } op = (insn >> 20) & 7; shift = (insn >> 4) & 7; if ((op & 3) == 3 || (shift & 3) == 3) goto illegal_op; tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); gen_thumb2_parallel_addsub(op, shift, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 3: op = ((insn >> 17) & 0x38) | ((insn >> 4) & 7); if (op < 4) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); if (op & 1) gen_helper_double_saturate(tmp, cpu_env, tmp); if (op & 2) gen_helper_sub_saturate(tmp, cpu_env, tmp2, tmp); else gen_helper_add_saturate(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } else { switch (op) { case 0x0a: case 0x08: case 0x09: case 0x0b: case 0x18: break; case 0x10: if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; case 0x20: case 0x21: case 0x22: case 0x28: case 0x29: case 0x2a: if (!arm_dc_feature(s, ARM_FEATURE_CRC)) { goto illegal_op; } break; default: goto illegal_op; } tmp = load_reg(s, rn); switch (op) { case 0x0a: gen_helper_rbit(tmp, tmp); break; case 0x08: tcg_gen_bswap32_i32(tmp, tmp); break; case 0x09: gen_rev16(tmp); break; case 0x0b: gen_revsh(tmp); break; case 0x10: tmp2 = load_reg(s, rm); tmp3 = tcg_temp_new_i32(); tcg_gen_ld_i32(tmp3, cpu_env, offsetof(CPUARMState, GE)); gen_helper_sel_flags(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); tcg_temp_free_i32(tmp2); break; case 0x18: tcg_gen_clzi_i32(tmp, tmp, 32); break; case 0x20: case 0x21: case 0x22: case 0x28: case 0x29: case 0x2a: { uint32_t sz = op & 0x3; uint32_t c = op & 0x8; tmp2 = load_reg(s, rm); if (sz == 0) { tcg_gen_andi_i32(tmp2, tmp2, 0xff); } else if (sz == 1) { tcg_gen_andi_i32(tmp2, tmp2, 0xffff); } tmp3 = tcg_const_i32(1 << sz); if (c) { gen_helper_crc32c(tmp, tmp, tmp2, tmp3); } else { gen_helper_crc32(tmp, tmp, tmp2, tmp3); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; } default: g_assert_not_reached(); } } store_reg(s, rd, tmp); break; case 4: case 5: switch ((insn >> 20) & 7) { case 0: case 7: break; case 1: case 2: case 3: case 4: case 5: case 6: if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; } op = (insn >> 4) & 0xf; tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); switch ((insn >> 20) & 7) { case 0: tcg_gen_mul_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); if (op) tcg_gen_sub_i32(tmp, tmp2, tmp); else tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 1: gen_mulxy(tmp, tmp2, op & 2, op & 1); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 2: case 4: if (op) gen_swap_half(tmp2); gen_smul_dual(tmp, tmp2); if (insn & (1 << 22)) { tcg_gen_sub_i32(tmp, tmp, tmp2); } else { gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); } tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 3: if (op) tcg_gen_sari_i32(tmp2, tmp2, 16); else gen_sxth(tmp2); tmp64 = gen_muls_i64_i32(tmp, tmp2); tcg_gen_shri_i64(tmp64, tmp64, 16); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); if (rs != 15) { tmp2 = load_reg(s, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 5: case 6: tmp64 = gen_muls_i64_i32(tmp, tmp2); if (rs != 15) { tmp = load_reg(s, rs); if (insn & (1 << 20)) { tmp64 = gen_addq_msw(tmp64, tmp); } else { tmp64 = gen_subq_msw(tmp64, tmp); } } if (insn & (1 << 4)) { tcg_gen_addi_i64(tmp64, tmp64, 0x80000000u); } tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); break; case 7: gen_helper_usad8(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(s, rs); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; } store_reg(s, rd, tmp); break; case 6: case 7: op = ((insn >> 4) & 0xf) | ((insn >> 16) & 0x70); tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); if ((op & 0x50) == 0x10) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DIV)) { goto illegal_op; } if (op & 0x20) gen_helper_udiv(tmp, tmp, tmp2); else gen_helper_sdiv(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else if ((op & 0xe) == 0xc) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } if (op & 1) gen_swap_half(tmp2); gen_smul_dual(tmp, tmp2); if (op & 0x10) { tcg_gen_sub_i32(tmp, tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp2); tmp64 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_temp_free_i32(tmp); gen_addq(s, tmp64, rs, rd); gen_storeq_reg(s, rs, rd, tmp64); tcg_temp_free_i64(tmp64); } else { if (op & 0x20) { tmp64 = gen_mulu_i64_i32(tmp, tmp2); } else { if (op & 8) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); goto illegal_op; } gen_mulxy(tmp, tmp2, op & 2, op & 1); tcg_temp_free_i32(tmp2); tmp64 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_temp_free_i32(tmp); } else { tmp64 = gen_muls_i64_i32(tmp, tmp2); } } if (op & 4) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i64(tmp64); goto illegal_op; } gen_addq_lo(s, tmp64, rs); gen_addq_lo(s, tmp64, rd); } else if (op & 0x40) { gen_addq(s, tmp64, rs, rd); } gen_storeq_reg(s, rs, rd, tmp64); tcg_temp_free_i64(tmp64); } break; } break; case 6: case 7: case 14: case 15: if (arm_dc_feature(s, ARM_FEATURE_M)) { gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), default_exception_el(s)); break; } if (((insn >> 24) & 3) == 3) { insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); if (disas_neon_data_insn(s, insn)) { goto illegal_op; } } else if (((insn >> 8) & 0xe) == 10) { if (disas_vfp_insn(s, insn)) { goto illegal_op; } } else { if (insn & (1 << 28)) goto illegal_op; if (disas_coproc_insn(s, insn)) { goto illegal_op; } } break; case 8: case 9: case 10: case 11: if (insn & (1 << 15)) { if (insn & 0x5000) { offset = ((int32_t)insn << 5) >> 9 & ~(int32_t)0xfff; offset |= (insn & 0x7ff) << 1; offset ^= ((~insn) & (1 << 13)) << 10; offset ^= ((~insn) & (1 << 11)) << 11; if (insn & (1 << 14)) { tcg_gen_movi_i32(cpu_R[14], s->pc | 1); } offset += s->pc; if (insn & (1 << 12)) { gen_jmp(s, offset); } else { offset &= ~(uint32_t)2; gen_bx_im(s, offset); } } else if (((insn >> 23) & 7) == 7) { if (insn & (1 << 13)) goto illegal_op; if (insn & (1 << 26)) { if (arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (!(insn & (1 << 20))) { int imm16 = extract32(insn, 16, 4) << 12 | extract32(insn, 0, 12); ARCH(7); if (IS_USER(s)) { goto illegal_op; } gen_hvc(s, imm16); } else { ARCH(6K); if (IS_USER(s)) { goto illegal_op; } gen_smc(s); } } else { op = (insn >> 20) & 7; switch (op) { case 0: if (arm_dc_feature(s, ARM_FEATURE_M)) { tmp = load_reg(s, rn); addr = tcg_const_i32(insn & 0xfff); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); tcg_temp_free_i32(tmp); gen_lookup_tb(s); break; } case 1: if (arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (extract32(insn, 5, 1)) { int sysm = extract32(insn, 8, 4) | (extract32(insn, 4, 1) << 4); int r = op & 1; gen_msr_banked(s, r, sysm, rm); break; } tmp = load_reg(s, rn); if (gen_set_psr(s, msr_mask(s, (insn >> 8) & 0xf, op == 1), op == 1, tmp)) goto illegal_op; break; case 2: if (((insn >> 8) & 7) == 0) { gen_nop_hint(s, insn & 0xff); } if (IS_USER(s)) break; offset = 0; imm = 0; if (insn & (1 << 10)) { if (insn & (1 << 7)) offset |= CPSR_A; if (insn & (1 << 6)) offset |= CPSR_I; if (insn & (1 << 5)) offset |= CPSR_F; if (insn & (1 << 9)) imm = CPSR_A | CPSR_I | CPSR_F; } if (insn & (1 << 8)) { offset |= 0x1f; imm |= (insn & 0x1f); } if (offset) { gen_set_psr_im(s, offset, 0, imm); } break; case 3: ARCH(7); op = (insn >> 4) & 0xf; switch (op) { case 2: gen_clrex(s); break; case 4: case 5: tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); break; case 6: gen_goto_tb(s, 0, s->pc & ~1); break; default: goto illegal_op; } break; case 4: if (arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } tmp = load_reg(s, rn); gen_bx(s, tmp); break; case 5: if (IS_USER(s)) { goto illegal_op; } if (rn != 14 || rd != 15) { goto illegal_op; } tmp = load_reg(s, rn); tcg_gen_subi_i32(tmp, tmp, insn & 0xff); gen_exception_return(s, tmp); break; case 6: if (extract32(insn, 5, 1) && !arm_dc_feature(s, ARM_FEATURE_M)) { int sysm = extract32(insn, 16, 4) | (extract32(insn, 4, 1) << 4); gen_mrs_banked(s, 0, sysm, rd); break; } if (extract32(insn, 16, 4) != 0xf) { goto illegal_op; } if (!arm_dc_feature(s, ARM_FEATURE_M) && extract32(insn, 0, 8) != 0) { goto illegal_op; } tmp = tcg_temp_new_i32(); if (arm_dc_feature(s, ARM_FEATURE_M)) { addr = tcg_const_i32(insn & 0xff); gen_helper_v7m_mrs(tmp, cpu_env, addr); tcg_temp_free_i32(addr); } else { gen_helper_cpsr_read(tmp, cpu_env); } store_reg(s, rd, tmp); break; case 7: if (extract32(insn, 5, 1) && !arm_dc_feature(s, ARM_FEATURE_M)) { int sysm = extract32(insn, 16, 4) | (extract32(insn, 4, 1) << 4); gen_mrs_banked(s, 1, sysm, rd); break; } if (IS_USER(s) || arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } if (extract32(insn, 16, 4) != 0xf || extract32(insn, 0, 8) != 0) { goto illegal_op; } tmp = load_cpu_field(spsr); store_reg(s, rd, tmp); break; } } } else { op = (insn >> 22) & 0xf; s->condlabel = gen_new_label(); arm_gen_test_cc(op ^ 1, s->condlabel); s->condjmp = 1; offset = (insn & 0x7ff) << 1; offset |= (insn & 0x003f0000) >> 4; offset |= ((int32_t)((insn << 5) & 0x80000000)) >> 11; offset |= (insn & (1 << 13)) << 5; offset |= (insn & (1 << 11)) << 8; gen_jmp(s, s->pc + offset); } } else { if (insn & (1 << 25)) { if (insn & (1 << 24)) { if (insn & (1 << 20)) goto illegal_op; op = (insn >> 21) & 7; imm = insn & 0x1f; shift = ((insn >> 6) & 3) | ((insn >> 10) & 0x1c); if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(s, rn); } switch (op) { case 2: imm++; if (shift + imm > 32) goto illegal_op; if (imm < 32) { tcg_gen_sextract_i32(tmp, tmp, shift, imm); } break; case 6: imm++; if (shift + imm > 32) goto illegal_op; if (imm < 32) { tcg_gen_extract_i32(tmp, tmp, shift, imm); } break; case 3: if (imm < shift) goto illegal_op; imm = imm + 1 - shift; if (imm != 32) { tmp2 = load_reg(s, rd); tcg_gen_deposit_i32(tmp, tmp2, tmp, shift, imm); tcg_temp_free_i32(tmp2); } break; case 7: goto illegal_op; default: if (shift) { if (op & 1) tcg_gen_sari_i32(tmp, tmp, shift); else tcg_gen_shli_i32(tmp, tmp, shift); } tmp2 = tcg_const_i32(imm); if (op & 4) { if ((op & 1) && shift == 0) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } gen_helper_usat16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_usat(tmp, cpu_env, tmp, tmp2); } } else { if ((op & 1) && shift == 0) { if (!arm_dc_feature(s, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } gen_helper_ssat16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_ssat(tmp, cpu_env, tmp, tmp2); } } tcg_temp_free_i32(tmp2); break; } store_reg(s, rd, tmp); } else { imm = ((insn & 0x04000000) >> 15) | ((insn & 0x7000) >> 4) | (insn & 0xff); if (insn & (1 << 22)) { imm |= (insn >> 4) & 0xf000; if (insn & (1 << 23)) { tmp = load_reg(s, rd); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_ori_i32(tmp, tmp, imm << 16); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, imm); } } else { if (rn == 15) { offset = s->pc & ~(uint32_t)3; if (insn & (1 << 23)) offset -= imm; else offset += imm; tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, offset); } else { tmp = load_reg(s, rn); if (insn & (1 << 23)) tcg_gen_subi_i32(tmp, tmp, imm); else tcg_gen_addi_i32(tmp, tmp, imm); } } store_reg(s, rd, tmp); } } else { int shifter_out = 0; shift = ((insn & 0x04000000) >> 23) | ((insn & 0x7000) >> 12); imm = (insn & 0xff); switch (shift) { case 0: break; case 1: imm |= imm << 16; break; case 2: imm |= imm << 16; imm <<= 8; break; case 3: imm |= imm << 16; imm |= imm << 8; break; default: shift = (shift << 1) | (imm >> 7); imm |= 0x80; imm = imm << (32 - shift); shifter_out = 1; break; } tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); rn = (insn >> 16) & 0xf; if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(s, rn); } op = (insn >> 21) & 0xf; if (gen_thumb2_data_op(s, op, (insn & (1 << 20)) != 0, shifter_out, tmp, tmp2)) goto illegal_op; tcg_temp_free_i32(tmp2); rd = (insn >> 8) & 0xf; if (rd != 15) { store_reg(s, rd, tmp); } else { tcg_temp_free_i32(tmp); } } } break; case 12: { int postinc = 0; int writeback = 0; int memidx; ISSInfo issinfo; if ((insn & 0x01100000) == 0x01000000) { if (disas_neon_ls_insn(s, insn)) { goto illegal_op; } break; } op = ((insn >> 21) & 3) | ((insn >> 22) & 4); if (rs == 15) { if (!(insn & (1 << 20))) { goto illegal_op; } if (op != 2) { int op1 = (insn >> 23) & 3; int op2 = (insn >> 6) & 0x3f; if (op & 2) { goto illegal_op; } if (rn == 15) { return 0; } if (op1 & 1) { return 0; } if ((op2 == 0) || ((op2 & 0x3c) == 0x30)) { return 0; } return 1; } } memidx = get_mem_index(s); if (rn == 15) { addr = tcg_temp_new_i32(); imm = s->pc & 0xfffffffc; if (insn & (1 << 23)) imm += insn & 0xfff; else imm -= insn & 0xfff; tcg_gen_movi_i32(addr, imm); } else { addr = load_reg(s, rn); if (insn & (1 << 23)) { imm = insn & 0xfff; tcg_gen_addi_i32(addr, addr, imm); } else { imm = insn & 0xff; switch ((insn >> 8) & 0xf) { case 0x0: shift = (insn >> 4) & 0xf; if (shift > 3) { tcg_temp_free_i32(addr); goto illegal_op; } tmp = load_reg(s, rm); if (shift) tcg_gen_shli_i32(tmp, tmp, shift); tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); break; case 0xc: tcg_gen_addi_i32(addr, addr, -imm); break; case 0xe: tcg_gen_addi_i32(addr, addr, imm); memidx = get_a32_user_mem_index(s); break; case 0x9: imm = -imm; case 0xb: postinc = 1; writeback = 1; break; case 0xd: imm = -imm; case 0xf: tcg_gen_addi_i32(addr, addr, imm); writeback = 1; break; default: tcg_temp_free_i32(addr); goto illegal_op; } } } issinfo = writeback ? ISSInvalid : rs; if (insn & (1 << 20)) { tmp = tcg_temp_new_i32(); switch (op) { case 0: gen_aa32_ld8u_iss(s, tmp, addr, memidx, issinfo); break; case 4: gen_aa32_ld8s_iss(s, tmp, addr, memidx, issinfo); break; case 1: gen_aa32_ld16u_iss(s, tmp, addr, memidx, issinfo); break; case 5: gen_aa32_ld16s_iss(s, tmp, addr, memidx, issinfo); break; case 2: gen_aa32_ld32u_iss(s, tmp, addr, memidx, issinfo); break; default: tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); goto illegal_op; } if (rs == 15) { gen_bx_excret(s, tmp); } else { store_reg(s, rs, tmp); } } else { tmp = load_reg(s, rs); switch (op) { case 0: gen_aa32_st8_iss(s, tmp, addr, memidx, issinfo); break; case 1: gen_aa32_st16_iss(s, tmp, addr, memidx, issinfo); break; case 2: gen_aa32_st32_iss(s, tmp, addr, memidx, issinfo); break; default: tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); goto illegal_op; } tcg_temp_free_i32(tmp); } if (postinc) tcg_gen_addi_i32(addr, addr, imm); if (writeback) { store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } } break; default: goto illegal_op; } return 0; illegal_op: return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1) { uint32_t imm, shift, offset; uint32_t rd, rn, rm, rs; TCGv_i32 tmp; TCGv_i32 tmp2; TCGv_i32 tmp3; TCGv_i32 addr; TCGv_i64 tmp64; int VAR_2; int VAR_3; int VAR_4; int VAR_5; if ((VAR_1 & 0xf800e800) != 0xf000e800) { ARCH(6T2); } rn = (VAR_1 >> 16) & 0xf; rs = (VAR_1 >> 12) & 0xf; rd = (VAR_1 >> 8) & 0xf; rm = VAR_1 & 0xf; switch ((VAR_1 >> 25) & 0xf) { case 0: case 1: case 2: case 3: abort(); case 4: if (VAR_1 & (1 << 22)) { if (VAR_1 == 0xe97fe97f && arm_dc_feature(VAR_0, ARM_FEATURE_M) && arm_dc_feature(VAR_0, ARM_FEATURE_V8)) { if (VAR_0->v8m_secure) { VAR_0->condexec_cond = 0; VAR_0->condexec_mask = 0; } } else if (VAR_1 & 0x01200000) { if (rn == 15) { if (VAR_1 & (1 << 21)) { goto illegal_op; } addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, VAR_0->pc & ~3); } else { addr = load_reg(VAR_0, rn); } offset = (VAR_1 & 0xff) * 4; if ((VAR_1 & (1 << 23)) == 0) offset = -offset; if (VAR_1 & (1 << 24)) { tcg_gen_addi_i32(addr, addr, offset); offset = 0; } if (VAR_1 & (1 << 20)) { tmp = tcg_temp_new_i32(); gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0)); store_reg(VAR_0, rs, tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = tcg_temp_new_i32(); gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0)); store_reg(VAR_0, rd, tmp); } else { tmp = load_reg(VAR_0, rs); gen_aa32_st32(VAR_0, tmp, addr, get_mem_index(VAR_0)); tcg_temp_free_i32(tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = load_reg(VAR_0, rd); gen_aa32_st32(VAR_0, tmp, addr, get_mem_index(VAR_0)); tcg_temp_free_i32(tmp); } if (VAR_1 & (1 << 21)) { tcg_gen_addi_i32(addr, addr, offset - 4); store_reg(VAR_0, rn, addr); } else { tcg_temp_free_i32(addr); } } else if ((VAR_1 & (1 << 23)) == 0) { if (rs == 15) { goto illegal_op; } addr = tcg_temp_local_new_i32(); load_reg_var(VAR_0, addr, rn); tcg_gen_addi_i32(addr, addr, (VAR_1 & 0xff) << 2); if (VAR_1 & (1 << 20)) { gen_load_exclusive(VAR_0, rs, 15, addr, 2); } else { gen_store_exclusive(VAR_0, rd, rs, 15, addr, 2); } tcg_temp_free_i32(addr); } else if ((VAR_1 & (7 << 5)) == 0) { if (rn == 15) { addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, VAR_0->pc); } else { addr = load_reg(VAR_0, rn); } tmp = load_reg(VAR_0, rm); tcg_gen_add_i32(addr, addr, tmp); if (VAR_1 & (1 << 4)) { tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); tmp = tcg_temp_new_i32(); gen_aa32_ld16u(VAR_0, tmp, addr, get_mem_index(VAR_0)); } else { tcg_temp_free_i32(tmp); tmp = tcg_temp_new_i32(); gen_aa32_ld8u(VAR_0, tmp, addr, get_mem_index(VAR_0)); } tcg_temp_free_i32(addr); tcg_gen_shli_i32(tmp, tmp, 1); tcg_gen_addi_i32(tmp, tmp, VAR_0->pc); store_reg(VAR_0, 15, tmp); } else { int VAR_17 = (VAR_1 >> 6) & 0x3; VAR_2 = (VAR_1 >> 4) & 0x3; switch (VAR_17) { case 0: goto illegal_op; case 1: if (VAR_2 == 2) { goto illegal_op; } ARCH(7); break; case 2: if (VAR_2 == 3) { goto illegal_op; } case 3: ARCH(8); break; } addr = tcg_temp_local_new_i32(); load_reg_var(VAR_0, addr, rn); if (!(VAR_17 & 1)) { if (VAR_1 & (1 << 20)) { tmp = tcg_temp_new_i32(); switch (VAR_2) { case 0: gen_aa32_ld8u_iss(VAR_0, tmp, addr, get_mem_index(VAR_0), rs | ISSIsAcqRel); break; case 1: gen_aa32_ld16u_iss(VAR_0, tmp, addr, get_mem_index(VAR_0), rs | ISSIsAcqRel); break; case 2: gen_aa32_ld32u_iss(VAR_0, tmp, addr, get_mem_index(VAR_0), rs | ISSIsAcqRel); break; default: abort(); } store_reg(VAR_0, rs, tmp); } else { tmp = load_reg(VAR_0, rs); switch (VAR_2) { case 0: gen_aa32_st8_iss(VAR_0, tmp, addr, get_mem_index(VAR_0), rs | ISSIsAcqRel); break; case 1: gen_aa32_st16_iss(VAR_0, tmp, addr, get_mem_index(VAR_0), rs | ISSIsAcqRel); break; case 2: gen_aa32_st32_iss(VAR_0, tmp, addr, get_mem_index(VAR_0), rs | ISSIsAcqRel); break; default: abort(); } tcg_temp_free_i32(tmp); } } else if (VAR_1 & (1 << 20)) { gen_load_exclusive(VAR_0, rs, rd, addr, VAR_2); } else { gen_store_exclusive(VAR_0, rm, rs, rd, addr, VAR_2); } tcg_temp_free_i32(addr); } } else { if (((VAR_1 >> 23) & 1) == ((VAR_1 >> 24) & 1)) { if (IS_USER(VAR_0) || arm_dc_feature(VAR_0, ARM_FEATURE_M)) { goto illegal_op; } if (VAR_1 & (1 << 20)) { addr = load_reg(VAR_0, rn); if ((VAR_1 & (1 << 24)) == 0) tcg_gen_addi_i32(addr, addr, -8); tmp = tcg_temp_new_i32(); gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0)); tcg_gen_addi_i32(addr, addr, 4); tmp2 = tcg_temp_new_i32(); gen_aa32_ld32u(VAR_0, tmp2, addr, get_mem_index(VAR_0)); if (VAR_1 & (1 << 21)) { if (VAR_1 & (1 << 24)) { tcg_gen_addi_i32(addr, addr, 4); } else { tcg_gen_addi_i32(addr, addr, -4); } store_reg(VAR_0, rn, addr); } else { tcg_temp_free_i32(addr); } gen_rfe(VAR_0, tmp, tmp2); } else { gen_srs(VAR_0, (VAR_1 & 0x1f), (VAR_1 & (1 << 24)) ? 1 : 2, VAR_1 & (1 << 21)); } } else { int VAR_7, VAR_8 = 0; TCGv_i32 loaded_var; addr = load_reg(VAR_0, rn); offset = 0; for (VAR_7 = 0; VAR_7 < 16; VAR_7++) { if (VAR_1 & (1 << VAR_7)) offset += 4; } if (VAR_1 & (1 << 24)) { tcg_gen_addi_i32(addr, addr, -offset); } TCGV_UNUSED_I32(loaded_var); for (VAR_7 = 0; VAR_7 < 16; VAR_7++) { if ((VAR_1 & (1 << VAR_7)) == 0) continue; if (VAR_1 & (1 << 20)) { tmp = tcg_temp_new_i32(); gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0)); if (VAR_7 == 15) { gen_bx_excret(VAR_0, tmp); } else if (VAR_7 == rn) { loaded_var = tmp; VAR_8 = 1; } else { store_reg(VAR_0, VAR_7, tmp); } } else { tmp = load_reg(VAR_0, VAR_7); gen_aa32_st32(VAR_0, tmp, addr, get_mem_index(VAR_0)); tcg_temp_free_i32(tmp); } tcg_gen_addi_i32(addr, addr, 4); } if (VAR_8) { store_reg(VAR_0, rn, loaded_var); } if (VAR_1 & (1 << 21)) { if (VAR_1 & (1 << 24)) { tcg_gen_addi_i32(addr, addr, -offset); } if (VAR_1 & (1 << rn)) goto illegal_op; store_reg(VAR_0, rn, addr); } else { tcg_temp_free_i32(addr); } } } break; case 5: VAR_2 = (VAR_1 >> 21) & 0xf; if (VAR_2 == 6) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } tmp = load_reg(VAR_0, rn); tmp2 = load_reg(VAR_0, rm); shift = ((VAR_1 >> 10) & 0x1c) | ((VAR_1 >> 6) & 0x3); if (VAR_1 & (1 << 5)) { if (shift == 0) shift = 31; tcg_gen_sari_i32(tmp2, tmp2, shift); tcg_gen_andi_i32(tmp, tmp, 0xffff0000); tcg_gen_ext16u_i32(tmp2, tmp2); } else { if (shift) tcg_gen_shli_i32(tmp2, tmp2, shift); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); } tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(VAR_0, rd, tmp); } else { if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(VAR_0, rn); } tmp2 = load_reg(VAR_0, rm); VAR_3 = (VAR_1 >> 4) & 3; shift = ((VAR_1 >> 6) & 3) | ((VAR_1 >> 10) & 0x1c); VAR_4 = (VAR_1 & (1 << 20)) != 0; VAR_5 = (VAR_4 && thumb2_logic_op(VAR_2)); gen_arm_shift_im(tmp2, VAR_3, shift, VAR_5); if (gen_thumb2_data_op(VAR_0, VAR_2, VAR_4, 0, tmp, tmp2)) goto illegal_op; tcg_temp_free_i32(tmp2); if (rd != 15) { store_reg(VAR_0, rd, tmp); } else { tcg_temp_free_i32(tmp); } } break; case 13: VAR_2 = ((VAR_1 >> 22) & 6) | ((VAR_1 >> 7) & 1); if (VAR_2 < 4 && (VAR_1 & 0xf000) != 0xf000) goto illegal_op; switch (VAR_2) { case 0: tmp = load_reg(VAR_0, rn); tmp2 = load_reg(VAR_0, rm); if ((VAR_1 & 0x70) != 0) goto illegal_op; VAR_2 = (VAR_1 >> 21) & 3; VAR_5 = (VAR_1 & (1 << 20)) != 0; gen_arm_shift_reg(tmp, VAR_2, tmp2, VAR_5); if (VAR_5) gen_logic_CC(tmp); store_reg(VAR_0, rd, tmp); break; case 1: VAR_2 = (VAR_1 >> 20) & 7; switch (VAR_2) { case 0: case 1: case 4: case 5: break; case 2: case 3: if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; default: goto illegal_op; } if (rn != 15) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } } tmp = load_reg(VAR_0, rm); shift = (VAR_1 >> 4) & 3; if (shift != 0) tcg_gen_rotri_i32(tmp, tmp, shift * 8); VAR_2 = (VAR_1 >> 20) & 7; switch (VAR_2) { case 0: gen_sxth(tmp); break; case 1: gen_uxth(tmp); break; case 2: gen_sxtb16(tmp); break; case 3: gen_uxtb16(tmp); break; case 4: gen_sxtb(tmp); break; case 5: gen_uxtb(tmp); break; default: g_assert_not_reached(); } if (rn != 15) { tmp2 = load_reg(VAR_0, rn); if ((VAR_2 >> 1) == 1) { gen_add16(tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } } store_reg(VAR_0, rd, tmp); break; case 2: if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } VAR_2 = (VAR_1 >> 20) & 7; shift = (VAR_1 >> 4) & 7; if ((VAR_2 & 3) == 3 || (shift & 3) == 3) goto illegal_op; tmp = load_reg(VAR_0, rn); tmp2 = load_reg(VAR_0, rm); gen_thumb2_parallel_addsub(VAR_2, shift, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(VAR_0, rd, tmp); break; case 3: VAR_2 = ((VAR_1 >> 17) & 0x38) | ((VAR_1 >> 4) & 7); if (VAR_2 < 4) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } tmp = load_reg(VAR_0, rn); tmp2 = load_reg(VAR_0, rm); if (VAR_2 & 1) gen_helper_double_saturate(tmp, cpu_env, tmp); if (VAR_2 & 2) gen_helper_sub_saturate(tmp, cpu_env, tmp2, tmp); else gen_helper_add_saturate(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } else { switch (VAR_2) { case 0x0a: case 0x08: case 0x09: case 0x0b: case 0x18: break; case 0x10: if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; case 0x20: case 0x21: case 0x22: case 0x28: case 0x29: case 0x2a: if (!arm_dc_feature(VAR_0, ARM_FEATURE_CRC)) { goto illegal_op; } break; default: goto illegal_op; } tmp = load_reg(VAR_0, rn); switch (VAR_2) { case 0x0a: gen_helper_rbit(tmp, tmp); break; case 0x08: tcg_gen_bswap32_i32(tmp, tmp); break; case 0x09: gen_rev16(tmp); break; case 0x0b: gen_revsh(tmp); break; case 0x10: tmp2 = load_reg(VAR_0, rm); tmp3 = tcg_temp_new_i32(); tcg_gen_ld_i32(tmp3, cpu_env, offsetof(CPUARMState, GE)); gen_helper_sel_flags(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); tcg_temp_free_i32(tmp2); break; case 0x18: tcg_gen_clzi_i32(tmp, tmp, 32); break; case 0x20: case 0x21: case 0x22: case 0x28: case 0x29: case 0x2a: { uint32_t sz = VAR_2 & 0x3; uint32_t c = VAR_2 & 0x8; tmp2 = load_reg(VAR_0, rm); if (sz == 0) { tcg_gen_andi_i32(tmp2, tmp2, 0xff); } else if (sz == 1) { tcg_gen_andi_i32(tmp2, tmp2, 0xffff); } tmp3 = tcg_const_i32(1 << sz); if (c) { gen_helper_crc32c(tmp, tmp, tmp2, tmp3); } else { gen_helper_crc32(tmp, tmp, tmp2, tmp3); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; } default: g_assert_not_reached(); } } store_reg(VAR_0, rd, tmp); break; case 4: case 5: switch ((VAR_1 >> 20) & 7) { case 0: case 7: break; case 1: case 2: case 3: case 4: case 5: case 6: if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { goto illegal_op; } break; } VAR_2 = (VAR_1 >> 4) & 0xf; tmp = load_reg(VAR_0, rn); tmp2 = load_reg(VAR_0, rm); switch ((VAR_1 >> 20) & 7) { case 0: tcg_gen_mul_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(VAR_0, rs); if (VAR_2) tcg_gen_sub_i32(tmp, tmp2, tmp); else tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 1: gen_mulxy(tmp, tmp2, VAR_2 & 2, VAR_2 & 1); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(VAR_0, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 2: case 4: if (VAR_2) gen_swap_half(tmp2); gen_smul_dual(tmp, tmp2); if (VAR_1 & (1 << 22)) { tcg_gen_sub_i32(tmp, tmp, tmp2); } else { gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); } tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(VAR_0, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 3: if (VAR_2) tcg_gen_sari_i32(tmp2, tmp2, 16); else gen_sxth(tmp2); tmp64 = gen_muls_i64_i32(tmp, tmp2); tcg_gen_shri_i64(tmp64, tmp64, 16); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); if (rs != 15) { tmp2 = load_reg(VAR_0, rs); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; case 5: case 6: tmp64 = gen_muls_i64_i32(tmp, tmp2); if (rs != 15) { tmp = load_reg(VAR_0, rs); if (VAR_1 & (1 << 20)) { tmp64 = gen_addq_msw(tmp64, tmp); } else { tmp64 = gen_subq_msw(tmp64, tmp); } } if (VAR_1 & (1 << 4)) { tcg_gen_addi_i64(tmp64, tmp64, 0x80000000u); } tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); break; case 7: gen_helper_usad8(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (rs != 15) { tmp2 = load_reg(VAR_0, rs); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } break; } store_reg(VAR_0, rd, tmp); break; case 6: case 7: VAR_2 = ((VAR_1 >> 4) & 0xf) | ((VAR_1 >> 16) & 0x70); tmp = load_reg(VAR_0, rn); tmp2 = load_reg(VAR_0, rm); if ((VAR_2 & 0x50) == 0x10) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DIV)) { goto illegal_op; } if (VAR_2 & 0x20) gen_helper_udiv(tmp, tmp, tmp2); else gen_helper_sdiv(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(VAR_0, rd, tmp); } else if ((VAR_2 & 0xe) == 0xc) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } if (VAR_2 & 1) gen_swap_half(tmp2); gen_smul_dual(tmp, tmp2); if (VAR_2 & 0x10) { tcg_gen_sub_i32(tmp, tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp2); tmp64 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_temp_free_i32(tmp); gen_addq(VAR_0, tmp64, rs, rd); gen_storeq_reg(VAR_0, rs, rd, tmp64); tcg_temp_free_i64(tmp64); } else { if (VAR_2 & 0x20) { tmp64 = gen_mulu_i64_i32(tmp, tmp2); } else { if (VAR_2 & 8) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); goto illegal_op; } gen_mulxy(tmp, tmp2, VAR_2 & 2, VAR_2 & 1); tcg_temp_free_i32(tmp2); tmp64 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_temp_free_i32(tmp); } else { tmp64 = gen_muls_i64_i32(tmp, tmp2); } } if (VAR_2 & 4) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i64(tmp64); goto illegal_op; } gen_addq_lo(VAR_0, tmp64, rs); gen_addq_lo(VAR_0, tmp64, rd); } else if (VAR_2 & 0x40) { gen_addq(VAR_0, tmp64, rs, rd); } gen_storeq_reg(VAR_0, rs, rd, tmp64); tcg_temp_free_i64(tmp64); } break; } break; case 6: case 7: case 14: case 15: if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) { gen_exception_insn(VAR_0, 4, EXCP_NOCP, syn_uncategorized(), default_exception_el(VAR_0)); break; } if (((VAR_1 >> 24) & 3) == 3) { VAR_1 = (VAR_1 & 0xe2ffffff) | ((VAR_1 & (1 << 28)) >> 4) | (1 << 28); if (disas_neon_data_insn(VAR_0, VAR_1)) { goto illegal_op; } } else if (((VAR_1 >> 8) & 0xe) == 10) { if (disas_vfp_insn(VAR_0, VAR_1)) { goto illegal_op; } } else { if (VAR_1 & (1 << 28)) goto illegal_op; if (disas_coproc_insn(VAR_0, VAR_1)) { goto illegal_op; } } break; case 8: case 9: case 10: case 11: if (VAR_1 & (1 << 15)) { if (VAR_1 & 0x5000) { offset = ((int32_t)VAR_1 << 5) >> 9 & ~(int32_t)0xfff; offset |= (VAR_1 & 0x7ff) << 1; offset ^= ((~VAR_1) & (1 << 13)) << 10; offset ^= ((~VAR_1) & (1 << 11)) << 11; if (VAR_1 & (1 << 14)) { tcg_gen_movi_i32(cpu_R[14], VAR_0->pc | 1); } offset += VAR_0->pc; if (VAR_1 & (1 << 12)) { gen_jmp(VAR_0, offset); } else { offset &= ~(uint32_t)2; gen_bx_im(VAR_0, offset); } } else if (((VAR_1 >> 23) & 7) == 7) { if (VAR_1 & (1 << 13)) goto illegal_op; if (VAR_1 & (1 << 26)) { if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) { goto illegal_op; } if (!(VAR_1 & (1 << 20))) { int VAR_9 = extract32(VAR_1, 16, 4) << 12 | extract32(VAR_1, 0, 12); ARCH(7); if (IS_USER(VAR_0)) { goto illegal_op; } gen_hvc(VAR_0, VAR_9); } else { ARCH(6K); if (IS_USER(VAR_0)) { goto illegal_op; } gen_smc(VAR_0); } } else { VAR_2 = (VAR_1 >> 20) & 7; switch (VAR_2) { case 0: if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) { tmp = load_reg(VAR_0, rn); addr = tcg_const_i32(VAR_1 & 0xfff); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); tcg_temp_free_i32(tmp); gen_lookup_tb(VAR_0); break; } case 1: if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) { goto illegal_op; } if (extract32(VAR_1, 5, 1)) { int VAR_12 = extract32(VAR_1, 8, 4) | (extract32(VAR_1, 4, 1) << 4); int VAR_11 = VAR_2 & 1; gen_msr_banked(VAR_0, VAR_11, VAR_12, rm); break; } tmp = load_reg(VAR_0, rn); if (gen_set_psr(VAR_0, msr_mask(VAR_0, (VAR_1 >> 8) & 0xf, VAR_2 == 1), VAR_2 == 1, tmp)) goto illegal_op; break; case 2: if (((VAR_1 >> 8) & 7) == 0) { gen_nop_hint(VAR_0, VAR_1 & 0xff); } if (IS_USER(VAR_0)) break; offset = 0; imm = 0; if (VAR_1 & (1 << 10)) { if (VAR_1 & (1 << 7)) offset |= CPSR_A; if (VAR_1 & (1 << 6)) offset |= CPSR_I; if (VAR_1 & (1 << 5)) offset |= CPSR_F; if (VAR_1 & (1 << 9)) imm = CPSR_A | CPSR_I | CPSR_F; } if (VAR_1 & (1 << 8)) { offset |= 0x1f; imm |= (VAR_1 & 0x1f); } if (offset) { gen_set_psr_im(VAR_0, offset, 0, imm); } break; case 3: ARCH(7); VAR_2 = (VAR_1 >> 4) & 0xf; switch (VAR_2) { case 2: gen_clrex(VAR_0); break; case 4: case 5: tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); break; case 6: gen_goto_tb(VAR_0, 0, VAR_0->pc & ~1); break; default: goto illegal_op; } break; case 4: if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) { goto illegal_op; } tmp = load_reg(VAR_0, rn); gen_bx(VAR_0, tmp); break; case 5: if (IS_USER(VAR_0)) { goto illegal_op; } if (rn != 14 || rd != 15) { goto illegal_op; } tmp = load_reg(VAR_0, rn); tcg_gen_subi_i32(tmp, tmp, VAR_1 & 0xff); gen_exception_return(VAR_0, tmp); break; case 6: if (extract32(VAR_1, 5, 1) && !arm_dc_feature(VAR_0, ARM_FEATURE_M)) { int VAR_12 = extract32(VAR_1, 16, 4) | (extract32(VAR_1, 4, 1) << 4); gen_mrs_banked(VAR_0, 0, VAR_12, rd); break; } if (extract32(VAR_1, 16, 4) != 0xf) { goto illegal_op; } if (!arm_dc_feature(VAR_0, ARM_FEATURE_M) && extract32(VAR_1, 0, 8) != 0) { goto illegal_op; } tmp = tcg_temp_new_i32(); if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) { addr = tcg_const_i32(VAR_1 & 0xff); gen_helper_v7m_mrs(tmp, cpu_env, addr); tcg_temp_free_i32(addr); } else { gen_helper_cpsr_read(tmp, cpu_env); } store_reg(VAR_0, rd, tmp); break; case 7: if (extract32(VAR_1, 5, 1) && !arm_dc_feature(VAR_0, ARM_FEATURE_M)) { int VAR_12 = extract32(VAR_1, 16, 4) | (extract32(VAR_1, 4, 1) << 4); gen_mrs_banked(VAR_0, 1, VAR_12, rd); break; } if (IS_USER(VAR_0) || arm_dc_feature(VAR_0, ARM_FEATURE_M)) { goto illegal_op; } if (extract32(VAR_1, 16, 4) != 0xf || extract32(VAR_1, 0, 8) != 0) { goto illegal_op; } tmp = load_cpu_field(spsr); store_reg(VAR_0, rd, tmp); break; } } } else { VAR_2 = (VAR_1 >> 22) & 0xf; VAR_0->condlabel = gen_new_label(); arm_gen_test_cc(VAR_2 ^ 1, VAR_0->condlabel); VAR_0->condjmp = 1; offset = (VAR_1 & 0x7ff) << 1; offset |= (VAR_1 & 0x003f0000) >> 4; offset |= ((int32_t)((VAR_1 << 5) & 0x80000000)) >> 11; offset |= (VAR_1 & (1 << 13)) << 5; offset |= (VAR_1 & (1 << 11)) << 8; gen_jmp(VAR_0, VAR_0->pc + offset); } } else { if (VAR_1 & (1 << 25)) { if (VAR_1 & (1 << 24)) { if (VAR_1 & (1 << 20)) goto illegal_op; VAR_2 = (VAR_1 >> 21) & 7; imm = VAR_1 & 0x1f; shift = ((VAR_1 >> 6) & 3) | ((VAR_1 >> 10) & 0x1c); if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(VAR_0, rn); } switch (VAR_2) { case 2: imm++; if (shift + imm > 32) goto illegal_op; if (imm < 32) { tcg_gen_sextract_i32(tmp, tmp, shift, imm); } break; case 6: imm++; if (shift + imm > 32) goto illegal_op; if (imm < 32) { tcg_gen_extract_i32(tmp, tmp, shift, imm); } break; case 3: if (imm < shift) goto illegal_op; imm = imm + 1 - shift; if (imm != 32) { tmp2 = load_reg(VAR_0, rd); tcg_gen_deposit_i32(tmp, tmp2, tmp, shift, imm); tcg_temp_free_i32(tmp2); } break; case 7: goto illegal_op; default: if (shift) { if (VAR_2 & 1) tcg_gen_sari_i32(tmp, tmp, shift); else tcg_gen_shli_i32(tmp, tmp, shift); } tmp2 = tcg_const_i32(imm); if (VAR_2 & 4) { if ((VAR_2 & 1) && shift == 0) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } gen_helper_usat16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_usat(tmp, cpu_env, tmp, tmp2); } } else { if ((VAR_2 & 1) && shift == 0) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); goto illegal_op; } gen_helper_ssat16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_ssat(tmp, cpu_env, tmp, tmp2); } } tcg_temp_free_i32(tmp2); break; } store_reg(VAR_0, rd, tmp); } else { imm = ((VAR_1 & 0x04000000) >> 15) | ((VAR_1 & 0x7000) >> 4) | (VAR_1 & 0xff); if (VAR_1 & (1 << 22)) { imm |= (VAR_1 >> 4) & 0xf000; if (VAR_1 & (1 << 23)) { tmp = load_reg(VAR_0, rd); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_ori_i32(tmp, tmp, imm << 16); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, imm); } } else { if (rn == 15) { offset = VAR_0->pc & ~(uint32_t)3; if (VAR_1 & (1 << 23)) offset -= imm; else offset += imm; tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, offset); } else { tmp = load_reg(VAR_0, rn); if (VAR_1 & (1 << 23)) tcg_gen_subi_i32(tmp, tmp, imm); else tcg_gen_addi_i32(tmp, tmp, imm); } } store_reg(VAR_0, rd, tmp); } } else { int VAR_12 = 0; shift = ((VAR_1 & 0x04000000) >> 23) | ((VAR_1 & 0x7000) >> 12); imm = (VAR_1 & 0xff); switch (shift) { case 0: break; case 1: imm |= imm << 16; break; case 2: imm |= imm << 16; imm <<= 8; break; case 3: imm |= imm << 16; imm |= imm << 8; break; default: shift = (shift << 1) | (imm >> 7); imm |= 0x80; imm = imm << (32 - shift); VAR_12 = 1; break; } tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); rn = (VAR_1 >> 16) & 0xf; if (rn == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(VAR_0, rn); } VAR_2 = (VAR_1 >> 21) & 0xf; if (gen_thumb2_data_op(VAR_0, VAR_2, (VAR_1 & (1 << 20)) != 0, VAR_12, tmp, tmp2)) goto illegal_op; tcg_temp_free_i32(tmp2); rd = (VAR_1 >> 8) & 0xf; if (rd != 15) { store_reg(VAR_0, rd, tmp); } else { tcg_temp_free_i32(tmp); } } } break; case 12: { int VAR_13 = 0; int VAR_14 = 0; int VAR_15; ISSInfo issinfo; if ((VAR_1 & 0x01100000) == 0x01000000) { if (disas_neon_ls_insn(VAR_0, VAR_1)) { goto illegal_op; } break; } VAR_2 = ((VAR_1 >> 21) & 3) | ((VAR_1 >> 22) & 4); if (rs == 15) { if (!(VAR_1 & (1 << 20))) { goto illegal_op; } if (VAR_2 != 2) { int VAR_16 = (VAR_1 >> 23) & 3; int VAR_17 = (VAR_1 >> 6) & 0x3f; if (VAR_2 & 2) { goto illegal_op; } if (rn == 15) { return 0; } if (VAR_16 & 1) { return 0; } if ((VAR_17 == 0) || ((VAR_17 & 0x3c) == 0x30)) { return 0; } return 1; } } VAR_15 = get_mem_index(VAR_0); if (rn == 15) { addr = tcg_temp_new_i32(); imm = VAR_0->pc & 0xfffffffc; if (VAR_1 & (1 << 23)) imm += VAR_1 & 0xfff; else imm -= VAR_1 & 0xfff; tcg_gen_movi_i32(addr, imm); } else { addr = load_reg(VAR_0, rn); if (VAR_1 & (1 << 23)) { imm = VAR_1 & 0xfff; tcg_gen_addi_i32(addr, addr, imm); } else { imm = VAR_1 & 0xff; switch ((VAR_1 >> 8) & 0xf) { case 0x0: shift = (VAR_1 >> 4) & 0xf; if (shift > 3) { tcg_temp_free_i32(addr); goto illegal_op; } tmp = load_reg(VAR_0, rm); if (shift) tcg_gen_shli_i32(tmp, tmp, shift); tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); break; case 0xc: tcg_gen_addi_i32(addr, addr, -imm); break; case 0xe: tcg_gen_addi_i32(addr, addr, imm); VAR_15 = get_a32_user_mem_index(VAR_0); break; case 0x9: imm = -imm; case 0xb: VAR_13 = 1; VAR_14 = 1; break; case 0xd: imm = -imm; case 0xf: tcg_gen_addi_i32(addr, addr, imm); VAR_14 = 1; break; default: tcg_temp_free_i32(addr); goto illegal_op; } } } issinfo = VAR_14 ? ISSInvalid : rs; if (VAR_1 & (1 << 20)) { tmp = tcg_temp_new_i32(); switch (VAR_2) { case 0: gen_aa32_ld8u_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; case 4: gen_aa32_ld8s_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; case 1: gen_aa32_ld16u_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; case 5: gen_aa32_ld16s_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; case 2: gen_aa32_ld32u_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; default: tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); goto illegal_op; } if (rs == 15) { gen_bx_excret(VAR_0, tmp); } else { store_reg(VAR_0, rs, tmp); } } else { tmp = load_reg(VAR_0, rs); switch (VAR_2) { case 0: gen_aa32_st8_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; case 1: gen_aa32_st16_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; case 2: gen_aa32_st32_iss(VAR_0, tmp, addr, VAR_15, issinfo); break; default: tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); goto illegal_op; } tcg_temp_free_i32(tmp); } if (VAR_13) tcg_gen_addi_i32(addr, addr, imm); if (VAR_14) { store_reg(VAR_0, rn, addr); } else { tcg_temp_free_i32(addr); } } break; default: goto illegal_op; } return 0; illegal_op: return 1; }
[ "static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{", "uint32_t imm, shift, offset;", "uint32_t rd, rn, rm, rs;", "TCGv_i32 tmp;", "TCGv_i32 tmp2;", "TCGv_i32 tmp3;", "TCGv_i32 addr;", "TCGv_i64 tmp64;", "int VAR_2;", "int VAR_3;", "int VAR_4;", "int VAR_5;", "if ((VAR_1 & 0xf800e800) != 0xf000e800) {", "ARCH(6T2);", "}", "rn = (VAR_1 >> 16) & 0xf;", "rs = (VAR_1 >> 12) & 0xf;", "rd = (VAR_1 >> 8) & 0xf;", "rm = VAR_1 & 0xf;", "switch ((VAR_1 >> 25) & 0xf) {", "case 0: case 1: case 2: case 3:\nabort();", "case 4:\nif (VAR_1 & (1 << 22)) {", "if (VAR_1 == 0xe97fe97f && arm_dc_feature(VAR_0, ARM_FEATURE_M) &&\narm_dc_feature(VAR_0, ARM_FEATURE_V8)) {", "if (VAR_0->v8m_secure) {", "VAR_0->condexec_cond = 0;", "VAR_0->condexec_mask = 0;", "}", "} else if (VAR_1 & 0x01200000) {", "if (rn == 15) {", "if (VAR_1 & (1 << 21)) {", "goto illegal_op;", "}", "addr = tcg_temp_new_i32();", "tcg_gen_movi_i32(addr, VAR_0->pc & ~3);", "} else {", "addr = load_reg(VAR_0, rn);", "}", "offset = (VAR_1 & 0xff) * 4;", "if ((VAR_1 & (1 << 23)) == 0)\noffset = -offset;", "if (VAR_1 & (1 << 24)) {", "tcg_gen_addi_i32(addr, addr, offset);", "offset = 0;", "}", "if (VAR_1 & (1 << 20)) {", "tmp = tcg_temp_new_i32();", "gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0));", "store_reg(VAR_0, rs, tmp);", "tcg_gen_addi_i32(addr, addr, 4);", "tmp = tcg_temp_new_i32();", "gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0));", "store_reg(VAR_0, rd, tmp);", "} else {", "tmp = load_reg(VAR_0, rs);", "gen_aa32_st32(VAR_0, tmp, addr, get_mem_index(VAR_0));", "tcg_temp_free_i32(tmp);", "tcg_gen_addi_i32(addr, addr, 4);", "tmp = load_reg(VAR_0, rd);", "gen_aa32_st32(VAR_0, tmp, addr, get_mem_index(VAR_0));", "tcg_temp_free_i32(tmp);", "}", "if (VAR_1 & (1 << 21)) {", "tcg_gen_addi_i32(addr, addr, offset - 4);", "store_reg(VAR_0, rn, addr);", "} else {", "tcg_temp_free_i32(addr);", "}", "} else if ((VAR_1 & (1 << 23)) == 0) {", "if (rs == 15) {", "goto illegal_op;", "}", "addr = tcg_temp_local_new_i32();", "load_reg_var(VAR_0, addr, rn);", "tcg_gen_addi_i32(addr, addr, (VAR_1 & 0xff) << 2);", "if (VAR_1 & (1 << 20)) {", "gen_load_exclusive(VAR_0, rs, 15, addr, 2);", "} else {", "gen_store_exclusive(VAR_0, rd, rs, 15, addr, 2);", "}", "tcg_temp_free_i32(addr);", "} else if ((VAR_1 & (7 << 5)) == 0) {", "if (rn == 15) {", "addr = tcg_temp_new_i32();", "tcg_gen_movi_i32(addr, VAR_0->pc);", "} else {", "addr = load_reg(VAR_0, rn);", "}", "tmp = load_reg(VAR_0, rm);", "tcg_gen_add_i32(addr, addr, tmp);", "if (VAR_1 & (1 << 4)) {", "tcg_gen_add_i32(addr, addr, tmp);", "tcg_temp_free_i32(tmp);", "tmp = tcg_temp_new_i32();", "gen_aa32_ld16u(VAR_0, tmp, addr, get_mem_index(VAR_0));", "} else {", "tcg_temp_free_i32(tmp);", "tmp = tcg_temp_new_i32();", "gen_aa32_ld8u(VAR_0, tmp, addr, get_mem_index(VAR_0));", "}", "tcg_temp_free_i32(addr);", "tcg_gen_shli_i32(tmp, tmp, 1);", "tcg_gen_addi_i32(tmp, tmp, VAR_0->pc);", "store_reg(VAR_0, 15, tmp);", "} else {", "int VAR_17 = (VAR_1 >> 6) & 0x3;", "VAR_2 = (VAR_1 >> 4) & 0x3;", "switch (VAR_17) {", "case 0:\ngoto illegal_op;", "case 1:\nif (VAR_2 == 2) {", "goto illegal_op;", "}", "ARCH(7);", "break;", "case 2:\nif (VAR_2 == 3) {", "goto illegal_op;", "}", "case 3:\nARCH(8);", "break;", "}", "addr = tcg_temp_local_new_i32();", "load_reg_var(VAR_0, addr, rn);", "if (!(VAR_17 & 1)) {", "if (VAR_1 & (1 << 20)) {", "tmp = tcg_temp_new_i32();", "switch (VAR_2) {", "case 0:\ngen_aa32_ld8u_iss(VAR_0, tmp, addr, get_mem_index(VAR_0),\nrs | ISSIsAcqRel);", "break;", "case 1:\ngen_aa32_ld16u_iss(VAR_0, tmp, addr, get_mem_index(VAR_0),\nrs | ISSIsAcqRel);", "break;", "case 2:\ngen_aa32_ld32u_iss(VAR_0, tmp, addr, get_mem_index(VAR_0),\nrs | ISSIsAcqRel);", "break;", "default:\nabort();", "}", "store_reg(VAR_0, rs, tmp);", "} else {", "tmp = load_reg(VAR_0, rs);", "switch (VAR_2) {", "case 0:\ngen_aa32_st8_iss(VAR_0, tmp, addr, get_mem_index(VAR_0),\nrs | ISSIsAcqRel);", "break;", "case 1:\ngen_aa32_st16_iss(VAR_0, tmp, addr, get_mem_index(VAR_0),\nrs | ISSIsAcqRel);", "break;", "case 2:\ngen_aa32_st32_iss(VAR_0, tmp, addr, get_mem_index(VAR_0),\nrs | ISSIsAcqRel);", "break;", "default:\nabort();", "}", "tcg_temp_free_i32(tmp);", "}", "} else if (VAR_1 & (1 << 20)) {", "gen_load_exclusive(VAR_0, rs, rd, addr, VAR_2);", "} else {", "gen_store_exclusive(VAR_0, rm, rs, rd, addr, VAR_2);", "}", "tcg_temp_free_i32(addr);", "}", "} else {", "if (((VAR_1 >> 23) & 1) == ((VAR_1 >> 24) & 1)) {", "if (IS_USER(VAR_0) || arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "goto illegal_op;", "}", "if (VAR_1 & (1 << 20)) {", "addr = load_reg(VAR_0, rn);", "if ((VAR_1 & (1 << 24)) == 0)\ntcg_gen_addi_i32(addr, addr, -8);", "tmp = tcg_temp_new_i32();", "gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0));", "tcg_gen_addi_i32(addr, addr, 4);", "tmp2 = tcg_temp_new_i32();", "gen_aa32_ld32u(VAR_0, tmp2, addr, get_mem_index(VAR_0));", "if (VAR_1 & (1 << 21)) {", "if (VAR_1 & (1 << 24)) {", "tcg_gen_addi_i32(addr, addr, 4);", "} else {", "tcg_gen_addi_i32(addr, addr, -4);", "}", "store_reg(VAR_0, rn, addr);", "} else {", "tcg_temp_free_i32(addr);", "}", "gen_rfe(VAR_0, tmp, tmp2);", "} else {", "gen_srs(VAR_0, (VAR_1 & 0x1f), (VAR_1 & (1 << 24)) ? 1 : 2,\nVAR_1 & (1 << 21));", "}", "} else {", "int VAR_7, VAR_8 = 0;", "TCGv_i32 loaded_var;", "addr = load_reg(VAR_0, rn);", "offset = 0;", "for (VAR_7 = 0; VAR_7 < 16; VAR_7++) {", "if (VAR_1 & (1 << VAR_7))\noffset += 4;", "}", "if (VAR_1 & (1 << 24)) {", "tcg_gen_addi_i32(addr, addr, -offset);", "}", "TCGV_UNUSED_I32(loaded_var);", "for (VAR_7 = 0; VAR_7 < 16; VAR_7++) {", "if ((VAR_1 & (1 << VAR_7)) == 0)\ncontinue;", "if (VAR_1 & (1 << 20)) {", "tmp = tcg_temp_new_i32();", "gen_aa32_ld32u(VAR_0, tmp, addr, get_mem_index(VAR_0));", "if (VAR_7 == 15) {", "gen_bx_excret(VAR_0, tmp);", "} else if (VAR_7 == rn) {", "loaded_var = tmp;", "VAR_8 = 1;", "} else {", "store_reg(VAR_0, VAR_7, tmp);", "}", "} else {", "tmp = load_reg(VAR_0, VAR_7);", "gen_aa32_st32(VAR_0, tmp, addr, get_mem_index(VAR_0));", "tcg_temp_free_i32(tmp);", "}", "tcg_gen_addi_i32(addr, addr, 4);", "}", "if (VAR_8) {", "store_reg(VAR_0, rn, loaded_var);", "}", "if (VAR_1 & (1 << 21)) {", "if (VAR_1 & (1 << 24)) {", "tcg_gen_addi_i32(addr, addr, -offset);", "}", "if (VAR_1 & (1 << rn))\ngoto illegal_op;", "store_reg(VAR_0, rn, addr);", "} else {", "tcg_temp_free_i32(addr);", "}", "}", "}", "break;", "case 5:\nVAR_2 = (VAR_1 >> 21) & 0xf;", "if (VAR_2 == 6) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "goto illegal_op;", "}", "tmp = load_reg(VAR_0, rn);", "tmp2 = load_reg(VAR_0, rm);", "shift = ((VAR_1 >> 10) & 0x1c) | ((VAR_1 >> 6) & 0x3);", "if (VAR_1 & (1 << 5)) {", "if (shift == 0)\nshift = 31;", "tcg_gen_sari_i32(tmp2, tmp2, shift);", "tcg_gen_andi_i32(tmp, tmp, 0xffff0000);", "tcg_gen_ext16u_i32(tmp2, tmp2);", "} else {", "if (shift)\ntcg_gen_shli_i32(tmp2, tmp2, shift);", "tcg_gen_ext16u_i32(tmp, tmp);", "tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000);", "}", "tcg_gen_or_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "store_reg(VAR_0, rd, tmp);", "} else {", "if (rn == 15) {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "} else {", "tmp = load_reg(VAR_0, rn);", "}", "tmp2 = load_reg(VAR_0, rm);", "VAR_3 = (VAR_1 >> 4) & 3;", "shift = ((VAR_1 >> 6) & 3) | ((VAR_1 >> 10) & 0x1c);", "VAR_4 = (VAR_1 & (1 << 20)) != 0;", "VAR_5 = (VAR_4 && thumb2_logic_op(VAR_2));", "gen_arm_shift_im(tmp2, VAR_3, shift, VAR_5);", "if (gen_thumb2_data_op(VAR_0, VAR_2, VAR_4, 0, tmp, tmp2))\ngoto illegal_op;", "tcg_temp_free_i32(tmp2);", "if (rd != 15) {", "store_reg(VAR_0, rd, tmp);", "} else {", "tcg_temp_free_i32(tmp);", "}", "}", "break;", "case 13:\nVAR_2 = ((VAR_1 >> 22) & 6) | ((VAR_1 >> 7) & 1);", "if (VAR_2 < 4 && (VAR_1 & 0xf000) != 0xf000)\ngoto illegal_op;", "switch (VAR_2) {", "case 0:\ntmp = load_reg(VAR_0, rn);", "tmp2 = load_reg(VAR_0, rm);", "if ((VAR_1 & 0x70) != 0)\ngoto illegal_op;", "VAR_2 = (VAR_1 >> 21) & 3;", "VAR_5 = (VAR_1 & (1 << 20)) != 0;", "gen_arm_shift_reg(tmp, VAR_2, tmp2, VAR_5);", "if (VAR_5)\ngen_logic_CC(tmp);", "store_reg(VAR_0, rd, tmp);", "break;", "case 1:\nVAR_2 = (VAR_1 >> 20) & 7;", "switch (VAR_2) {", "case 0:\ncase 1:\ncase 4:\ncase 5:\nbreak;", "case 2:\ncase 3:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "goto illegal_op;", "}", "break;", "default:\ngoto illegal_op;", "}", "if (rn != 15) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "goto illegal_op;", "}", "}", "tmp = load_reg(VAR_0, rm);", "shift = (VAR_1 >> 4) & 3;", "if (shift != 0)\ntcg_gen_rotri_i32(tmp, tmp, shift * 8);", "VAR_2 = (VAR_1 >> 20) & 7;", "switch (VAR_2) {", "case 0: gen_sxth(tmp); break;", "case 1: gen_uxth(tmp); break;", "case 2: gen_sxtb16(tmp); break;", "case 3: gen_uxtb16(tmp); break;", "case 4: gen_sxtb(tmp); break;", "case 5: gen_uxtb(tmp); break;", "default:\ng_assert_not_reached();", "}", "if (rn != 15) {", "tmp2 = load_reg(VAR_0, rn);", "if ((VAR_2 >> 1) == 1) {", "gen_add16(tmp, tmp2);", "} else {", "tcg_gen_add_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "}", "store_reg(VAR_0, rd, tmp);", "break;", "case 2:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "goto illegal_op;", "}", "VAR_2 = (VAR_1 >> 20) & 7;", "shift = (VAR_1 >> 4) & 7;", "if ((VAR_2 & 3) == 3 || (shift & 3) == 3)\ngoto illegal_op;", "tmp = load_reg(VAR_0, rn);", "tmp2 = load_reg(VAR_0, rm);", "gen_thumb2_parallel_addsub(VAR_2, shift, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "store_reg(VAR_0, rd, tmp);", "break;", "case 3:\nVAR_2 = ((VAR_1 >> 17) & 0x38) | ((VAR_1 >> 4) & 7);", "if (VAR_2 < 4) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "goto illegal_op;", "}", "tmp = load_reg(VAR_0, rn);", "tmp2 = load_reg(VAR_0, rm);", "if (VAR_2 & 1)\ngen_helper_double_saturate(tmp, cpu_env, tmp);", "if (VAR_2 & 2)\ngen_helper_sub_saturate(tmp, cpu_env, tmp2, tmp);", "else\ngen_helper_add_saturate(tmp, cpu_env, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "} else {", "switch (VAR_2) {", "case 0x0a:\ncase 0x08:\ncase 0x09:\ncase 0x0b:\ncase 0x18:\nbreak;", "case 0x10:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "goto illegal_op;", "}", "break;", "case 0x20:\ncase 0x21:\ncase 0x22:\ncase 0x28:\ncase 0x29:\ncase 0x2a:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_CRC)) {", "goto illegal_op;", "}", "break;", "default:\ngoto illegal_op;", "}", "tmp = load_reg(VAR_0, rn);", "switch (VAR_2) {", "case 0x0a:\ngen_helper_rbit(tmp, tmp);", "break;", "case 0x08:\ntcg_gen_bswap32_i32(tmp, tmp);", "break;", "case 0x09:\ngen_rev16(tmp);", "break;", "case 0x0b:\ngen_revsh(tmp);", "break;", "case 0x10:\ntmp2 = load_reg(VAR_0, rm);", "tmp3 = tcg_temp_new_i32();", "tcg_gen_ld_i32(tmp3, cpu_env, offsetof(CPUARMState, GE));", "gen_helper_sel_flags(tmp, tmp3, tmp, tmp2);", "tcg_temp_free_i32(tmp3);", "tcg_temp_free_i32(tmp2);", "break;", "case 0x18:\ntcg_gen_clzi_i32(tmp, tmp, 32);", "break;", "case 0x20:\ncase 0x21:\ncase 0x22:\ncase 0x28:\ncase 0x29:\ncase 0x2a:\n{", "uint32_t sz = VAR_2 & 0x3;", "uint32_t c = VAR_2 & 0x8;", "tmp2 = load_reg(VAR_0, rm);", "if (sz == 0) {", "tcg_gen_andi_i32(tmp2, tmp2, 0xff);", "} else if (sz == 1) {", "tcg_gen_andi_i32(tmp2, tmp2, 0xffff);", "}", "tmp3 = tcg_const_i32(1 << sz);", "if (c) {", "gen_helper_crc32c(tmp, tmp, tmp2, tmp3);", "} else {", "gen_helper_crc32(tmp, tmp, tmp2, tmp3);", "}", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "}", "default:\ng_assert_not_reached();", "}", "}", "store_reg(VAR_0, rd, tmp);", "break;", "case 4: case 5:\nswitch ((VAR_1 >> 20) & 7) {", "case 0:\ncase 7:\nbreak;", "case 1:\ncase 2:\ncase 3:\ncase 4:\ncase 5: case 6:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "goto illegal_op;", "}", "break;", "}", "VAR_2 = (VAR_1 >> 4) & 0xf;", "tmp = load_reg(VAR_0, rn);", "tmp2 = load_reg(VAR_0, rm);", "switch ((VAR_1 >> 20) & 7) {", "case 0:\ntcg_gen_mul_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "if (rs != 15) {", "tmp2 = load_reg(VAR_0, rs);", "if (VAR_2)\ntcg_gen_sub_i32(tmp, tmp2, tmp);", "else\ntcg_gen_add_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "break;", "case 1:\ngen_mulxy(tmp, tmp2, VAR_2 & 2, VAR_2 & 1);", "tcg_temp_free_i32(tmp2);", "if (rs != 15) {", "tmp2 = load_reg(VAR_0, rs);", "gen_helper_add_setq(tmp, cpu_env, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "break;", "case 2:\ncase 4:\nif (VAR_2)\ngen_swap_half(tmp2);", "gen_smul_dual(tmp, tmp2);", "if (VAR_1 & (1 << 22)) {", "tcg_gen_sub_i32(tmp, tmp, tmp2);", "} else {", "gen_helper_add_setq(tmp, cpu_env, tmp, tmp2);", "}", "tcg_temp_free_i32(tmp2);", "if (rs != 15)\n{", "tmp2 = load_reg(VAR_0, rs);", "gen_helper_add_setq(tmp, cpu_env, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "break;", "case 3:\nif (VAR_2)\ntcg_gen_sari_i32(tmp2, tmp2, 16);", "else\ngen_sxth(tmp2);", "tmp64 = gen_muls_i64_i32(tmp, tmp2);", "tcg_gen_shri_i64(tmp64, tmp64, 16);", "tmp = tcg_temp_new_i32();", "tcg_gen_extrl_i64_i32(tmp, tmp64);", "tcg_temp_free_i64(tmp64);", "if (rs != 15)\n{", "tmp2 = load_reg(VAR_0, rs);", "gen_helper_add_setq(tmp, cpu_env, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "break;", "case 5: case 6:\ntmp64 = gen_muls_i64_i32(tmp, tmp2);", "if (rs != 15) {", "tmp = load_reg(VAR_0, rs);", "if (VAR_1 & (1 << 20)) {", "tmp64 = gen_addq_msw(tmp64, tmp);", "} else {", "tmp64 = gen_subq_msw(tmp64, tmp);", "}", "}", "if (VAR_1 & (1 << 4)) {", "tcg_gen_addi_i64(tmp64, tmp64, 0x80000000u);", "}", "tcg_gen_shri_i64(tmp64, tmp64, 32);", "tmp = tcg_temp_new_i32();", "tcg_gen_extrl_i64_i32(tmp, tmp64);", "tcg_temp_free_i64(tmp64);", "break;", "case 7:\ngen_helper_usad8(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "if (rs != 15) {", "tmp2 = load_reg(VAR_0, rs);", "tcg_gen_add_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "break;", "}", "store_reg(VAR_0, rd, tmp);", "break;", "case 6: case 7:\nVAR_2 = ((VAR_1 >> 4) & 0xf) | ((VAR_1 >> 16) & 0x70);", "tmp = load_reg(VAR_0, rn);", "tmp2 = load_reg(VAR_0, rm);", "if ((VAR_2 & 0x50) == 0x10) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DIV)) {", "goto illegal_op;", "}", "if (VAR_2 & 0x20)\ngen_helper_udiv(tmp, tmp, tmp2);", "else\ngen_helper_sdiv(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "store_reg(VAR_0, rd, tmp);", "} else if ((VAR_2 & 0xe) == 0xc) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "goto illegal_op;", "}", "if (VAR_2 & 1)\ngen_swap_half(tmp2);", "gen_smul_dual(tmp, tmp2);", "if (VAR_2 & 0x10) {", "tcg_gen_sub_i32(tmp, tmp, tmp2);", "} else {", "tcg_gen_add_i32(tmp, tmp, tmp2);", "}", "tcg_temp_free_i32(tmp2);", "tmp64 = tcg_temp_new_i64();", "tcg_gen_ext_i32_i64(tmp64, tmp);", "tcg_temp_free_i32(tmp);", "gen_addq(VAR_0, tmp64, rs, rd);", "gen_storeq_reg(VAR_0, rs, rd, tmp64);", "tcg_temp_free_i64(tmp64);", "} else {", "if (VAR_2 & 0x20) {", "tmp64 = gen_mulu_i64_i32(tmp, tmp2);", "} else {", "if (VAR_2 & 8) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp);", "goto illegal_op;", "}", "gen_mulxy(tmp, tmp2, VAR_2 & 2, VAR_2 & 1);", "tcg_temp_free_i32(tmp2);", "tmp64 = tcg_temp_new_i64();", "tcg_gen_ext_i32_i64(tmp64, tmp);", "tcg_temp_free_i32(tmp);", "} else {", "tmp64 = gen_muls_i64_i32(tmp, tmp2);", "}", "}", "if (VAR_2 & 4) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "tcg_temp_free_i64(tmp64);", "goto illegal_op;", "}", "gen_addq_lo(VAR_0, tmp64, rs);", "gen_addq_lo(VAR_0, tmp64, rd);", "} else if (VAR_2 & 0x40) {", "gen_addq(VAR_0, tmp64, rs, rd);", "}", "gen_storeq_reg(VAR_0, rs, rd, tmp64);", "tcg_temp_free_i64(tmp64);", "}", "break;", "}", "break;", "case 6: case 7: case 14: case 15:\nif (arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "gen_exception_insn(VAR_0, 4, EXCP_NOCP, syn_uncategorized(),\ndefault_exception_el(VAR_0));", "break;", "}", "if (((VAR_1 >> 24) & 3) == 3) {", "VAR_1 = (VAR_1 & 0xe2ffffff) | ((VAR_1 & (1 << 28)) >> 4) | (1 << 28);", "if (disas_neon_data_insn(VAR_0, VAR_1)) {", "goto illegal_op;", "}", "} else if (((VAR_1 >> 8) & 0xe) == 10) {", "if (disas_vfp_insn(VAR_0, VAR_1)) {", "goto illegal_op;", "}", "} else {", "if (VAR_1 & (1 << 28))\ngoto illegal_op;", "if (disas_coproc_insn(VAR_0, VAR_1)) {", "goto illegal_op;", "}", "}", "break;", "case 8: case 9: case 10: case 11:\nif (VAR_1 & (1 << 15)) {", "if (VAR_1 & 0x5000) {", "offset = ((int32_t)VAR_1 << 5) >> 9 & ~(int32_t)0xfff;", "offset |= (VAR_1 & 0x7ff) << 1;", "offset ^= ((~VAR_1) & (1 << 13)) << 10;", "offset ^= ((~VAR_1) & (1 << 11)) << 11;", "if (VAR_1 & (1 << 14)) {", "tcg_gen_movi_i32(cpu_R[14], VAR_0->pc | 1);", "}", "offset += VAR_0->pc;", "if (VAR_1 & (1 << 12)) {", "gen_jmp(VAR_0, offset);", "} else {", "offset &= ~(uint32_t)2;", "gen_bx_im(VAR_0, offset);", "}", "} else if (((VAR_1 >> 23) & 7) == 7) {", "if (VAR_1 & (1 << 13))\ngoto illegal_op;", "if (VAR_1 & (1 << 26)) {", "if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "goto illegal_op;", "}", "if (!(VAR_1 & (1 << 20))) {", "int VAR_9 = extract32(VAR_1, 16, 4) << 12\n| extract32(VAR_1, 0, 12);", "ARCH(7);", "if (IS_USER(VAR_0)) {", "goto illegal_op;", "}", "gen_hvc(VAR_0, VAR_9);", "} else {", "ARCH(6K);", "if (IS_USER(VAR_0)) {", "goto illegal_op;", "}", "gen_smc(VAR_0);", "}", "} else {", "VAR_2 = (VAR_1 >> 20) & 7;", "switch (VAR_2) {", "case 0:\nif (arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "tmp = load_reg(VAR_0, rn);", "addr = tcg_const_i32(VAR_1 & 0xfff);", "gen_helper_v7m_msr(cpu_env, addr, tmp);", "tcg_temp_free_i32(addr);", "tcg_temp_free_i32(tmp);", "gen_lookup_tb(VAR_0);", "break;", "}", "case 1:\nif (arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "goto illegal_op;", "}", "if (extract32(VAR_1, 5, 1)) {", "int VAR_12 = extract32(VAR_1, 8, 4) |\n(extract32(VAR_1, 4, 1) << 4);", "int VAR_11 = VAR_2 & 1;", "gen_msr_banked(VAR_0, VAR_11, VAR_12, rm);", "break;", "}", "tmp = load_reg(VAR_0, rn);", "if (gen_set_psr(VAR_0,\nmsr_mask(VAR_0, (VAR_1 >> 8) & 0xf, VAR_2 == 1),\nVAR_2 == 1, tmp))\ngoto illegal_op;", "break;", "case 2:\nif (((VAR_1 >> 8) & 7) == 0) {", "gen_nop_hint(VAR_0, VAR_1 & 0xff);", "}", "if (IS_USER(VAR_0))\nbreak;", "offset = 0;", "imm = 0;", "if (VAR_1 & (1 << 10)) {", "if (VAR_1 & (1 << 7))\noffset |= CPSR_A;", "if (VAR_1 & (1 << 6))\noffset |= CPSR_I;", "if (VAR_1 & (1 << 5))\noffset |= CPSR_F;", "if (VAR_1 & (1 << 9))\nimm = CPSR_A | CPSR_I | CPSR_F;", "}", "if (VAR_1 & (1 << 8)) {", "offset |= 0x1f;", "imm |= (VAR_1 & 0x1f);", "}", "if (offset) {", "gen_set_psr_im(VAR_0, offset, 0, imm);", "}", "break;", "case 3:\nARCH(7);", "VAR_2 = (VAR_1 >> 4) & 0xf;", "switch (VAR_2) {", "case 2:\ngen_clrex(VAR_0);", "break;", "case 4:\ncase 5:\ntcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);", "break;", "case 6:\ngen_goto_tb(VAR_0, 0, VAR_0->pc & ~1);", "break;", "default:\ngoto illegal_op;", "}", "break;", "case 4:\nif (arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "goto illegal_op;", "}", "tmp = load_reg(VAR_0, rn);", "gen_bx(VAR_0, tmp);", "break;", "case 5:\nif (IS_USER(VAR_0)) {", "goto illegal_op;", "}", "if (rn != 14 || rd != 15) {", "goto illegal_op;", "}", "tmp = load_reg(VAR_0, rn);", "tcg_gen_subi_i32(tmp, tmp, VAR_1 & 0xff);", "gen_exception_return(VAR_0, tmp);", "break;", "case 6:\nif (extract32(VAR_1, 5, 1) &&\n!arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "int VAR_12 = extract32(VAR_1, 16, 4) |\n(extract32(VAR_1, 4, 1) << 4);", "gen_mrs_banked(VAR_0, 0, VAR_12, rd);", "break;", "}", "if (extract32(VAR_1, 16, 4) != 0xf) {", "goto illegal_op;", "}", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_M) &&\nextract32(VAR_1, 0, 8) != 0) {", "goto illegal_op;", "}", "tmp = tcg_temp_new_i32();", "if (arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "addr = tcg_const_i32(VAR_1 & 0xff);", "gen_helper_v7m_mrs(tmp, cpu_env, addr);", "tcg_temp_free_i32(addr);", "} else {", "gen_helper_cpsr_read(tmp, cpu_env);", "}", "store_reg(VAR_0, rd, tmp);", "break;", "case 7:\nif (extract32(VAR_1, 5, 1) &&\n!arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "int VAR_12 = extract32(VAR_1, 16, 4) |\n(extract32(VAR_1, 4, 1) << 4);", "gen_mrs_banked(VAR_0, 1, VAR_12, rd);", "break;", "}", "if (IS_USER(VAR_0) || arm_dc_feature(VAR_0, ARM_FEATURE_M)) {", "goto illegal_op;", "}", "if (extract32(VAR_1, 16, 4) != 0xf ||\nextract32(VAR_1, 0, 8) != 0) {", "goto illegal_op;", "}", "tmp = load_cpu_field(spsr);", "store_reg(VAR_0, rd, tmp);", "break;", "}", "}", "} else {", "VAR_2 = (VAR_1 >> 22) & 0xf;", "VAR_0->condlabel = gen_new_label();", "arm_gen_test_cc(VAR_2 ^ 1, VAR_0->condlabel);", "VAR_0->condjmp = 1;", "offset = (VAR_1 & 0x7ff) << 1;", "offset |= (VAR_1 & 0x003f0000) >> 4;", "offset |= ((int32_t)((VAR_1 << 5) & 0x80000000)) >> 11;", "offset |= (VAR_1 & (1 << 13)) << 5;", "offset |= (VAR_1 & (1 << 11)) << 8;", "gen_jmp(VAR_0, VAR_0->pc + offset);", "}", "} else {", "if (VAR_1 & (1 << 25)) {", "if (VAR_1 & (1 << 24)) {", "if (VAR_1 & (1 << 20))\ngoto illegal_op;", "VAR_2 = (VAR_1 >> 21) & 7;", "imm = VAR_1 & 0x1f;", "shift = ((VAR_1 >> 6) & 3) | ((VAR_1 >> 10) & 0x1c);", "if (rn == 15) {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "} else {", "tmp = load_reg(VAR_0, rn);", "}", "switch (VAR_2) {", "case 2:\nimm++;", "if (shift + imm > 32)\ngoto illegal_op;", "if (imm < 32) {", "tcg_gen_sextract_i32(tmp, tmp, shift, imm);", "}", "break;", "case 6:\nimm++;", "if (shift + imm > 32)\ngoto illegal_op;", "if (imm < 32) {", "tcg_gen_extract_i32(tmp, tmp, shift, imm);", "}", "break;", "case 3:\nif (imm < shift)\ngoto illegal_op;", "imm = imm + 1 - shift;", "if (imm != 32) {", "tmp2 = load_reg(VAR_0, rd);", "tcg_gen_deposit_i32(tmp, tmp2, tmp, shift, imm);", "tcg_temp_free_i32(tmp2);", "}", "break;", "case 7:\ngoto illegal_op;", "default:\nif (shift) {", "if (VAR_2 & 1)\ntcg_gen_sari_i32(tmp, tmp, shift);", "else\ntcg_gen_shli_i32(tmp, tmp, shift);", "}", "tmp2 = tcg_const_i32(imm);", "if (VAR_2 & 4) {", "if ((VAR_2 & 1) && shift == 0) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "goto illegal_op;", "}", "gen_helper_usat16(tmp, cpu_env, tmp, tmp2);", "} else {", "gen_helper_usat(tmp, cpu_env, tmp, tmp2);", "}", "} else {", "if ((VAR_2 & 1) && shift == 0) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_THUMB_DSP)) {", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "goto illegal_op;", "}", "gen_helper_ssat16(tmp, cpu_env, tmp, tmp2);", "} else {", "gen_helper_ssat(tmp, cpu_env, tmp, tmp2);", "}", "}", "tcg_temp_free_i32(tmp2);", "break;", "}", "store_reg(VAR_0, rd, tmp);", "} else {", "imm = ((VAR_1 & 0x04000000) >> 15)\n| ((VAR_1 & 0x7000) >> 4) | (VAR_1 & 0xff);", "if (VAR_1 & (1 << 22)) {", "imm |= (VAR_1 >> 4) & 0xf000;", "if (VAR_1 & (1 << 23)) {", "tmp = load_reg(VAR_0, rd);", "tcg_gen_ext16u_i32(tmp, tmp);", "tcg_gen_ori_i32(tmp, tmp, imm << 16);", "} else {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, imm);", "}", "} else {", "if (rn == 15) {", "offset = VAR_0->pc & ~(uint32_t)3;", "if (VAR_1 & (1 << 23))\noffset -= imm;", "else\noffset += imm;", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, offset);", "} else {", "tmp = load_reg(VAR_0, rn);", "if (VAR_1 & (1 << 23))\ntcg_gen_subi_i32(tmp, tmp, imm);", "else\ntcg_gen_addi_i32(tmp, tmp, imm);", "}", "}", "store_reg(VAR_0, rd, tmp);", "}", "} else {", "int VAR_12 = 0;", "shift = ((VAR_1 & 0x04000000) >> 23) | ((VAR_1 & 0x7000) >> 12);", "imm = (VAR_1 & 0xff);", "switch (shift) {", "case 0:\nbreak;", "case 1:\nimm |= imm << 16;", "break;", "case 2:\nimm |= imm << 16;", "imm <<= 8;", "break;", "case 3:\nimm |= imm << 16;", "imm |= imm << 8;", "break;", "default:\nshift = (shift << 1) | (imm >> 7);", "imm |= 0x80;", "imm = imm << (32 - shift);", "VAR_12 = 1;", "break;", "}", "tmp2 = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp2, imm);", "rn = (VAR_1 >> 16) & 0xf;", "if (rn == 15) {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "} else {", "tmp = load_reg(VAR_0, rn);", "}", "VAR_2 = (VAR_1 >> 21) & 0xf;", "if (gen_thumb2_data_op(VAR_0, VAR_2, (VAR_1 & (1 << 20)) != 0,\nVAR_12, tmp, tmp2))\ngoto illegal_op;", "tcg_temp_free_i32(tmp2);", "rd = (VAR_1 >> 8) & 0xf;", "if (rd != 15) {", "store_reg(VAR_0, rd, tmp);", "} else {", "tcg_temp_free_i32(tmp);", "}", "}", "}", "break;", "case 12:\n{", "int VAR_13 = 0;", "int VAR_14 = 0;", "int VAR_15;", "ISSInfo issinfo;", "if ((VAR_1 & 0x01100000) == 0x01000000) {", "if (disas_neon_ls_insn(VAR_0, VAR_1)) {", "goto illegal_op;", "}", "break;", "}", "VAR_2 = ((VAR_1 >> 21) & 3) | ((VAR_1 >> 22) & 4);", "if (rs == 15) {", "if (!(VAR_1 & (1 << 20))) {", "goto illegal_op;", "}", "if (VAR_2 != 2) {", "int VAR_16 = (VAR_1 >> 23) & 3;", "int VAR_17 = (VAR_1 >> 6) & 0x3f;", "if (VAR_2 & 2) {", "goto illegal_op;", "}", "if (rn == 15) {", "return 0;", "}", "if (VAR_16 & 1) {", "return 0;", "}", "if ((VAR_17 == 0) || ((VAR_17 & 0x3c) == 0x30)) {", "return 0;", "}", "return 1;", "}", "}", "VAR_15 = get_mem_index(VAR_0);", "if (rn == 15) {", "addr = tcg_temp_new_i32();", "imm = VAR_0->pc & 0xfffffffc;", "if (VAR_1 & (1 << 23))\nimm += VAR_1 & 0xfff;", "else\nimm -= VAR_1 & 0xfff;", "tcg_gen_movi_i32(addr, imm);", "} else {", "addr = load_reg(VAR_0, rn);", "if (VAR_1 & (1 << 23)) {", "imm = VAR_1 & 0xfff;", "tcg_gen_addi_i32(addr, addr, imm);", "} else {", "imm = VAR_1 & 0xff;", "switch ((VAR_1 >> 8) & 0xf) {", "case 0x0:\nshift = (VAR_1 >> 4) & 0xf;", "if (shift > 3) {", "tcg_temp_free_i32(addr);", "goto illegal_op;", "}", "tmp = load_reg(VAR_0, rm);", "if (shift)\ntcg_gen_shli_i32(tmp, tmp, shift);", "tcg_gen_add_i32(addr, addr, tmp);", "tcg_temp_free_i32(tmp);", "break;", "case 0xc:\ntcg_gen_addi_i32(addr, addr, -imm);", "break;", "case 0xe:\ntcg_gen_addi_i32(addr, addr, imm);", "VAR_15 = get_a32_user_mem_index(VAR_0);", "break;", "case 0x9:\nimm = -imm;", "case 0xb:\nVAR_13 = 1;", "VAR_14 = 1;", "break;", "case 0xd:\nimm = -imm;", "case 0xf:\ntcg_gen_addi_i32(addr, addr, imm);", "VAR_14 = 1;", "break;", "default:\ntcg_temp_free_i32(addr);", "goto illegal_op;", "}", "}", "}", "issinfo = VAR_14 ? ISSInvalid : rs;", "if (VAR_1 & (1 << 20)) {", "tmp = tcg_temp_new_i32();", "switch (VAR_2) {", "case 0:\ngen_aa32_ld8u_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "case 4:\ngen_aa32_ld8s_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "case 1:\ngen_aa32_ld16u_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "case 5:\ngen_aa32_ld16s_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "case 2:\ngen_aa32_ld32u_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "default:\ntcg_temp_free_i32(tmp);", "tcg_temp_free_i32(addr);", "goto illegal_op;", "}", "if (rs == 15) {", "gen_bx_excret(VAR_0, tmp);", "} else {", "store_reg(VAR_0, rs, tmp);", "}", "} else {", "tmp = load_reg(VAR_0, rs);", "switch (VAR_2) {", "case 0:\ngen_aa32_st8_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "case 1:\ngen_aa32_st16_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "case 2:\ngen_aa32_st32_iss(VAR_0, tmp, addr, VAR_15, issinfo);", "break;", "default:\ntcg_temp_free_i32(tmp);", "tcg_temp_free_i32(addr);", "goto illegal_op;", "}", "tcg_temp_free_i32(tmp);", "}", "if (VAR_13)\ntcg_gen_addi_i32(addr, addr, imm);", "if (VAR_14) {", "store_reg(VAR_0, rn, addr);", "} else {", "tcg_temp_free_i32(addr);", "}", "}", "break;", "default:\ngoto illegal_op;", "}", "return 0;", "illegal_op:\nreturn 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 57 ], [ 59, 61 ], [ 71, 73 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307 ], [ 309, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323, 327 ], [ 329 ], [ 331 ], [ 335, 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359, 361 ], [ 363 ], [ 365, 367, 369 ], [ 371 ], [ 373, 375, 377 ], [ 379 ], [ 381, 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395, 397, 399 ], [ 401 ], [ 403, 405, 407 ], [ 409 ], [ 411, 413, 415 ], [ 417 ], [ 419, 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 447 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 461 ], [ 463, 465 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 507, 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 521 ], [ 523 ], [ 525 ], [ 527, 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 541 ], [ 543 ], [ 545, 547 ], [ 549 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 599 ], [ 601 ], [ 603 ], [ 607, 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625, 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 651, 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 665, 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711, 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727 ], [ 729 ], [ 731, 733 ], [ 735, 737 ], [ 739 ], [ 741, 743 ], [ 745 ], [ 747, 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757, 759 ], [ 761 ], [ 763 ], [ 765, 767 ], [ 769 ], [ 771, 773, 775, 777, 779 ], [ 781, 783, 785 ], [ 787 ], [ 789 ], [ 791 ], [ 793, 795 ], [ 797 ], [ 799 ], [ 801 ], [ 803 ], [ 805 ], [ 807 ], [ 809 ], [ 811 ], [ 817, 819 ], [ 821 ], [ 823 ], [ 825 ], [ 827 ], [ 829 ], [ 831 ], [ 833 ], [ 835 ], [ 837, 839 ], [ 841 ], [ 843 ], [ 845 ], [ 847 ], [ 849 ], [ 851 ], [ 853 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 863 ], [ 865, 867 ], [ 869 ], [ 871 ], [ 873 ], [ 875 ], [ 877, 879 ], [ 881 ], [ 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893, 895 ], [ 897 ], [ 901 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 911, 913 ], [ 915, 917 ], [ 919, 921 ], [ 923 ], [ 925 ], [ 927 ], [ 929, 931, 933, 935, 937, 939 ], [ 941, 943 ], [ 945 ], [ 947 ], [ 949 ], [ 951, 953, 955, 957, 959, 961, 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971, 973 ], [ 975 ], [ 977 ], [ 979 ], [ 981, 983 ], [ 985 ], [ 987, 989 ], [ 991 ], [ 993, 995 ], [ 997 ], [ 999, 1001 ], [ 1003 ], [ 1005, 1007 ], [ 1009 ], [ 1011 ], [ 1013 ], [ 1015 ], [ 1017 ], [ 1019 ], [ 1021, 1023 ], [ 1025 ], [ 1027, 1029, 1031, 1033, 1035, 1037, 1039 ], [ 1043 ], [ 1045 ], [ 1049 ], [ 1051 ], [ 1053 ], [ 1055 ], [ 1057 ], [ 1059 ], [ 1061 ], [ 1063 ], [ 1065 ], [ 1067 ], [ 1069 ], [ 1071 ], [ 1073 ], [ 1075 ], [ 1077 ], [ 1079 ], [ 1081, 1083 ], [ 1085 ], [ 1087 ], [ 1089 ], [ 1091 ], [ 1093, 1095 ], [ 1097, 1099, 1101 ], [ 1103, 1105, 1107, 1109, 1111, 1113 ], [ 1115 ], [ 1117 ], [ 1119 ], [ 1121 ], [ 1123 ], [ 1125 ], [ 1127 ], [ 1129 ], [ 1131, 1133 ], [ 1135 ], [ 1137 ], [ 1139 ], [ 1141, 1143 ], [ 1145, 1147 ], [ 1149 ], [ 1151 ], [ 1153 ], [ 1155, 1157 ], [ 1159 ], [ 1161 ], [ 1163 ], [ 1165 ], [ 1167 ], [ 1169 ], [ 1171 ], [ 1173, 1175, 1177, 1179 ], [ 1181 ], [ 1183 ], [ 1187 ], [ 1189 ], [ 1199 ], [ 1201 ], [ 1203 ], [ 1205, 1207 ], [ 1209 ], [ 1211 ], [ 1213 ], [ 1215 ], [ 1217 ], [ 1219, 1221, 1223 ], [ 1225, 1227 ], [ 1229 ], [ 1231 ], [ 1233 ], [ 1235 ], [ 1237 ], [ 1239, 1241 ], [ 1243 ], [ 1245 ], [ 1247 ], [ 1249 ], [ 1251 ], [ 1253, 1255 ], [ 1257 ], [ 1259 ], [ 1261 ], [ 1263 ], [ 1265 ], [ 1267 ], [ 1269 ], [ 1271 ], [ 1273 ], [ 1275 ], [ 1277 ], [ 1279 ], [ 1281 ], [ 1283 ], [ 1285 ], [ 1287 ], [ 1289, 1291 ], [ 1293 ], [ 1295 ], [ 1297 ], [ 1299 ], [ 1301 ], [ 1303 ], [ 1305 ], [ 1307 ], [ 1309 ], [ 1311 ], [ 1313, 1315 ], [ 1317 ], [ 1319 ], [ 1321 ], [ 1325 ], [ 1327 ], [ 1329 ], [ 1331, 1333 ], [ 1335, 1337 ], [ 1339 ], [ 1341 ], [ 1343 ], [ 1347 ], [ 1349 ], [ 1351 ], [ 1353 ], [ 1355 ], [ 1357, 1359 ], [ 1361 ], [ 1363 ], [ 1365 ], [ 1367 ], [ 1369 ], [ 1371 ], [ 1373 ], [ 1377 ], [ 1379 ], [ 1381 ], [ 1383 ], [ 1385 ], [ 1387 ], [ 1389 ], [ 1391 ], [ 1395 ], [ 1397 ], [ 1399 ], [ 1403 ], [ 1405 ], [ 1407 ], [ 1409 ], [ 1411 ], [ 1413 ], [ 1415 ], [ 1417 ], [ 1419 ], [ 1421 ], [ 1423 ], [ 1427 ], [ 1429 ], [ 1431 ], [ 1433 ], [ 1437 ], [ 1439 ], [ 1441 ], [ 1443 ], [ 1445 ], [ 1447 ], [ 1449 ], [ 1453 ], [ 1455 ], [ 1457 ], [ 1459 ], [ 1461 ], [ 1463 ], [ 1465 ], [ 1467 ], [ 1469, 1473 ], [ 1481, 1483 ], [ 1485 ], [ 1487 ], [ 1489 ], [ 1493 ], [ 1495 ], [ 1497 ], [ 1499 ], [ 1501 ], [ 1503 ], [ 1505 ], [ 1507 ], [ 1509 ], [ 1511, 1513 ], [ 1515 ], [ 1517 ], [ 1519 ], [ 1521 ], [ 1523 ], [ 1525, 1527 ], [ 1531 ], [ 1537 ], [ 1541 ], [ 1549 ], [ 1551 ], [ 1555 ], [ 1559 ], [ 1561 ], [ 1565 ], [ 1567 ], [ 1571 ], [ 1573 ], [ 1577 ], [ 1581 ], [ 1583 ], [ 1585 ], [ 1589, 1591 ], [ 1595 ], [ 1597 ], [ 1599 ], [ 1601 ], [ 1603 ], [ 1607, 1609 ], [ 1611 ], [ 1613 ], [ 1615 ], [ 1617 ], [ 1619 ], [ 1621 ], [ 1625 ], [ 1627 ], [ 1629 ], [ 1631 ], [ 1633 ], [ 1635 ], [ 1637 ], [ 1639 ], [ 1641 ], [ 1643, 1645 ], [ 1647 ], [ 1651 ], [ 1653 ], [ 1655 ], [ 1657 ], [ 1659 ], [ 1661 ], [ 1663 ], [ 1667, 1669 ], [ 1671 ], [ 1673 ], [ 1677 ], [ 1681, 1683 ], [ 1685 ], [ 1689 ], [ 1691 ], [ 1693 ], [ 1699 ], [ 1701, 1703, 1705, 1707 ], [ 1709 ], [ 1711, 1713 ], [ 1715 ], [ 1717 ], [ 1721, 1723 ], [ 1725 ], [ 1727 ], [ 1729 ], [ 1731, 1733 ], [ 1735, 1737 ], [ 1739, 1741 ], [ 1743, 1745 ], [ 1747 ], [ 1749 ], [ 1751 ], [ 1753 ], [ 1755 ], [ 1757 ], [ 1759 ], [ 1761 ], [ 1763 ], [ 1765, 1767 ], [ 1769 ], [ 1771 ], [ 1773, 1775 ], [ 1777 ], [ 1779, 1781, 1783 ], [ 1785 ], [ 1787, 1799 ], [ 1801 ], [ 1803, 1805 ], [ 1807 ], [ 1809 ], [ 1811, 1819 ], [ 1821 ], [ 1823 ], [ 1825 ], [ 1827 ], [ 1829 ], [ 1831, 1833 ], [ 1835 ], [ 1837 ], [ 1839 ], [ 1841 ], [ 1843 ], [ 1845 ], [ 1847 ], [ 1849 ], [ 1851 ], [ 1853, 1855, 1857 ], [ 1861, 1863 ], [ 1867 ], [ 1869 ], [ 1871 ], [ 1875 ], [ 1877 ], [ 1879 ], [ 1881, 1883 ], [ 1885 ], [ 1887 ], [ 1893 ], [ 1895 ], [ 1897 ], [ 1899 ], [ 1901 ], [ 1903 ], [ 1905 ], [ 1907 ], [ 1909 ], [ 1911 ], [ 1913, 1915, 1917 ], [ 1921, 1923 ], [ 1927 ], [ 1929 ], [ 1931 ], [ 1939 ], [ 1941 ], [ 1943 ], [ 1947, 1949 ], [ 1951 ], [ 1953 ], [ 1957 ], [ 1959 ], [ 1961 ], [ 1963 ], [ 1965 ], [ 1967 ], [ 1971 ], [ 1975 ], [ 1977 ], [ 1979 ], [ 1985 ], [ 1989 ], [ 1993 ], [ 1997 ], [ 2001 ], [ 2007 ], [ 2009 ], [ 2011 ], [ 2015 ], [ 2017 ], [ 2019, 2021 ], [ 2025 ], [ 2027 ], [ 2029 ], [ 2031 ], [ 2033 ], [ 2035 ], [ 2037 ], [ 2039 ], [ 2041 ], [ 2043 ], [ 2045, 2047 ], [ 2049, 2051 ], [ 2053 ], [ 2055 ], [ 2057 ], [ 2059 ], [ 2061, 2063 ], [ 2065, 2067 ], [ 2069 ], [ 2071 ], [ 2073 ], [ 2075 ], [ 2077, 2079, 2081 ], [ 2083 ], [ 2085 ], [ 2087 ], [ 2089 ], [ 2091 ], [ 2093 ], [ 2095 ], [ 2097, 2099 ], [ 2101, 2103 ], [ 2105, 2107 ], [ 2109, 2111 ], [ 2113 ], [ 2115 ], [ 2117 ], [ 2121 ], [ 2123 ], [ 2125 ], [ 2127 ], [ 2129 ], [ 2131 ], [ 2133 ], [ 2135 ], [ 2137 ], [ 2139 ], [ 2141 ], [ 2145 ], [ 2147 ], [ 2149 ], [ 2151 ], [ 2153 ], [ 2155 ], [ 2157 ], [ 2159 ], [ 2161 ], [ 2163 ], [ 2165 ], [ 2167 ], [ 2169 ], [ 2171 ], [ 2173 ], [ 2175 ], [ 2177, 2179 ], [ 2181 ], [ 2185 ], [ 2187 ], [ 2191 ], [ 2193 ], [ 2195 ], [ 2197 ], [ 2201 ], [ 2203 ], [ 2205 ], [ 2207 ], [ 2211 ], [ 2213 ], [ 2215, 2217 ], [ 2219, 2221 ], [ 2223 ], [ 2225 ], [ 2227 ], [ 2229 ], [ 2231, 2233 ], [ 2235, 2237 ], [ 2239 ], [ 2241 ], [ 2243 ], [ 2245 ], [ 2247 ], [ 2249 ], [ 2253 ], [ 2255 ], [ 2257 ], [ 2259, 2263 ], [ 2265, 2267 ], [ 2269 ], [ 2271, 2273 ], [ 2275 ], [ 2277 ], [ 2279, 2281 ], [ 2283 ], [ 2285 ], [ 2287, 2289 ], [ 2291 ], [ 2293 ], [ 2295 ], [ 2297 ], [ 2299 ], [ 2301 ], [ 2303 ], [ 2305 ], [ 2307 ], [ 2309 ], [ 2311 ], [ 2313 ], [ 2315 ], [ 2317 ], [ 2319 ], [ 2321, 2323, 2325 ], [ 2327 ], [ 2329 ], [ 2331 ], [ 2333 ], [ 2335 ], [ 2337 ], [ 2339 ], [ 2341 ], [ 2343 ], [ 2345 ], [ 2347, 2349 ], [ 2351 ], [ 2353 ], [ 2355 ], [ 2357 ], [ 2361 ], [ 2363 ], [ 2365 ], [ 2367 ], [ 2369 ], [ 2371 ], [ 2373 ], [ 2375 ], [ 2377 ], [ 2379 ], [ 2381 ], [ 2383 ], [ 2407 ], [ 2409 ], [ 2411 ], [ 2413 ], [ 2415 ], [ 2417 ], [ 2425 ], [ 2427 ], [ 2429 ], [ 2431 ], [ 2433 ], [ 2435 ], [ 2437 ], [ 2439 ], [ 2443 ], [ 2445 ], [ 2447 ], [ 2449 ], [ 2451 ], [ 2453 ], [ 2459 ], [ 2461, 2463 ], [ 2465, 2467 ], [ 2469 ], [ 2471 ], [ 2473 ], [ 2475 ], [ 2479 ], [ 2481 ], [ 2483 ], [ 2485 ], [ 2487 ], [ 2489, 2491 ], [ 2493 ], [ 2495 ], [ 2497 ], [ 2499 ], [ 2501 ], [ 2503, 2505 ], [ 2507 ], [ 2509 ], [ 2511 ], [ 2513, 2515 ], [ 2517 ], [ 2519, 2521 ], [ 2523 ], [ 2525 ], [ 2527, 2529 ], [ 2533, 2535 ], [ 2537 ], [ 2539 ], [ 2541, 2543 ], [ 2547, 2549 ], [ 2551 ], [ 2553 ], [ 2555, 2557 ], [ 2559 ], [ 2561 ], [ 2563 ], [ 2565 ], [ 2569 ], [ 2573 ], [ 2577 ], [ 2579 ], [ 2581, 2583 ], [ 2585 ], [ 2587, 2589 ], [ 2591 ], [ 2593, 2595 ], [ 2597 ], [ 2599, 2601 ], [ 2603 ], [ 2605, 2607 ], [ 2609 ], [ 2611, 2613 ], [ 2615 ], [ 2617 ], [ 2619 ], [ 2621 ], [ 2623 ], [ 2625 ], [ 2627 ], [ 2629 ], [ 2631 ], [ 2635 ], [ 2637 ], [ 2639, 2641 ], [ 2643 ], [ 2645, 2647 ], [ 2649 ], [ 2651, 2653 ], [ 2655 ], [ 2657, 2659 ], [ 2661 ], [ 2663 ], [ 2665 ], [ 2667 ], [ 2669 ], [ 2671, 2673 ], [ 2675 ], [ 2677 ], [ 2679 ], [ 2681 ], [ 2683 ], [ 2685 ], [ 2687 ], [ 2689, 2691 ], [ 2693 ], [ 2695 ], [ 2697, 2699 ], [ 2701 ] ]
9,750
static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) { uint32_t associativity[] = {cpu_to_be32(0x4), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0)}; char mem_name[32]; hwaddr node0_size, mem_start; uint64_t mem_reg_property[2]; int i, off; /* memory node(s) */ node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size; /* RMA */ mem_reg_property[0] = 0; mem_reg_property[1] = cpu_to_be64(spapr->rma_size); off = fdt_add_subnode(fdt, 0, "memory@0"); _FDT(off); _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, sizeof(associativity)))); /* RAM: Node 0 */ if (node0_size > spapr->rma_size) { mem_reg_property[0] = cpu_to_be64(spapr->rma_size); mem_reg_property[1] = cpu_to_be64(node0_size - spapr->rma_size); sprintf(mem_name, "memory@" TARGET_FMT_lx, spapr->rma_size); off = fdt_add_subnode(fdt, 0, mem_name); _FDT(off); _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, sizeof(associativity)))); } /* RAM: Node 1 and beyond */ mem_start = node0_size; for (i = 1; i < nb_numa_nodes; i++) { mem_reg_property[0] = cpu_to_be64(mem_start); mem_reg_property[1] = cpu_to_be64(node_mem[i]); associativity[3] = associativity[4] = cpu_to_be32(i); sprintf(mem_name, "memory@" TARGET_FMT_lx, mem_start); off = fdt_add_subnode(fdt, 0, mem_name); _FDT(off); _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, sizeof(associativity)))); mem_start += node_mem[i]; } return 0; }
false
qemu
5fe269b16c6dc8f19da3e8c13d4c66958b00d2f0
static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) { uint32_t associativity[] = {cpu_to_be32(0x4), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0)}; char mem_name[32]; hwaddr node0_size, mem_start; uint64_t mem_reg_property[2]; int i, off; node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size; mem_reg_property[0] = 0; mem_reg_property[1] = cpu_to_be64(spapr->rma_size); off = fdt_add_subnode(fdt, 0, "memory@0"); _FDT(off); _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, sizeof(associativity)))); if (node0_size > spapr->rma_size) { mem_reg_property[0] = cpu_to_be64(spapr->rma_size); mem_reg_property[1] = cpu_to_be64(node0_size - spapr->rma_size); sprintf(mem_name, "memory@" TARGET_FMT_lx, spapr->rma_size); off = fdt_add_subnode(fdt, 0, mem_name); _FDT(off); _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, sizeof(associativity)))); } mem_start = node0_size; for (i = 1; i < nb_numa_nodes; i++) { mem_reg_property[0] = cpu_to_be64(mem_start); mem_reg_property[1] = cpu_to_be64(node_mem[i]); associativity[3] = associativity[4] = cpu_to_be32(i); sprintf(mem_name, "memory@" TARGET_FMT_lx, mem_start); off = fdt_add_subnode(fdt, 0, mem_name); _FDT(off); _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, sizeof(associativity)))); mem_start += node_mem[i]; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(sPAPREnvironment *VAR_0, void *VAR_1) { uint32_t associativity[] = {cpu_to_be32(0x4), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0)}; char VAR_2[32]; hwaddr node0_size, mem_start; uint64_t mem_reg_property[2]; int VAR_3, VAR_4; node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size; mem_reg_property[0] = 0; mem_reg_property[1] = cpu_to_be64(VAR_0->rma_size); VAR_4 = fdt_add_subnode(VAR_1, 0, "memory@0"); _FDT(VAR_4); _FDT((fdt_setprop_string(VAR_1, VAR_4, "device_type", "memory"))); _FDT((fdt_setprop(VAR_1, VAR_4, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(VAR_1, VAR_4, "ibm,associativity", associativity, sizeof(associativity)))); if (node0_size > VAR_0->rma_size) { mem_reg_property[0] = cpu_to_be64(VAR_0->rma_size); mem_reg_property[1] = cpu_to_be64(node0_size - VAR_0->rma_size); sprintf(VAR_2, "memory@" TARGET_FMT_lx, VAR_0->rma_size); VAR_4 = fdt_add_subnode(VAR_1, 0, VAR_2); _FDT(VAR_4); _FDT((fdt_setprop_string(VAR_1, VAR_4, "device_type", "memory"))); _FDT((fdt_setprop(VAR_1, VAR_4, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(VAR_1, VAR_4, "ibm,associativity", associativity, sizeof(associativity)))); } mem_start = node0_size; for (VAR_3 = 1; VAR_3 < nb_numa_nodes; VAR_3++) { mem_reg_property[0] = cpu_to_be64(mem_start); mem_reg_property[1] = cpu_to_be64(node_mem[VAR_3]); associativity[3] = associativity[4] = cpu_to_be32(VAR_3); sprintf(VAR_2, "memory@" TARGET_FMT_lx, mem_start); VAR_4 = fdt_add_subnode(VAR_1, 0, VAR_2); _FDT(VAR_4); _FDT((fdt_setprop_string(VAR_1, VAR_4, "device_type", "memory"))); _FDT((fdt_setprop(VAR_1, VAR_4, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_setprop(VAR_1, VAR_4, "ibm,associativity", associativity, sizeof(associativity)))); mem_start += node_mem[VAR_3]; } return 0; }
[ "static int FUNC_0(sPAPREnvironment *VAR_0, void *VAR_1)\n{", "uint32_t associativity[] = {cpu_to_be32(0x4), cpu_to_be32(0x0),", "cpu_to_be32(0x0), cpu_to_be32(0x0),\ncpu_to_be32(0x0)};", "char VAR_2[32];", "hwaddr node0_size, mem_start;", "uint64_t mem_reg_property[2];", "int VAR_3, VAR_4;", "node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;", "mem_reg_property[0] = 0;", "mem_reg_property[1] = cpu_to_be64(VAR_0->rma_size);", "VAR_4 = fdt_add_subnode(VAR_1, 0, \"memory@0\");", "_FDT(VAR_4);", "_FDT((fdt_setprop_string(VAR_1, VAR_4, \"device_type\", \"memory\")));", "_FDT((fdt_setprop(VAR_1, VAR_4, \"reg\", mem_reg_property,\nsizeof(mem_reg_property))));", "_FDT((fdt_setprop(VAR_1, VAR_4, \"ibm,associativity\", associativity,\nsizeof(associativity))));", "if (node0_size > VAR_0->rma_size) {", "mem_reg_property[0] = cpu_to_be64(VAR_0->rma_size);", "mem_reg_property[1] = cpu_to_be64(node0_size - VAR_0->rma_size);", "sprintf(VAR_2, \"memory@\" TARGET_FMT_lx, VAR_0->rma_size);", "VAR_4 = fdt_add_subnode(VAR_1, 0, VAR_2);", "_FDT(VAR_4);", "_FDT((fdt_setprop_string(VAR_1, VAR_4, \"device_type\", \"memory\")));", "_FDT((fdt_setprop(VAR_1, VAR_4, \"reg\", mem_reg_property,\nsizeof(mem_reg_property))));", "_FDT((fdt_setprop(VAR_1, VAR_4, \"ibm,associativity\", associativity,\nsizeof(associativity))));", "}", "mem_start = node0_size;", "for (VAR_3 = 1; VAR_3 < nb_numa_nodes; VAR_3++) {", "mem_reg_property[0] = cpu_to_be64(mem_start);", "mem_reg_property[1] = cpu_to_be64(node_mem[VAR_3]);", "associativity[3] = associativity[4] = cpu_to_be32(VAR_3);", "sprintf(VAR_2, \"memory@\" TARGET_FMT_lx, mem_start);", "VAR_4 = fdt_add_subnode(VAR_1, 0, VAR_2);", "_FDT(VAR_4);", "_FDT((fdt_setprop_string(VAR_1, VAR_4, \"device_type\", \"memory\")));", "_FDT((fdt_setprop(VAR_1, VAR_4, \"reg\", mem_reg_property,\nsizeof(mem_reg_property))));", "_FDT((fdt_setprop(VAR_1, VAR_4, \"ibm,associativity\", associativity,\nsizeof(associativity))));", "mem_start += node_mem[VAR_3];", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71, 73 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ] ]
9,751
static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); qemu_file_put_notify(s->file); if (qemu_file_get_error(s->file)) { migrate_fd_error(s); } }
false
qemu
1fdc11c36971e0d4eeb2ce817f7e520b2028c2f2
static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); qemu_file_put_notify(s->file); if (qemu_file_get_error(s->file)) { migrate_fd_error(s); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { MigrationState *s = VAR_0; qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); qemu_file_put_notify(s->file); if (qemu_file_get_error(s->file)) { migrate_fd_error(s); } }
[ "static void FUNC_0(void *VAR_0)\n{", "MigrationState *s = VAR_0;", "qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);", "qemu_file_put_notify(s->file);", "if (qemu_file_get_error(s->file)) {", "migrate_fd_error(s);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
9,752
ParallelState *parallel_init(int index, CharDriverState *chr) { ISADevice *dev; dev = isa_create("isa-parallel"); qdev_prop_set_uint32(&dev->qdev, "index", index); qdev_prop_set_chr(&dev->qdev, "chardev", chr); if (qdev_init(&dev->qdev) < 0) return NULL; return &DO_UPCAST(ISAParallelState, dev, dev)->state; }
false
qemu
defdb20e1a8ac3a7200aaf190d7fb20a5ac8bcea
ParallelState *parallel_init(int index, CharDriverState *chr) { ISADevice *dev; dev = isa_create("isa-parallel"); qdev_prop_set_uint32(&dev->qdev, "index", index); qdev_prop_set_chr(&dev->qdev, "chardev", chr); if (qdev_init(&dev->qdev) < 0) return NULL; return &DO_UPCAST(ISAParallelState, dev, dev)->state; }
{ "code": [], "line_no": [] }
ParallelState *FUNC_0(int index, CharDriverState *chr) { ISADevice *dev; dev = isa_create("isa-parallel"); qdev_prop_set_uint32(&dev->qdev, "index", index); qdev_prop_set_chr(&dev->qdev, "chardev", chr); if (qdev_init(&dev->qdev) < 0) return NULL; return &DO_UPCAST(ISAParallelState, dev, dev)->state; }
[ "ParallelState *FUNC_0(int index, CharDriverState *chr)\n{", "ISADevice *dev;", "dev = isa_create(\"isa-parallel\");", "qdev_prop_set_uint32(&dev->qdev, \"index\", index);", "qdev_prop_set_chr(&dev->qdev, \"chardev\", chr);", "if (qdev_init(&dev->qdev) < 0)\nreturn NULL;", "return &DO_UPCAST(ISAParallelState, dev, dev)->state;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ] ]
9,753
static void main_loop(void) { int r; #ifdef CONFIG_IOTHREAD qemu_system_ready = 1; qemu_cond_broadcast(&qemu_system_cond); #endif for (;;) { do { #ifdef CONFIG_PROFILER int64_t ti; #endif #ifndef CONFIG_IOTHREAD tcg_cpu_exec(); #endif #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif main_loop_wait(qemu_calculate_timeout()); #ifdef CONFIG_PROFILER dev_time += profile_getclock() - ti; #endif } while (vm_can_run()); if (qemu_debug_requested()) { monitor_protocol_event(QEVENT_DEBUG, NULL); vm_stop(EXCP_DEBUG); } if (qemu_shutdown_requested()) { monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(0); no_shutdown = 0; } else break; } if (qemu_reset_requested()) { monitor_protocol_event(QEVENT_RESET, NULL); pause_all_vcpus(); qemu_system_reset(); resume_all_vcpus(); } if (qemu_powerdown_requested()) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown); } if ((r = qemu_vmstop_requested())) { vm_stop(r); } } pause_all_vcpus(); }
false
qemu
0ee442502bc8af7fe1679ccf775e54fcf62dd8ac
static void main_loop(void) { int r; #ifdef CONFIG_IOTHREAD qemu_system_ready = 1; qemu_cond_broadcast(&qemu_system_cond); #endif for (;;) { do { #ifdef CONFIG_PROFILER int64_t ti; #endif #ifndef CONFIG_IOTHREAD tcg_cpu_exec(); #endif #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif main_loop_wait(qemu_calculate_timeout()); #ifdef CONFIG_PROFILER dev_time += profile_getclock() - ti; #endif } while (vm_can_run()); if (qemu_debug_requested()) { monitor_protocol_event(QEVENT_DEBUG, NULL); vm_stop(EXCP_DEBUG); } if (qemu_shutdown_requested()) { monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(0); no_shutdown = 0; } else break; } if (qemu_reset_requested()) { monitor_protocol_event(QEVENT_RESET, NULL); pause_all_vcpus(); qemu_system_reset(); resume_all_vcpus(); } if (qemu_powerdown_requested()) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown); } if ((r = qemu_vmstop_requested())) { vm_stop(r); } } pause_all_vcpus(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { int VAR_0; #ifdef CONFIG_IOTHREAD qemu_system_ready = 1; qemu_cond_broadcast(&qemu_system_cond); #endif for (;;) { do { #ifdef CONFIG_PROFILER int64_t ti; #endif #ifndef CONFIG_IOTHREAD tcg_cpu_exec(); #endif #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif main_loop_wait(qemu_calculate_timeout()); #ifdef CONFIG_PROFILER dev_time += profile_getclock() - ti; #endif } while (vm_can_run()); if (qemu_debug_requested()) { monitor_protocol_event(QEVENT_DEBUG, NULL); vm_stop(EXCP_DEBUG); } if (qemu_shutdown_requested()) { monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(0); no_shutdown = 0; } else break; } if (qemu_reset_requested()) { monitor_protocol_event(QEVENT_RESET, NULL); pause_all_vcpus(); qemu_system_reset(); resume_all_vcpus(); } if (qemu_powerdown_requested()) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown); } if ((VAR_0 = qemu_vmstop_requested())) { vm_stop(VAR_0); } } pause_all_vcpus(); }
[ "static void FUNC_0(void)\n{", "int VAR_0;", "#ifdef CONFIG_IOTHREAD\nqemu_system_ready = 1;", "qemu_cond_broadcast(&qemu_system_cond);", "#endif\nfor (;;) {", "do {", "#ifdef CONFIG_PROFILER\nint64_t ti;", "#endif\n#ifndef CONFIG_IOTHREAD\ntcg_cpu_exec();", "#endif\n#ifdef CONFIG_PROFILER\nti = profile_getclock();", "#endif\nmain_loop_wait(qemu_calculate_timeout());", "#ifdef CONFIG_PROFILER\ndev_time += profile_getclock() - ti;", "#endif\n} while (vm_can_run());", "if (qemu_debug_requested()) {", "monitor_protocol_event(QEVENT_DEBUG, NULL);", "vm_stop(EXCP_DEBUG);", "}", "if (qemu_shutdown_requested()) {", "monitor_protocol_event(QEVENT_SHUTDOWN, NULL);", "if (no_shutdown) {", "vm_stop(0);", "no_shutdown = 0;", "} else", "break;", "}", "if (qemu_reset_requested()) {", "monitor_protocol_event(QEVENT_RESET, NULL);", "pause_all_vcpus();", "qemu_system_reset();", "resume_all_vcpus();", "}", "if (qemu_powerdown_requested()) {", "monitor_protocol_event(QEVENT_POWERDOWN, NULL);", "qemu_irq_raise(qemu_system_powerdown);", "}", "if ((VAR_0 = qemu_vmstop_requested())) {", "vm_stop(VAR_0);", "}", "}", "pause_all_vcpus();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27, 29, 31 ], [ 33, 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 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 ] ]
9,755
static void qpi_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) { }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
static void qpi_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) { }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 5 ] ]
9,757
uint64_t cpu_get_tsc(CPUX86State *env) { /* Note: when using kqemu, it is more logical to return the host TSC because kqemu does not trap the RDTSC instruction for performance reasons */ #ifdef CONFIG_KQEMU if (env->kqemu_enabled) { return cpu_get_real_ticks(); } else #endif { return cpu_get_ticks(); } }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
uint64_t cpu_get_tsc(CPUX86State *env) { #ifdef CONFIG_KQEMU if (env->kqemu_enabled) { return cpu_get_real_ticks(); } else #endif { return cpu_get_ticks(); } }
{ "code": [], "line_no": [] }
uint64_t FUNC_0(CPUX86State *env) { #ifdef CONFIG_KQEMU if (env->kqemu_enabled) { return cpu_get_real_ticks(); } else #endif { return cpu_get_ticks(); } }
[ "uint64_t FUNC_0(CPUX86State *env)\n{", "#ifdef CONFIG_KQEMU\nif (env->kqemu_enabled) {", "return cpu_get_real_ticks();", "} else", "#endif\n{", "return cpu_get_ticks();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ] ]
9,758
void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num) { uint64_t r; switch (num) { case 0x500: /* KVM hypercall */ qemu_mutex_lock_iothread(); r = s390_virtio_hypercall(env); qemu_mutex_unlock_iothread(); break; case 0x44: /* yield */ r = 0; break; case 0x308: /* ipl */ handle_diag_308(env, r1, r3); r = 0; break; default: r = -1; break; } if (r) { program_interrupt(env, PGM_OPERATION, ILEN_LATER_INC); } }
false
qemu
becf8217deb2afc347d5172d9f30c8a8964b8b27
void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num) { uint64_t r; switch (num) { case 0x500: qemu_mutex_lock_iothread(); r = s390_virtio_hypercall(env); qemu_mutex_unlock_iothread(); break; case 0x44: r = 0; break; case 0x308: handle_diag_308(env, r1, r3); r = 0; break; default: r = -1; break; } if (r) { program_interrupt(env, PGM_OPERATION, ILEN_LATER_INC); } }
{ "code": [], "line_no": [] }
void FUNC_0(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num) { uint64_t r; switch (num) { case 0x500: qemu_mutex_lock_iothread(); r = s390_virtio_hypercall(env); qemu_mutex_unlock_iothread(); break; case 0x44: r = 0; break; case 0x308: handle_diag_308(env, r1, r3); r = 0; break; default: r = -1; break; } if (r) { program_interrupt(env, PGM_OPERATION, ILEN_LATER_INC); } }
[ "void FUNC_0(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num)\n{", "uint64_t r;", "switch (num) {", "case 0x500:\nqemu_mutex_lock_iothread();", "r = s390_virtio_hypercall(env);", "qemu_mutex_unlock_iothread();", "break;", "case 0x44:\nr = 0;", "break;", "case 0x308:\nhandle_diag_308(env, r1, r3);", "r = 0;", "break;", "default:\nr = -1;", "break;", "}", "if (r) {", "program_interrupt(env, PGM_OPERATION, ILEN_LATER_INC);", "}", "}" ]
[ 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, 27 ], [ 29 ], [ 31, 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
9,760
static void piix3_write_config(PCIDevice *dev, uint32_t address, uint32_t val, int len) { pci_default_write_config(dev, address, val, len); if (ranges_overlap(address, len, PIIX_PIRQC, 4)) { PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); int pic_irq; pci_bus_fire_intx_routing_notifier(piix3->dev.bus); piix3_update_irq_levels(piix3); for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { piix3_set_irq_pic(piix3, pic_irq); } } }
false
qemu
fd56e0612b6454a282fa6a953fdb09281a98c589
static void piix3_write_config(PCIDevice *dev, uint32_t address, uint32_t val, int len) { pci_default_write_config(dev, address, val, len); if (ranges_overlap(address, len, PIIX_PIRQC, 4)) { PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); int pic_irq; pci_bus_fire_intx_routing_notifier(piix3->dev.bus); piix3_update_irq_levels(piix3); for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { piix3_set_irq_pic(piix3, pic_irq); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIDevice *VAR_0, uint32_t VAR_1, uint32_t VAR_2, int VAR_3) { pci_default_write_config(VAR_0, VAR_1, VAR_2, VAR_3); if (ranges_overlap(VAR_1, VAR_3, PIIX_PIRQC, 4)) { PIIX3State *piix3 = PIIX3_PCI_DEVICE(VAR_0); int VAR_4; pci_bus_fire_intx_routing_notifier(piix3->VAR_0.bus); piix3_update_irq_levels(piix3); for (VAR_4 = 0; VAR_4 < PIIX_NUM_PIC_IRQS; VAR_4++) { piix3_set_irq_pic(piix3, VAR_4); } } }
[ "static void FUNC_0(PCIDevice *VAR_0,\nuint32_t VAR_1, uint32_t VAR_2, int VAR_3)\n{", "pci_default_write_config(VAR_0, VAR_1, VAR_2, VAR_3);", "if (ranges_overlap(VAR_1, VAR_3, PIIX_PIRQC, 4)) {", "PIIX3State *piix3 = PIIX3_PCI_DEVICE(VAR_0);", "int VAR_4;", "pci_bus_fire_intx_routing_notifier(piix3->VAR_0.bus);", "piix3_update_irq_levels(piix3);", "for (VAR_4 = 0; VAR_4 < PIIX_NUM_PIC_IRQS; VAR_4++) {", "piix3_set_irq_pic(piix3, VAR_4);", "}", "}", "}" ]
[ 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 ] ]
9,762
static void idcin_decode_vlcs(IdcinContext *s) { hnode_t *hnodes; long x, y; int prev; unsigned char v = 0; int bit_pos, node_num, dat_pos; prev = bit_pos = dat_pos = 0; for (y = 0; y < (s->frame.linesize[0] * s->avctx->height); y += s->frame.linesize[0]) { for (x = y; x < y + s->avctx->width; x++) { node_num = s->num_huff_nodes[prev]; hnodes = s->huff_nodes[prev]; while(node_num >= HUF_TOKENS) { if(!bit_pos) { if(dat_pos > s->size) { av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n"); return; } bit_pos = 8; v = s->buf[dat_pos++]; } node_num = hnodes[node_num].children[v & 0x01]; v = v >> 1; bit_pos--; } s->frame.data[0][x] = node_num; prev = node_num; } } }
true
FFmpeg
aabdc4618788a90c4a2b64a569f560d5b7378271
static void idcin_decode_vlcs(IdcinContext *s) { hnode_t *hnodes; long x, y; int prev; unsigned char v = 0; int bit_pos, node_num, dat_pos; prev = bit_pos = dat_pos = 0; for (y = 0; y < (s->frame.linesize[0] * s->avctx->height); y += s->frame.linesize[0]) { for (x = y; x < y + s->avctx->width; x++) { node_num = s->num_huff_nodes[prev]; hnodes = s->huff_nodes[prev]; while(node_num >= HUF_TOKENS) { if(!bit_pos) { if(dat_pos > s->size) { av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n"); return; } bit_pos = 8; v = s->buf[dat_pos++]; } node_num = hnodes[node_num].children[v & 0x01]; v = v >> 1; bit_pos--; } s->frame.data[0][x] = node_num; prev = node_num; } } }
{ "code": [ " if(dat_pos > s->size) {" ], "line_no": [ 35 ] }
static void FUNC_0(IdcinContext *VAR_0) { hnode_t *hnodes; long VAR_1, VAR_2; int VAR_3; unsigned char VAR_4 = 0; int VAR_5, VAR_6, VAR_7; VAR_3 = VAR_5 = VAR_7 = 0; for (VAR_2 = 0; VAR_2 < (VAR_0->frame.linesize[0] * VAR_0->avctx->height); VAR_2 += VAR_0->frame.linesize[0]) { for (VAR_1 = VAR_2; VAR_1 < VAR_2 + VAR_0->avctx->width; VAR_1++) { VAR_6 = VAR_0->num_huff_nodes[VAR_3]; hnodes = VAR_0->huff_nodes[VAR_3]; while(VAR_6 >= HUF_TOKENS) { if(!VAR_5) { if(VAR_7 > VAR_0->size) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Huffman decode error.\n"); return; } VAR_5 = 8; VAR_4 = VAR_0->buf[VAR_7++]; } VAR_6 = hnodes[VAR_6].children[VAR_4 & 0x01]; VAR_4 = VAR_4 >> 1; VAR_5--; } VAR_0->frame.data[0][VAR_1] = VAR_6; VAR_3 = VAR_6; } } }
[ "static void FUNC_0(IdcinContext *VAR_0)\n{", "hnode_t *hnodes;", "long VAR_1, VAR_2;", "int VAR_3;", "unsigned char VAR_4 = 0;", "int VAR_5, VAR_6, VAR_7;", "VAR_3 = VAR_5 = VAR_7 = 0;", "for (VAR_2 = 0; VAR_2 < (VAR_0->frame.linesize[0] * VAR_0->avctx->height);", "VAR_2 += VAR_0->frame.linesize[0]) {", "for (VAR_1 = VAR_2; VAR_1 < VAR_2 + VAR_0->avctx->width; VAR_1++) {", "VAR_6 = VAR_0->num_huff_nodes[VAR_3];", "hnodes = VAR_0->huff_nodes[VAR_3];", "while(VAR_6 >= HUF_TOKENS) {", "if(!VAR_5) {", "if(VAR_7 > VAR_0->size) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Huffman decode error.\\n\");", "return;", "}", "VAR_5 = 8;", "VAR_4 = VAR_0->buf[VAR_7++];", "}", "VAR_6 = hnodes[VAR_6].children[VAR_4 & 0x01];", "VAR_4 = VAR_4 >> 1;", "VAR_5--;", "}", "VAR_0->frame.data[0][VAR_1] = VAR_6;", "VAR_3 = VAR_6;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ] ]
9,763
static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, AVFrame *p, AVPacket *avpkt) { AVDictionary *metadata = NULL; uint32_t tag, length; int decode_next_dat = 0; int ret; for (;;) { length = bytestream2_get_bytes_left(&s->gb); if (length <= 0) { if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) { if (!(s->state & PNG_IDAT)) return 0; else goto exit_loop; } av_log(avctx, AV_LOG_ERROR, "%d bytes left\n", length); if ( s->state & PNG_ALLIMAGE && avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL) goto exit_loop; ret = AVERROR_INVALIDDATA; goto fail; } length = bytestream2_get_be32(&s->gb); if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) { av_log(avctx, AV_LOG_ERROR, "chunk too big\n"); ret = AVERROR_INVALIDDATA; goto fail; } tag = bytestream2_get_le32(&s->gb); if (avctx->debug & FF_DEBUG_STARTCODE) av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n", (tag & 0xff), ((tag >> 8) & 0xff), ((tag >> 16) & 0xff), ((tag >> 24) & 0xff), length); switch (tag) { case MKTAG('I', 'H', 'D', 'R'): if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0) goto fail; break; case MKTAG('p', 'H', 'Y', 's'): if ((ret = decode_phys_chunk(avctx, s)) < 0) goto fail; break; case MKTAG('f', 'c', 'T', 'L'): if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG) goto skip_tag; if ((ret = decode_fctl_chunk(avctx, s, length)) < 0) goto fail; decode_next_dat = 1; break; case MKTAG('f', 'd', 'A', 'T'): if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG) goto skip_tag; if (!decode_next_dat) { ret = AVERROR_INVALIDDATA; goto fail; } bytestream2_get_be32(&s->gb); length -= 4; /* fallthrough */ case MKTAG('I', 'D', 'A', 'T'): if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat) goto skip_tag; if ((ret = decode_idat_chunk(avctx, s, length, p)) < 0) goto fail; break; case MKTAG('P', 'L', 'T', 'E'): if (decode_plte_chunk(avctx, s, length) < 0) goto skip_tag; break; case MKTAG('t', 'R', 'N', 'S'): if (decode_trns_chunk(avctx, s, length) < 0) goto skip_tag; break; case MKTAG('t', 'E', 'X', 't'): if (decode_text_chunk(s, length, 0, &metadata) < 0) av_log(avctx, AV_LOG_WARNING, "Broken tEXt chunk\n"); bytestream2_skip(&s->gb, length + 4); break; case MKTAG('z', 'T', 'X', 't'): if (decode_text_chunk(s, length, 1, &metadata) < 0) av_log(avctx, AV_LOG_WARNING, "Broken zTXt chunk\n"); bytestream2_skip(&s->gb, length + 4); break; case MKTAG('I', 'E', 'N', 'D'): if (!(s->state & PNG_ALLIMAGE)) av_log(avctx, AV_LOG_ERROR, "IEND without all image\n"); if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) { ret = AVERROR_INVALIDDATA; goto fail; } bytestream2_skip(&s->gb, 4); /* crc */ goto exit_loop; default: /* skip tag */ skip_tag: bytestream2_skip(&s->gb, length + 4); break; } } exit_loop: if (s->bits_per_pixel <= 4) handle_small_bpp(s, p); /* apply transparency if needed */ if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) { size_t byte_depth = s->bit_depth > 8 ? 2 : 1; size_t raw_bpp = s->bpp - byte_depth; unsigned x, y; for (y = 0; y < s->height; ++y) { uint8_t *row = &s->image_buf[s->image_linesize * y]; /* since we're updating in-place, we have to go from right to left */ for (x = s->width; x > 0; --x) { uint8_t *pixel = &row[s->bpp * (x - 1)]; memmove(pixel, &row[raw_bpp * (x - 1)], raw_bpp); if (!memcmp(pixel, s->transparent_color_be, raw_bpp)) { memset(&pixel[raw_bpp], 0, byte_depth); } else { memset(&pixel[raw_bpp], 0xff, byte_depth); } } } } /* handle p-frames only if a predecessor frame is available */ if (s->last_picture.f->data[0]) { if ( !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG") && s->last_picture.f->width == p->width && s->last_picture.f->height== p->height && s->last_picture.f->format== p->format ) { if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG) handle_p_frame_png(s, p); else if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && (ret = handle_p_frame_apng(avctx, s, p)) < 0) goto fail; } } ff_thread_report_progress(&s->picture, INT_MAX, 0); av_frame_set_metadata(p, metadata); metadata = NULL; return 0; fail: av_dict_free(&metadata); ff_thread_report_progress(&s->picture, INT_MAX, 0); return ret; }
true
FFmpeg
9e9d731b510666edac3a2b450dfc331279db818b
static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, AVFrame *p, AVPacket *avpkt) { AVDictionary *metadata = NULL; uint32_t tag, length; int decode_next_dat = 0; int ret; for (;;) { length = bytestream2_get_bytes_left(&s->gb); if (length <= 0) { if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) { if (!(s->state & PNG_IDAT)) return 0; else goto exit_loop; } av_log(avctx, AV_LOG_ERROR, "%d bytes left\n", length); if ( s->state & PNG_ALLIMAGE && avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL) goto exit_loop; ret = AVERROR_INVALIDDATA; goto fail; } length = bytestream2_get_be32(&s->gb); if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) { av_log(avctx, AV_LOG_ERROR, "chunk too big\n"); ret = AVERROR_INVALIDDATA; goto fail; } tag = bytestream2_get_le32(&s->gb); if (avctx->debug & FF_DEBUG_STARTCODE) av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n", (tag & 0xff), ((tag >> 8) & 0xff), ((tag >> 16) & 0xff), ((tag >> 24) & 0xff), length); switch (tag) { case MKTAG('I', 'H', 'D', 'R'): if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0) goto fail; break; case MKTAG('p', 'H', 'Y', 's'): if ((ret = decode_phys_chunk(avctx, s)) < 0) goto fail; break; case MKTAG('f', 'c', 'T', 'L'): if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG) goto skip_tag; if ((ret = decode_fctl_chunk(avctx, s, length)) < 0) goto fail; decode_next_dat = 1; break; case MKTAG('f', 'd', 'A', 'T'): if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG) goto skip_tag; if (!decode_next_dat) { ret = AVERROR_INVALIDDATA; goto fail; } bytestream2_get_be32(&s->gb); length -= 4; case MKTAG('I', 'D', 'A', 'T'): if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat) goto skip_tag; if ((ret = decode_idat_chunk(avctx, s, length, p)) < 0) goto fail; break; case MKTAG('P', 'L', 'T', 'E'): if (decode_plte_chunk(avctx, s, length) < 0) goto skip_tag; break; case MKTAG('t', 'R', 'N', 'S'): if (decode_trns_chunk(avctx, s, length) < 0) goto skip_tag; break; case MKTAG('t', 'E', 'X', 't'): if (decode_text_chunk(s, length, 0, &metadata) < 0) av_log(avctx, AV_LOG_WARNING, "Broken tEXt chunk\n"); bytestream2_skip(&s->gb, length + 4); break; case MKTAG('z', 'T', 'X', 't'): if (decode_text_chunk(s, length, 1, &metadata) < 0) av_log(avctx, AV_LOG_WARNING, "Broken zTXt chunk\n"); bytestream2_skip(&s->gb, length + 4); break; case MKTAG('I', 'E', 'N', 'D'): if (!(s->state & PNG_ALLIMAGE)) av_log(avctx, AV_LOG_ERROR, "IEND without all image\n"); if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) { ret = AVERROR_INVALIDDATA; goto fail; } bytestream2_skip(&s->gb, 4); goto exit_loop; default: skip_tag: bytestream2_skip(&s->gb, length + 4); break; } } exit_loop: if (s->bits_per_pixel <= 4) handle_small_bpp(s, p); if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) { size_t byte_depth = s->bit_depth > 8 ? 2 : 1; size_t raw_bpp = s->bpp - byte_depth; unsigned x, y; for (y = 0; y < s->height; ++y) { uint8_t *row = &s->image_buf[s->image_linesize * y]; for (x = s->width; x > 0; --x) { uint8_t *pixel = &row[s->bpp * (x - 1)]; memmove(pixel, &row[raw_bpp * (x - 1)], raw_bpp); if (!memcmp(pixel, s->transparent_color_be, raw_bpp)) { memset(&pixel[raw_bpp], 0, byte_depth); } else { memset(&pixel[raw_bpp], 0xff, byte_depth); } } } } if (s->last_picture.f->data[0]) { if ( !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG") && s->last_picture.f->width == p->width && s->last_picture.f->height== p->height && s->last_picture.f->format== p->format ) { if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG) handle_p_frame_png(s, p); else if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && (ret = handle_p_frame_apng(avctx, s, p)) < 0) goto fail; } } ff_thread_report_progress(&s->picture, INT_MAX, 0); av_frame_set_metadata(p, metadata); metadata = NULL; return 0; fail: av_dict_free(&metadata); ff_thread_report_progress(&s->picture, INT_MAX, 0); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1, AVFrame *VAR_2, AVPacket *VAR_3) { AVDictionary *metadata = NULL; uint32_t tag, length; int VAR_4 = 0; int VAR_5; for (;;) { length = bytestream2_get_bytes_left(&VAR_1->gb); if (length <= 0) { if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && length == 0) { if (!(VAR_1->state & PNG_IDAT)) return 0; else goto exit_loop; } av_log(VAR_0, AV_LOG_ERROR, "%d bytes left\n", length); if ( VAR_1->state & PNG_ALLIMAGE && VAR_0->strict_std_compliance <= FF_COMPLIANCE_NORMAL) goto exit_loop; VAR_5 = AVERROR_INVALIDDATA; goto fail; } length = bytestream2_get_be32(&VAR_1->gb); if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&VAR_1->gb)) { av_log(VAR_0, AV_LOG_ERROR, "chunk too big\n"); VAR_5 = AVERROR_INVALIDDATA; goto fail; } tag = bytestream2_get_le32(&VAR_1->gb); if (VAR_0->debug & FF_DEBUG_STARTCODE) av_log(VAR_0, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n", (tag & 0xff), ((tag >> 8) & 0xff), ((tag >> 16) & 0xff), ((tag >> 24) & 0xff), length); switch (tag) { case MKTAG('I', 'H', 'D', 'R'): if ((VAR_5 = decode_ihdr_chunk(VAR_0, VAR_1, length)) < 0) goto fail; break; case MKTAG('VAR_2', 'H', 'Y', 'VAR_1'): if ((VAR_5 = decode_phys_chunk(VAR_0, VAR_1)) < 0) goto fail; break; case MKTAG('f', 'c', 'T', 'L'): if (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG) goto skip_tag; if ((VAR_5 = decode_fctl_chunk(VAR_0, VAR_1, length)) < 0) goto fail; VAR_4 = 1; break; case MKTAG('f', 'd', 'A', 'T'): if (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG) goto skip_tag; if (!VAR_4) { VAR_5 = AVERROR_INVALIDDATA; goto fail; } bytestream2_get_be32(&VAR_1->gb); length -= 4; case MKTAG('I', 'D', 'A', 'T'): if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && !VAR_4) goto skip_tag; if ((VAR_5 = decode_idat_chunk(VAR_0, VAR_1, length, VAR_2)) < 0) goto fail; break; case MKTAG('P', 'L', 'T', 'E'): if (decode_plte_chunk(VAR_0, VAR_1, length) < 0) goto skip_tag; break; case MKTAG('t', 'R', 'N', 'S'): if (decode_trns_chunk(VAR_0, VAR_1, length) < 0) goto skip_tag; break; case MKTAG('t', 'E', 'X', 't'): if (decode_text_chunk(VAR_1, length, 0, &metadata) < 0) av_log(VAR_0, AV_LOG_WARNING, "Broken tEXt chunk\n"); bytestream2_skip(&VAR_1->gb, length + 4); break; case MKTAG('z', 'T', 'X', 't'): if (decode_text_chunk(VAR_1, length, 1, &metadata) < 0) av_log(VAR_0, AV_LOG_WARNING, "Broken zTXt chunk\n"); bytestream2_skip(&VAR_1->gb, length + 4); break; case MKTAG('I', 'E', 'N', 'D'): if (!(VAR_1->state & PNG_ALLIMAGE)) av_log(VAR_0, AV_LOG_ERROR, "IEND without all image\n"); if (!(VAR_1->state & (PNG_ALLIMAGE|PNG_IDAT))) { VAR_5 = AVERROR_INVALIDDATA; goto fail; } bytestream2_skip(&VAR_1->gb, 4); goto exit_loop; default: skip_tag: bytestream2_skip(&VAR_1->gb, length + 4); break; } } exit_loop: if (VAR_1->bits_per_pixel <= 4) handle_small_bpp(VAR_1, VAR_2); if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) { size_t byte_depth = VAR_1->bit_depth > 8 ? 2 : 1; size_t raw_bpp = VAR_1->bpp - byte_depth; unsigned VAR_6, VAR_7; for (VAR_7 = 0; VAR_7 < VAR_1->height; ++VAR_7) { uint8_t *row = &VAR_1->image_buf[VAR_1->image_linesize * VAR_7]; for (VAR_6 = VAR_1->width; VAR_6 > 0; --VAR_6) { uint8_t *pixel = &row[VAR_1->bpp * (VAR_6 - 1)]; memmove(pixel, &row[raw_bpp * (VAR_6 - 1)], raw_bpp); if (!memcmp(pixel, VAR_1->transparent_color_be, raw_bpp)) { memset(&pixel[raw_bpp], 0, byte_depth); } else { memset(&pixel[raw_bpp], 0xff, byte_depth); } } } } if (VAR_1->last_picture.f->data[0]) { if ( !(VAR_3->flags & AV_PKT_FLAG_KEY) && VAR_0->codec_tag != AV_RL32("MPNG") && VAR_1->last_picture.f->width == VAR_2->width && VAR_1->last_picture.f->height== VAR_2->height && VAR_1->last_picture.f->format== VAR_2->format ) { if (CONFIG_PNG_DECODER && VAR_0->codec_id != AV_CODEC_ID_APNG) handle_p_frame_png(VAR_1, VAR_2); else if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && (VAR_5 = handle_p_frame_apng(VAR_0, VAR_1, VAR_2)) < 0) goto fail; } } ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0); av_frame_set_metadata(VAR_2, metadata); metadata = NULL; return 0; fail: av_dict_free(&metadata); ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0); return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1,\nAVFrame *VAR_2, AVPacket *VAR_3)\n{", "AVDictionary *metadata = NULL;", "uint32_t tag, length;", "int VAR_4 = 0;", "int VAR_5;", "for (;;) {", "length = bytestream2_get_bytes_left(&VAR_1->gb);", "if (length <= 0) {", "if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && length == 0) {", "if (!(VAR_1->state & PNG_IDAT))\nreturn 0;", "else\ngoto exit_loop;", "}", "av_log(VAR_0, AV_LOG_ERROR, \"%d bytes left\\n\", length);", "if ( VAR_1->state & PNG_ALLIMAGE\n&& VAR_0->strict_std_compliance <= FF_COMPLIANCE_NORMAL)\ngoto exit_loop;", "VAR_5 = AVERROR_INVALIDDATA;", "goto fail;", "}", "length = bytestream2_get_be32(&VAR_1->gb);", "if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&VAR_1->gb)) {", "av_log(VAR_0, AV_LOG_ERROR, \"chunk too big\\n\");", "VAR_5 = AVERROR_INVALIDDATA;", "goto fail;", "}", "tag = bytestream2_get_le32(&VAR_1->gb);", "if (VAR_0->debug & FF_DEBUG_STARTCODE)\nav_log(VAR_0, AV_LOG_DEBUG, \"png: tag=%c%c%c%c length=%u\\n\",\n(tag & 0xff),\n((tag >> 8) & 0xff),\n((tag >> 16) & 0xff),\n((tag >> 24) & 0xff), length);", "switch (tag) {", "case MKTAG('I', 'H', 'D', 'R'):\nif ((VAR_5 = decode_ihdr_chunk(VAR_0, VAR_1, length)) < 0)\ngoto fail;", "break;", "case MKTAG('VAR_2', 'H', 'Y', 'VAR_1'):\nif ((VAR_5 = decode_phys_chunk(VAR_0, VAR_1)) < 0)\ngoto fail;", "break;", "case MKTAG('f', 'c', 'T', 'L'):\nif (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG)\ngoto skip_tag;", "if ((VAR_5 = decode_fctl_chunk(VAR_0, VAR_1, length)) < 0)\ngoto fail;", "VAR_4 = 1;", "break;", "case MKTAG('f', 'd', 'A', 'T'):\nif (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG)\ngoto skip_tag;", "if (!VAR_4) {", "VAR_5 = AVERROR_INVALIDDATA;", "goto fail;", "}", "bytestream2_get_be32(&VAR_1->gb);", "length -= 4;", "case MKTAG('I', 'D', 'A', 'T'):\nif (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && !VAR_4)\ngoto skip_tag;", "if ((VAR_5 = decode_idat_chunk(VAR_0, VAR_1, length, VAR_2)) < 0)\ngoto fail;", "break;", "case MKTAG('P', 'L', 'T', 'E'):\nif (decode_plte_chunk(VAR_0, VAR_1, length) < 0)\ngoto skip_tag;", "break;", "case MKTAG('t', 'R', 'N', 'S'):\nif (decode_trns_chunk(VAR_0, VAR_1, length) < 0)\ngoto skip_tag;", "break;", "case MKTAG('t', 'E', 'X', 't'):\nif (decode_text_chunk(VAR_1, length, 0, &metadata) < 0)\nav_log(VAR_0, AV_LOG_WARNING, \"Broken tEXt chunk\\n\");", "bytestream2_skip(&VAR_1->gb, length + 4);", "break;", "case MKTAG('z', 'T', 'X', 't'):\nif (decode_text_chunk(VAR_1, length, 1, &metadata) < 0)\nav_log(VAR_0, AV_LOG_WARNING, \"Broken zTXt chunk\\n\");", "bytestream2_skip(&VAR_1->gb, length + 4);", "break;", "case MKTAG('I', 'E', 'N', 'D'):\nif (!(VAR_1->state & PNG_ALLIMAGE))\nav_log(VAR_0, AV_LOG_ERROR, \"IEND without all image\\n\");", "if (!(VAR_1->state & (PNG_ALLIMAGE|PNG_IDAT))) {", "VAR_5 = AVERROR_INVALIDDATA;", "goto fail;", "}", "bytestream2_skip(&VAR_1->gb, 4);", "goto exit_loop;", "default:\nskip_tag:\nbytestream2_skip(&VAR_1->gb, length + 4);", "break;", "}", "}", "exit_loop:\nif (VAR_1->bits_per_pixel <= 4)\nhandle_small_bpp(VAR_1, VAR_2);", "if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) {", "size_t byte_depth = VAR_1->bit_depth > 8 ? 2 : 1;", "size_t raw_bpp = VAR_1->bpp - byte_depth;", "unsigned VAR_6, VAR_7;", "for (VAR_7 = 0; VAR_7 < VAR_1->height; ++VAR_7) {", "uint8_t *row = &VAR_1->image_buf[VAR_1->image_linesize * VAR_7];", "for (VAR_6 = VAR_1->width; VAR_6 > 0; --VAR_6) {", "uint8_t *pixel = &row[VAR_1->bpp * (VAR_6 - 1)];", "memmove(pixel, &row[raw_bpp * (VAR_6 - 1)], raw_bpp);", "if (!memcmp(pixel, VAR_1->transparent_color_be, raw_bpp)) {", "memset(&pixel[raw_bpp], 0, byte_depth);", "} else {", "memset(&pixel[raw_bpp], 0xff, byte_depth);", "}", "}", "}", "}", "if (VAR_1->last_picture.f->data[0]) {", "if ( !(VAR_3->flags & AV_PKT_FLAG_KEY) && VAR_0->codec_tag != AV_RL32(\"MPNG\")\n&& VAR_1->last_picture.f->width == VAR_2->width\n&& VAR_1->last_picture.f->height== VAR_2->height\n&& VAR_1->last_picture.f->format== VAR_2->format\n) {", "if (CONFIG_PNG_DECODER && VAR_0->codec_id != AV_CODEC_ID_APNG)\nhandle_p_frame_png(VAR_1, VAR_2);", "else if (CONFIG_APNG_DECODER &&\nVAR_0->codec_id == AV_CODEC_ID_APNG &&\n(VAR_5 = handle_p_frame_apng(VAR_0, VAR_1, VAR_2)) < 0)\ngoto fail;", "}", "}", "ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0);", "av_frame_set_metadata(VAR_2, metadata);", "metadata = NULL;", "return 0;", "fail:\nav_dict_free(&metadata);", "ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69, 71, 73, 75 ], [ 77 ], [ 79, 81, 83 ], [ 85 ], [ 87, 89, 91 ], [ 93 ], [ 95, 97, 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129, 131, 133 ], [ 135, 137 ], [ 139 ], [ 141, 143, 145 ], [ 147 ], [ 149, 151, 153 ], [ 155 ], [ 157, 159, 161 ], [ 163 ], [ 165 ], [ 167, 169, 171 ], [ 173 ], [ 175 ], [ 177, 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209, 213, 215 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 267 ], [ 269, 271, 273, 275, 277 ], [ 279, 281 ], [ 283, 285, 287, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 300 ], [ 302 ], [ 304 ], [ 308, 310 ], [ 312 ], [ 315 ], [ 317 ] ]
9,764
void helper_idivq_EAX_T0(void) { uint64_t r0, r1; if (T0 == 0) { raise_exception(EXCP00_DIVZ); } r0 = EAX; r1 = EDX; idiv64(&r0, &r1, T0); EAX = r0; EDX = r1; }
true
qemu
45bbbb466cf4a6280076ea5a51f67ef5bedee345
void helper_idivq_EAX_T0(void) { uint64_t r0, r1; if (T0 == 0) { raise_exception(EXCP00_DIVZ); } r0 = EAX; r1 = EDX; idiv64(&r0, &r1, T0); EAX = r0; EDX = r1; }
{ "code": [ " idiv64(&r0, &r1, T0);" ], "line_no": [ 17 ] }
void FUNC_0(void) { uint64_t r0, r1; if (T0 == 0) { raise_exception(EXCP00_DIVZ); } r0 = EAX; r1 = EDX; idiv64(&r0, &r1, T0); EAX = r0; EDX = r1; }
[ "void FUNC_0(void)\n{", "uint64_t r0, r1;", "if (T0 == 0) {", "raise_exception(EXCP00_DIVZ);", "}", "r0 = EAX;", "r1 = EDX;", "idiv64(&r0, &r1, T0);", "EAX = r0;", "EDX = r1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
9,766
static void start_children(FFServerStream *feed) { char *pathname; char *slash; int i; size_t cmd_length; if (no_launch) return; cmd_length = strlen(my_program_name); /** * FIXME: WIP Safeguard. Remove after clearing all harcoded * '1024' path lengths */ if (cmd_length > PATH_LENGTH - 1) { http_log("Could not start children. Command line: '%s' exceeds " "path length limit (%d)\n", my_program_name, PATH_LENGTH); return; } pathname = av_strdup (my_program_name); if (!pathname) { http_log("Could not allocate memory for children cmd line\n"); return; } /* replace "ffserver" with "ffmpeg" in the path of current * program. Ignore user provided path */ slash = strrchr(pathname, '/'); if (!slash) slash = pathname; else slash++; strcpy(slash, "ffmpeg"); for (; feed; feed = feed->next) { if (!feed->child_argv || feed->pid) continue; feed->pid_start = time(0); feed->pid = fork(); if (feed->pid < 0) { http_log("Unable to create children: %s\n", strerror(errno)); av_free (pathname); exit(EXIT_FAILURE); } if (feed->pid) continue; /* In child */ http_log("Launch command line: "); http_log("%s ", pathname); for (i = 1; feed->child_argv[i] && feed->child_argv[i][0]; i++) http_log("%s ", feed->child_argv[i]); http_log("\n"); for (i = 3; i < 256; i++) close(i); if (!config.debug) { if (!freopen("/dev/null", "r", stdin)) http_log("failed to redirect STDIN to /dev/null\n;"); if (!freopen("/dev/null", "w", stdout)) http_log("failed to redirect STDOUT to /dev/null\n;"); if (!freopen("/dev/null", "w", stderr)) http_log("failed to redirect STDERR to /dev/null\n;"); } signal(SIGPIPE, SIG_DFL); execvp(pathname, feed->child_argv); av_free (pathname); _exit(1); } av_free (pathname); }
true
FFmpeg
95d9a85ca3e662388d5fa7ef1937d1c3fbe2dcd5
static void start_children(FFServerStream *feed) { char *pathname; char *slash; int i; size_t cmd_length; if (no_launch) return; cmd_length = strlen(my_program_name); if (cmd_length > PATH_LENGTH - 1) { http_log("Could not start children. Command line: '%s' exceeds " "path length limit (%d)\n", my_program_name, PATH_LENGTH); return; } pathname = av_strdup (my_program_name); if (!pathname) { http_log("Could not allocate memory for children cmd line\n"); return; } slash = strrchr(pathname, '/'); if (!slash) slash = pathname; else slash++; strcpy(slash, "ffmpeg"); for (; feed; feed = feed->next) { if (!feed->child_argv || feed->pid) continue; feed->pid_start = time(0); feed->pid = fork(); if (feed->pid < 0) { http_log("Unable to create children: %s\n", strerror(errno)); av_free (pathname); exit(EXIT_FAILURE); } if (feed->pid) continue; http_log("Launch command line: "); http_log("%s ", pathname); for (i = 1; feed->child_argv[i] && feed->child_argv[i][0]; i++) http_log("%s ", feed->child_argv[i]); http_log("\n"); for (i = 3; i < 256; i++) close(i); if (!config.debug) { if (!freopen("/dev/null", "r", stdin)) http_log("failed to redirect STDIN to /dev/null\n;"); if (!freopen("/dev/null", "w", stdout)) http_log("failed to redirect STDOUT to /dev/null\n;"); if (!freopen("/dev/null", "w", stderr)) http_log("failed to redirect STDERR to /dev/null\n;"); } signal(SIGPIPE, SIG_DFL); execvp(pathname, feed->child_argv); av_free (pathname); _exit(1); } av_free (pathname); }
{ "code": [ " pathname = av_strdup (my_program_name);", " slash = strrchr(pathname, '/');", " if (!slash)", " slash = pathname;", " slash++;", " strcpy(slash, \"ffmpeg\");" ], "line_no": [ 45, 61, 63, 65, 69, 71 ] }
static void FUNC_0(FFServerStream *VAR_0) { char *VAR_1; char *VAR_2; int VAR_3; size_t cmd_length; if (no_launch) return; cmd_length = strlen(my_program_name); if (cmd_length > PATH_LENGTH - 1) { http_log("Could not start children. Command line: '%s' exceeds " "path length limit (%d)\n", my_program_name, PATH_LENGTH); return; } VAR_1 = av_strdup (my_program_name); if (!VAR_1) { http_log("Could not allocate memory for children cmd line\n"); return; } VAR_2 = strrchr(VAR_1, '/'); if (!VAR_2) VAR_2 = VAR_1; else VAR_2++; strcpy(VAR_2, "ffmpeg"); for (; VAR_0; VAR_0 = VAR_0->next) { if (!VAR_0->child_argv || VAR_0->pid) continue; VAR_0->pid_start = time(0); VAR_0->pid = fork(); if (VAR_0->pid < 0) { http_log("Unable to create children: %s\n", strerror(errno)); av_free (VAR_1); exit(EXIT_FAILURE); } if (VAR_0->pid) continue; http_log("Launch command line: "); http_log("%s ", VAR_1); for (VAR_3 = 1; VAR_0->child_argv[VAR_3] && VAR_0->child_argv[VAR_3][0]; VAR_3++) http_log("%s ", VAR_0->child_argv[VAR_3]); http_log("\n"); for (VAR_3 = 3; VAR_3 < 256; VAR_3++) close(VAR_3); if (!config.debug) { if (!freopen("/dev/null", "r", stdin)) http_log("failed to redirect STDIN to /dev/null\n;"); if (!freopen("/dev/null", "w", stdout)) http_log("failed to redirect STDOUT to /dev/null\n;"); if (!freopen("/dev/null", "w", stderr)) http_log("failed to redirect STDERR to /dev/null\n;"); } signal(SIGPIPE, SIG_DFL); execvp(VAR_1, VAR_0->child_argv); av_free (VAR_1); _exit(1); } av_free (VAR_1); }
[ "static void FUNC_0(FFServerStream *VAR_0)\n{", "char *VAR_1;", "char *VAR_2;", "int VAR_3;", "size_t cmd_length;", "if (no_launch)\nreturn;", "cmd_length = strlen(my_program_name);", "if (cmd_length > PATH_LENGTH - 1) {", "http_log(\"Could not start children. Command line: '%s' exceeds \"\n\"path length limit (%d)\\n\", my_program_name, PATH_LENGTH);", "return;", "}", "VAR_1 = av_strdup (my_program_name);", "if (!VAR_1) {", "http_log(\"Could not allocate memory for children cmd line\\n\");", "return;", "}", "VAR_2 = strrchr(VAR_1, '/');", "if (!VAR_2)\nVAR_2 = VAR_1;", "else\nVAR_2++;", "strcpy(VAR_2, \"ffmpeg\");", "for (; VAR_0; VAR_0 = VAR_0->next) {", "if (!VAR_0->child_argv || VAR_0->pid)\ncontinue;", "VAR_0->pid_start = time(0);", "VAR_0->pid = fork();", "if (VAR_0->pid < 0) {", "http_log(\"Unable to create children: %s\\n\", strerror(errno));", "av_free (VAR_1);", "exit(EXIT_FAILURE);", "}", "if (VAR_0->pid)\ncontinue;", "http_log(\"Launch command line: \");", "http_log(\"%s \", VAR_1);", "for (VAR_3 = 1; VAR_0->child_argv[VAR_3] && VAR_0->child_argv[VAR_3][0]; VAR_3++)", "http_log(\"%s \", VAR_0->child_argv[VAR_3]);", "http_log(\"\\n\");", "for (VAR_3 = 3; VAR_3 < 256; VAR_3++)", "close(VAR_3);", "if (!config.debug) {", "if (!freopen(\"/dev/null\", \"r\", stdin))\nhttp_log(\"failed to redirect STDIN to /dev/null\\n;\");", "if (!freopen(\"/dev/null\", \"w\", stdout))\nhttp_log(\"failed to redirect STDOUT to /dev/null\\n;\");", "if (!freopen(\"/dev/null\", \"w\", stderr))\nhttp_log(\"failed to redirect STDERR to /dev/null\\n;\");", "}", "signal(SIGPIPE, SIG_DFL);", "execvp(VAR_1, VAR_0->child_argv);", "av_free (VAR_1);", "_exit(1);", "}", "av_free (VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 75 ], [ 79, 81 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139, 141 ], [ 143, 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ] ]
9,767
static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt) { struct dshow_ctx *ctx = s->priv_data; AVPacketList *pktl = NULL; while (!ctx->eof && !pktl) { WaitForSingleObject(ctx->mutex, INFINITE); pktl = ctx->pktl; if (pktl) { *pkt = pktl->pkt; ctx->pktl = ctx->pktl->next; av_free(pktl); ctx->curbufsize -= pkt->size; } ResetEvent(ctx->event[1]); ReleaseMutex(ctx->mutex); if (!pktl) { if (dshow_check_event_queue(ctx->media_event) < 0) { ctx->eof = 1; } else if (s->flags & AVFMT_FLAG_NONBLOCK) { return AVERROR(EAGAIN); } else { WaitForMultipleObjects(2, ctx->event, 0, INFINITE); } } } return ctx->eof ? AVERROR(EIO) : pkt->size; }
true
FFmpeg
6abc56e892c2c2500d1fc2698fa6d580b72f721b
static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt) { struct dshow_ctx *ctx = s->priv_data; AVPacketList *pktl = NULL; while (!ctx->eof && !pktl) { WaitForSingleObject(ctx->mutex, INFINITE); pktl = ctx->pktl; if (pktl) { *pkt = pktl->pkt; ctx->pktl = ctx->pktl->next; av_free(pktl); ctx->curbufsize -= pkt->size; } ResetEvent(ctx->event[1]); ReleaseMutex(ctx->mutex); if (!pktl) { if (dshow_check_event_queue(ctx->media_event) < 0) { ctx->eof = 1; } else if (s->flags & AVFMT_FLAG_NONBLOCK) { return AVERROR(EAGAIN); } else { WaitForMultipleObjects(2, ctx->event, 0, INFINITE); } } } return ctx->eof ? AVERROR(EIO) : pkt->size; }
{ "code": [ " ctx->curbufsize -= pkt->size;" ], "line_no": [ 25 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { struct dshow_ctx *VAR_2 = VAR_0->priv_data; AVPacketList *pktl = NULL; while (!VAR_2->eof && !pktl) { WaitForSingleObject(VAR_2->mutex, INFINITE); pktl = VAR_2->pktl; if (pktl) { *VAR_1 = pktl->VAR_1; VAR_2->pktl = VAR_2->pktl->next; av_free(pktl); VAR_2->curbufsize -= VAR_1->size; } ResetEvent(VAR_2->event[1]); ReleaseMutex(VAR_2->mutex); if (!pktl) { if (dshow_check_event_queue(VAR_2->media_event) < 0) { VAR_2->eof = 1; } else if (VAR_0->flags & AVFMT_FLAG_NONBLOCK) { return AVERROR(EAGAIN); } else { WaitForMultipleObjects(2, VAR_2->event, 0, INFINITE); } } } return VAR_2->eof ? AVERROR(EIO) : VAR_1->size; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "struct dshow_ctx *VAR_2 = VAR_0->priv_data;", "AVPacketList *pktl = NULL;", "while (!VAR_2->eof && !pktl) {", "WaitForSingleObject(VAR_2->mutex, INFINITE);", "pktl = VAR_2->pktl;", "if (pktl) {", "*VAR_1 = pktl->VAR_1;", "VAR_2->pktl = VAR_2->pktl->next;", "av_free(pktl);", "VAR_2->curbufsize -= VAR_1->size;", "}", "ResetEvent(VAR_2->event[1]);", "ReleaseMutex(VAR_2->mutex);", "if (!pktl) {", "if (dshow_check_event_queue(VAR_2->media_event) < 0) {", "VAR_2->eof = 1;", "} else if (VAR_0->flags & AVFMT_FLAG_NONBLOCK) {", "return AVERROR(EAGAIN);", "} else {", "WaitForMultipleObjects(2, VAR_2->event, 0, INFINITE);", "}", "}", "}", "return VAR_2->eof ? AVERROR(EIO) : VAR_1->size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ] ]
9,768
static void vmxnet3_update_pm_state(VMXNET3State *s) { struct Vmxnet3_VariableLenConfDesc pm_descr; pm_descr.confLen = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confLen); pm_descr.confVer = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confVer); pm_descr.confPA = VMXNET3_READ_DRV_SHARED64(s->drv_shmem, devRead.pmConfDesc.confPA); vmxnet3_dump_conf_descr("PM State", &pm_descr); }
true
qemu
c508277335e3b6b20cf18e6ea3a35c1fa835c64a
static void vmxnet3_update_pm_state(VMXNET3State *s) { struct Vmxnet3_VariableLenConfDesc pm_descr; pm_descr.confLen = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confLen); pm_descr.confVer = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confVer); pm_descr.confPA = VMXNET3_READ_DRV_SHARED64(s->drv_shmem, devRead.pmConfDesc.confPA); vmxnet3_dump_conf_descr("PM State", &pm_descr); }
{ "code": [ " VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confLen);", " VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confVer);", " VMXNET3_READ_DRV_SHARED64(s->drv_shmem, devRead.pmConfDesc.confPA);" ], "line_no": [ 11, 15, 19 ] }
static void FUNC_0(VMXNET3State *VAR_0) { struct Vmxnet3_VariableLenConfDesc VAR_1; VAR_1.confLen = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, devRead.pmConfDesc.confLen); VAR_1.confVer = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, devRead.pmConfDesc.confVer); VAR_1.confPA = VMXNET3_READ_DRV_SHARED64(VAR_0->drv_shmem, devRead.pmConfDesc.confPA); vmxnet3_dump_conf_descr("PM State", &VAR_1); }
[ "static void FUNC_0(VMXNET3State *VAR_0)\n{", "struct Vmxnet3_VariableLenConfDesc VAR_1;", "VAR_1.confLen =\nVMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, devRead.pmConfDesc.confLen);", "VAR_1.confVer =\nVMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, devRead.pmConfDesc.confVer);", "VAR_1.confPA =\nVMXNET3_READ_DRV_SHARED64(VAR_0->drv_shmem, devRead.pmConfDesc.confPA);", "vmxnet3_dump_conf_descr(\"PM State\", &VAR_1);", "}" ]
[ 0, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ], [ 23 ], [ 25 ] ]
9,769
static int adx_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, const void *data) { ADXContext *c = avctx->priv_data; const short *samples = data; unsigned char *dst = frame; int rest = avctx->frame_size; /* input data size = ffmpeg.c: do_audio_out() frame_bytes = enc->frame_size * 2 * enc->channels; */ // printf("sz=%d ",buf_size); fflush(stdout); if (!c->header_parsed) { int hdrsize = adx_encode_header(avctx,dst,buf_size); dst+=hdrsize; c->header_parsed = 1; } if (avctx->channels==1) { while(rest>=32) { adx_encode(dst,samples,c->prev); dst+=18; samples+=32; rest-=32; } } else { while(rest>=32*2) { short tmpbuf[32*2]; int i; for(i=0;i<32;i++) { tmpbuf[i] = samples[i*2]; tmpbuf[i+32] = samples[i*2+1]; } adx_encode(dst,tmpbuf,c->prev); adx_encode(dst+18,tmpbuf+32,c->prev+1); dst+=18*2; samples+=32*2; rest-=32*2; } } return dst-frame; }
true
FFmpeg
f19af812a32c1398d48c3550d11dbc6aafbb2bfc
static int adx_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, const void *data) { ADXContext *c = avctx->priv_data; const short *samples = data; unsigned char *dst = frame; int rest = avctx->frame_size; if (!c->header_parsed) { int hdrsize = adx_encode_header(avctx,dst,buf_size); dst+=hdrsize; c->header_parsed = 1; } if (avctx->channels==1) { while(rest>=32) { adx_encode(dst,samples,c->prev); dst+=18; samples+=32; rest-=32; } } else { while(rest>=32*2) { short tmpbuf[32*2]; int i; for(i=0;i<32;i++) { tmpbuf[i] = samples[i*2]; tmpbuf[i+32] = samples[i*2+1]; } adx_encode(dst,tmpbuf,c->prev); adx_encode(dst+18,tmpbuf+32,c->prev+1); dst+=18*2; samples+=32*2; rest-=32*2; } } return dst-frame; }
{ "code": [ "\t\t\t unsigned char *frame, int buf_size, const void *data)", "\tADXContext *c = avctx->priv_data;", "\tconst short *samples = data;", "\tunsigned char *dst = frame;", "\tint rest = avctx->frame_size;", "\tif (!c->header_parsed) {", "\t\tint hdrsize = adx_encode_header(avctx,dst,buf_size);", "\t\tdst+=hdrsize;", "\t\tc->header_parsed = 1;", "\tif (avctx->channels==1) {", "\t\twhile(rest>=32) {", "\t\t\tadx_encode(dst,samples,c->prev);", "\t\t\tdst+=18;", "\t\t\tsamples+=32;", "\t\t\trest-=32;", "\t} else {", "\t\twhile(rest>=32*2) {", "\t\t\tshort tmpbuf[32*2];", "\t\t\tint i;", "\t\t\tfor(i=0;i<32;i++) {", "\t\t\t\ttmpbuf[i] = samples[i*2];", "\t\t\t\ttmpbuf[i+32] = samples[i*2+1];", "\t\t\tadx_encode(dst,tmpbuf,c->prev);", "\t\t\tadx_encode(dst+18,tmpbuf+32,c->prev+1);", "\t\t\tdst+=18*2;", "\t\t\tsamples+=32*2;", "\t\t\trest-=32*2;", "\treturn dst-frame;", "\tADXContext *c = avctx->priv_data;", "\tADXContext *c = avctx->priv_data;", "\tif (!c->header_parsed) {", "\t\tc->header_parsed = 1;", "\tif (avctx->channels==1) {", "\t\t\tsamples+=32;", "\t} else {", "\t\t\tsamples+=32*2;" ], "line_no": [ 3, 7, 9, 11, 13, 31, 33, 35, 37, 43, 45, 47, 49, 51, 53, 57, 59, 61, 63, 67, 69, 71, 77, 79, 81, 83, 85, 91, 7, 7, 31, 37, 43, 51, 57, 83 ] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, const void *VAR_3) { ADXContext *c = VAR_0->priv_data; const short *VAR_4 = VAR_3; unsigned char *VAR_5 = VAR_1; int VAR_6 = VAR_0->frame_size; if (!c->header_parsed) { int VAR_7 = adx_encode_header(VAR_0,VAR_5,VAR_2); VAR_5+=VAR_7; c->header_parsed = 1; } if (VAR_0->channels==1) { while(VAR_6>=32) { adx_encode(VAR_5,VAR_4,c->prev); VAR_5+=18; VAR_4+=32; VAR_6-=32; } } else { while(VAR_6>=32*2) { short VAR_8[32*2]; int VAR_9; for(VAR_9=0;VAR_9<32;VAR_9++) { VAR_8[VAR_9] = VAR_4[VAR_9*2]; VAR_8[VAR_9+32] = VAR_4[VAR_9*2+1]; } adx_encode(VAR_5,VAR_8,c->prev); adx_encode(VAR_5+18,VAR_8+32,c->prev+1); VAR_5+=18*2; VAR_4+=32*2; VAR_6-=32*2; } } return VAR_5-VAR_1; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nunsigned char *VAR_1, int VAR_2, const void *VAR_3)\n{", "ADXContext *c = VAR_0->priv_data;", "const short *VAR_4 = VAR_3;", "unsigned char *VAR_5 = VAR_1;", "int VAR_6 = VAR_0->frame_size;", "if (!c->header_parsed) {", "int VAR_7 = adx_encode_header(VAR_0,VAR_5,VAR_2);", "VAR_5+=VAR_7;", "c->header_parsed = 1;", "}", "if (VAR_0->channels==1) {", "while(VAR_6>=32) {", "adx_encode(VAR_5,VAR_4,c->prev);", "VAR_5+=18;", "VAR_4+=32;", "VAR_6-=32;", "}", "} else {", "while(VAR_6>=32*2) {", "short VAR_8[32*2];", "int VAR_9;", "for(VAR_9=0;VAR_9<32;VAR_9++) {", "VAR_8[VAR_9] = VAR_4[VAR_9*2];", "VAR_8[VAR_9+32] = VAR_4[VAR_9*2+1];", "}", "adx_encode(VAR_5,VAR_8,c->prev);", "adx_encode(VAR_5+18,VAR_8+32,c->prev+1);", "VAR_5+=18*2;", "VAR_4+=32*2;", "VAR_6-=32*2;", "}", "}", "return VAR_5-VAR_1;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
9,770
void HELPER(vfp_set_fpscr)(CPUState *env, uint32_t val) { int i; uint32_t changed; changed = env->vfp.xregs[ARM_VFP_FPSCR]; env->vfp.xregs[ARM_VFP_FPSCR] = (val & 0xffc8ffff); env->vfp.vec_len = (val >> 16) & 7; env->vfp.vec_stride = (val >> 20) & 3; changed ^= val; if (changed & (3 << 22)) { i = (val >> 22) & 3; switch (i) { case 0: i = float_round_nearest_even; break; case 1: i = float_round_up; break; case 2: i = float_round_down; break; case 3: i = float_round_to_zero; break; } set_float_rounding_mode(i, &env->vfp.fp_status); } if (changed & (1 << 24)) set_flush_to_zero((val & (1 << 24)) != 0, &env->vfp.fp_status); if (changed & (1 << 25)) set_default_nan_mode((val & (1 << 25)) != 0, &env->vfp.fp_status); i = vfp_exceptbits_to_host(val); set_float_exception_flags(i, &env->vfp.fp_status); }
true
qemu
cecd8504b80148b66cdc1ce32046429bc3549090
void HELPER(vfp_set_fpscr)(CPUState *env, uint32_t val) { int i; uint32_t changed; changed = env->vfp.xregs[ARM_VFP_FPSCR]; env->vfp.xregs[ARM_VFP_FPSCR] = (val & 0xffc8ffff); env->vfp.vec_len = (val >> 16) & 7; env->vfp.vec_stride = (val >> 20) & 3; changed ^= val; if (changed & (3 << 22)) { i = (val >> 22) & 3; switch (i) { case 0: i = float_round_nearest_even; break; case 1: i = float_round_up; break; case 2: i = float_round_down; break; case 3: i = float_round_to_zero; break; } set_float_rounding_mode(i, &env->vfp.fp_status); } if (changed & (1 << 24)) set_flush_to_zero((val & (1 << 24)) != 0, &env->vfp.fp_status); if (changed & (1 << 25)) set_default_nan_mode((val & (1 << 25)) != 0, &env->vfp.fp_status); i = vfp_exceptbits_to_host(val); set_float_exception_flags(i, &env->vfp.fp_status); }
{ "code": [ " if (changed & (1 << 24))" ], "line_no": [ 59 ] }
void FUNC_0(vfp_set_fpscr)(CPUState *env, uint32_t val) { int VAR_0; uint32_t changed; changed = env->vfp.xregs[ARM_VFP_FPSCR]; env->vfp.xregs[ARM_VFP_FPSCR] = (val & 0xffc8ffff); env->vfp.vec_len = (val >> 16) & 7; env->vfp.vec_stride = (val >> 20) & 3; changed ^= val; if (changed & (3 << 22)) { VAR_0 = (val >> 22) & 3; switch (VAR_0) { case 0: VAR_0 = float_round_nearest_even; break; case 1: VAR_0 = float_round_up; break; case 2: VAR_0 = float_round_down; break; case 3: VAR_0 = float_round_to_zero; break; } set_float_rounding_mode(VAR_0, &env->vfp.fp_status); } if (changed & (1 << 24)) set_flush_to_zero((val & (1 << 24)) != 0, &env->vfp.fp_status); if (changed & (1 << 25)) set_default_nan_mode((val & (1 << 25)) != 0, &env->vfp.fp_status); VAR_0 = vfp_exceptbits_to_host(val); set_float_exception_flags(VAR_0, &env->vfp.fp_status); }
[ "void FUNC_0(vfp_set_fpscr)(CPUState *env, uint32_t val)\n{", "int VAR_0;", "uint32_t changed;", "changed = env->vfp.xregs[ARM_VFP_FPSCR];", "env->vfp.xregs[ARM_VFP_FPSCR] = (val & 0xffc8ffff);", "env->vfp.vec_len = (val >> 16) & 7;", "env->vfp.vec_stride = (val >> 20) & 3;", "changed ^= val;", "if (changed & (3 << 22)) {", "VAR_0 = (val >> 22) & 3;", "switch (VAR_0) {", "case 0:\nVAR_0 = float_round_nearest_even;", "break;", "case 1:\nVAR_0 = float_round_up;", "break;", "case 2:\nVAR_0 = float_round_down;", "break;", "case 3:\nVAR_0 = float_round_to_zero;", "break;", "}", "set_float_rounding_mode(VAR_0, &env->vfp.fp_status);", "}", "if (changed & (1 << 24))\nset_flush_to_zero((val & (1 << 24)) != 0, &env->vfp.fp_status);", "if (changed & (1 << 25))\nset_default_nan_mode((val & (1 << 25)) != 0, &env->vfp.fp_status);", "VAR_0 = vfp_exceptbits_to_host(val);", "set_float_exception_flags(VAR_0, &env->vfp.fp_status);", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ] ]
9,771
static int virtio_blk_pci_init(VirtIOPCIProxy *vpci_dev) { VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); virtio_blk_set_conf(vdev, &(dev->blk)); qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); if (qdev_init(vdev) < 0) { return -1; } return 0; }
true
qemu
caffdac363801cd2cf2bf01ad013a8c1e1e43800
static int virtio_blk_pci_init(VirtIOPCIProxy *vpci_dev) { VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); virtio_blk_set_conf(vdev, &(dev->blk)); qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); if (qdev_init(vdev) < 0) { return -1; } return 0; }
{ "code": [ " virtio_blk_set_conf(vdev, &(dev->blk));", " virtio_blk_set_conf(vdev, &(dev->blk));", " virtio_blk_set_conf(vdev, &(dev->blk));" ], "line_no": [ 9, 9, 9 ] }
static int FUNC_0(VirtIOPCIProxy *VAR_0) { VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(VAR_0); DeviceState *vdev = DEVICE(&dev->vdev); virtio_blk_set_conf(vdev, &(dev->blk)); qdev_set_parent_bus(vdev, BUS(&VAR_0->bus)); if (qdev_init(vdev) < 0) { return -1; } return 0; }
[ "static int FUNC_0(VirtIOPCIProxy *VAR_0)\n{", "VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(VAR_0);", "DeviceState *vdev = DEVICE(&dev->vdev);", "virtio_blk_set_conf(vdev, &(dev->blk));", "qdev_set_parent_bus(vdev, BUS(&VAR_0->bus));", "if (qdev_init(vdev) < 0) {", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
9,773
void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra) { int qscale; int shift = 0; for (qscale = qmin; qscale <= qmax; qscale++) { int i; if (dsp->fdct == ff_jpeg_fdct_islow_8 || dsp->fdct == ff_jpeg_fdct_islow_10 || dsp->fdct == ff_faandct) { for (i = 0; i < 64; i++) { const int j = dsp->idct_permutation[i]; /* 16 <= qscale * quant_matrix[i] <= 7905 * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] * 19952 <= x <= 249205026 * (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 249205026 * 3444240 >= (1 << 36) / (x) >= 275 */ qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); } } else if (dsp->fdct == ff_fdct_ifast) { for (i = 0; i < 64; i++) { const int j = dsp->idct_permutation[i]; /* 16 <= qscale * quant_matrix[i] <= 7905 * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] * 19952 <= x <= 249205026 * (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 249205026 * 3444240 >= (1 << 36) / (x) >= 275 */ qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) / (ff_aanscales[i] * qscale * quant_matrix[j])); } } else { for (i = 0; i < 64; i++) { const int j = dsp->idct_permutation[i]; /* We can safely suppose that 16 <= quant_matrix[i] <= 255 * Assume x = qscale * quant_matrix[i] * So 16 <= x <= 7905 * so (1 << 19) / 16 >= (1 << 19) / (x) >= (1 << 19) / 7905 * so 32768 >= (1 << 19) / (x) >= 67 */ qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); //qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) / // (qscale * quant_matrix[i]); qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]); if (qmat16[qscale][0][i] == 0 || qmat16[qscale][0][i] == 128 * 256) qmat16[qscale][0][i] = 128 * 256 - 1; qmat16[qscale][1][i] = ROUNDED_DIV(bias << (16 - QUANT_BIAS_SHIFT), qmat16[qscale][0][i]); } } for (i = intra; i < 64; i++) { int64_t max = 8191; if (dsp->fdct == ff_fdct_ifast) { max = (8191LL * ff_aanscales[i]) >> 14; } while (((max * qmat[qscale][i]) >> shift) > INT_MAX) { shift++; } } } if (shift) { av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - shift); } }
true
FFmpeg
c753b56b4d56724284dd7ed972efdb843db80f12
void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra) { int qscale; int shift = 0; for (qscale = qmin; qscale <= qmax; qscale++) { int i; if (dsp->fdct == ff_jpeg_fdct_islow_8 || dsp->fdct == ff_jpeg_fdct_islow_10 || dsp->fdct == ff_faandct) { for (i = 0; i < 64; i++) { const int j = dsp->idct_permutation[i]; qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); } } else if (dsp->fdct == ff_fdct_ifast) { for (i = 0; i < 64; i++) { const int j = dsp->idct_permutation[i]; qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) / (ff_aanscales[i] * qscale * quant_matrix[j])); } } else { for (i = 0; i < 64; i++) { const int j = dsp->idct_permutation[i]; qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]); if (qmat16[qscale][0][i] == 0 || qmat16[qscale][0][i] == 128 * 256) qmat16[qscale][0][i] = 128 * 256 - 1; qmat16[qscale][1][i] = ROUNDED_DIV(bias << (16 - QUANT_BIAS_SHIFT), qmat16[qscale][0][i]); } } for (i = intra; i < 64; i++) { int64_t max = 8191; if (dsp->fdct == ff_fdct_ifast) { max = (8191LL * ff_aanscales[i]) >> 14; } while (((max * qmat[qscale][i]) >> shift) > INT_MAX) { shift++; } } } if (shift) { av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - shift); } }
{ "code": [ " (ff_aanscales[i] * qscale * quant_matrix[j]));" ], "line_no": [ 69 ] }
void FUNC_0(DSPContext *VAR_0, int (*VAR_1)[64], VAR_2 (*qmat16)[2][64], const VAR_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { int VAR_8; int VAR_9 = 0; for (VAR_8 = VAR_5; VAR_8 <= VAR_6; VAR_8++) { int VAR_10; if (VAR_0->fdct == ff_jpeg_fdct_islow_8 || VAR_0->fdct == ff_jpeg_fdct_islow_10 || VAR_0->fdct == ff_faandct) { for (VAR_10 = 0; VAR_10 < 64; VAR_10++) { const int VAR_12 = VAR_0->idct_permutation[VAR_10]; VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(1) << QMAT_SHIFT) / (VAR_8 * VAR_3[VAR_12])); } } else if (VAR_0->fdct == ff_fdct_ifast) { for (VAR_10 = 0; VAR_10 < 64; VAR_10++) { const int VAR_12 = VAR_0->idct_permutation[VAR_10]; VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) / (ff_aanscales[VAR_10] * VAR_8 * VAR_3[VAR_12])); } } else { for (VAR_10 = 0; VAR_10 < 64; VAR_10++) { const int VAR_12 = VAR_0->idct_permutation[VAR_10]; VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(1) << QMAT_SHIFT) / (VAR_8 * VAR_3[VAR_12])); qmat16[VAR_8][0][VAR_10] = (1 << QMAT_SHIFT_MMX) / (VAR_8 * VAR_3[VAR_12]); if (qmat16[VAR_8][0][VAR_10] == 0 || qmat16[VAR_8][0][VAR_10] == 128 * 256) qmat16[VAR_8][0][VAR_10] = 128 * 256 - 1; qmat16[VAR_8][1][VAR_10] = ROUNDED_DIV(VAR_4 << (16 - QUANT_BIAS_SHIFT), qmat16[VAR_8][0][VAR_10]); } } for (VAR_10 = VAR_7; VAR_10 < 64; VAR_10++) { int64_t max = 8191; if (VAR_0->fdct == ff_fdct_ifast) { max = (8191LL * ff_aanscales[VAR_10]) >> 14; } while (((max * VAR_1[VAR_8][VAR_10]) >> VAR_9) > INT_MAX) { VAR_9++; } } } if (VAR_9) { av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - VAR_9); } }
[ "void FUNC_0(DSPContext *VAR_0, int (*VAR_1)[64],\nVAR_2 (*qmat16)[2][64],\nconst VAR_2 *VAR_3,\nint VAR_4, int VAR_5, int VAR_6, int VAR_7)\n{", "int VAR_8;", "int VAR_9 = 0;", "for (VAR_8 = VAR_5; VAR_8 <= VAR_6; VAR_8++) {", "int VAR_10;", "if (VAR_0->fdct == ff_jpeg_fdct_islow_8 ||\nVAR_0->fdct == ff_jpeg_fdct_islow_10 ||\nVAR_0->fdct == ff_faandct) {", "for (VAR_10 = 0; VAR_10 < 64; VAR_10++) {", "const int VAR_12 = VAR_0->idct_permutation[VAR_10];", "VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(1) << QMAT_SHIFT) /\n(VAR_8 * VAR_3[VAR_12]));", "}", "} else if (VAR_0->fdct == ff_fdct_ifast) {", "for (VAR_10 = 0; VAR_10 < 64; VAR_10++) {", "const int VAR_12 = VAR_0->idct_permutation[VAR_10];", "VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) /\n(ff_aanscales[VAR_10] * VAR_8 * VAR_3[VAR_12]));", "}", "} else {", "for (VAR_10 = 0; VAR_10 < 64; VAR_10++) {", "const int VAR_12 = VAR_0->idct_permutation[VAR_10];", "VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(1) << QMAT_SHIFT) /\n(VAR_8 * VAR_3[VAR_12]));", "qmat16[VAR_8][0][VAR_10] = (1 << QMAT_SHIFT_MMX) /\n(VAR_8 * VAR_3[VAR_12]);", "if (qmat16[VAR_8][0][VAR_10] == 0 ||\nqmat16[VAR_8][0][VAR_10] == 128 * 256)\nqmat16[VAR_8][0][VAR_10] = 128 * 256 - 1;", "qmat16[VAR_8][1][VAR_10] =\nROUNDED_DIV(VAR_4 << (16 - QUANT_BIAS_SHIFT),\nqmat16[VAR_8][0][VAR_10]);", "}", "}", "for (VAR_10 = VAR_7; VAR_10 < 64; VAR_10++) {", "int64_t max = 8191;", "if (VAR_0->fdct == ff_fdct_ifast) {", "max = (8191LL * ff_aanscales[VAR_10]) >> 14;", "}", "while (((max * VAR_1[VAR_8][VAR_10]) >> VAR_9) > INT_MAX) {", "VAR_9++;", "}", "}", "}", "if (VAR_9) {", "av_log(NULL, AV_LOG_INFO,\n\"Warning, QMAT_SHIFT is larger than %d, overflows possible\\n\",\nQMAT_SHIFT - VAR_9);", "}", "}" ]
[ 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 89, 91 ], [ 97, 99 ], [ 103, 105, 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151 ] ]
9,776
static int pcm_dvd_parse_header(AVCodecContext *avctx, const uint8_t *header) { /* no traces of 44100 and 32000Hz in any commercial software or player */ static const uint32_t frequencies[4] = { 48000, 96000, 44100, 32000 }; PCMDVDContext *s = avctx->priv_data; int header_int = (header[0] & 0xe0) | (header[1] << 8) | (header[2] << 16); /* early exit if the header didn't change apart from the frame number */ if (s->last_header == header_int) return 0; if (avctx->debug & FF_DEBUG_PICT_INFO) av_dlog(avctx, "pcm_dvd_parse_header: header = %02x%02x%02x\n", header[0], header[1], header[2]); /* * header[0] emphasis (1), muse(1), reserved(1), frame number(5) * header[1] quant (2), freq(2), reserved(1), channels(3) * header[2] dynamic range control (0x80 = off) */ /* Discard potentially existing leftover samples from old channel layout */ s->extra_sample_count = 0; /* get the sample depth and derive the sample format from it */ avctx->bits_per_coded_sample = 16 + (header[1] >> 6 & 3) * 4; if (avctx->bits_per_coded_sample == 28) { av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth %i\n", avctx->bits_per_coded_sample); return AVERROR_INVALIDDATA; } avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_S32; avctx->bits_per_raw_sample = avctx->bits_per_coded_sample; /* get the sample rate */ avctx->sample_rate = frequencies[header[1] >> 4 & 3]; /* get the number of channels */ avctx->channels = 1 + (header[1] & 7); /* calculate the bitrate */ avctx->bit_rate = avctx->channels * avctx->sample_rate * avctx->bits_per_coded_sample; /* 4 samples form a group in 20/24bit PCM on DVD Video. * A block is formed by the number of groups that are * needed to complete a set of samples for each channel. */ if (avctx->bits_per_coded_sample == 16) { s->samples_per_block = 1; s->block_size = avctx->channels * 2; } else { switch (avctx->channels) { case 1: case 2: case 4: /* one group has all the samples needed */ s->block_size = 4 * avctx->bits_per_coded_sample / 8; s->samples_per_block = 4 / avctx->channels; s->groups_per_block = 1; break; case 8: /* two groups have all the samples needed */ s->block_size = 8 * avctx->bits_per_coded_sample / 8; s->samples_per_block = 1; s->groups_per_block = 2; break; default: /* need avctx->channels groups */ s->block_size = 4 * avctx->channels * avctx->bits_per_coded_sample / 8; s->samples_per_block = 4; s->groups_per_block = avctx->channels; break; } } if (avctx->debug & FF_DEBUG_PICT_INFO) av_dlog(avctx, "pcm_dvd_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n", avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate, avctx->bit_rate); s->last_header = header_int; return 0; }
true
FFmpeg
f55bc96a5449179ee9b0aab6f0a4581ba1df6b62
static int pcm_dvd_parse_header(AVCodecContext *avctx, const uint8_t *header) { static const uint32_t frequencies[4] = { 48000, 96000, 44100, 32000 }; PCMDVDContext *s = avctx->priv_data; int header_int = (header[0] & 0xe0) | (header[1] << 8) | (header[2] << 16); if (s->last_header == header_int) return 0; if (avctx->debug & FF_DEBUG_PICT_INFO) av_dlog(avctx, "pcm_dvd_parse_header: header = %02x%02x%02x\n", header[0], header[1], header[2]); s->extra_sample_count = 0; avctx->bits_per_coded_sample = 16 + (header[1] >> 6 & 3) * 4; if (avctx->bits_per_coded_sample == 28) { av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth %i\n", avctx->bits_per_coded_sample); return AVERROR_INVALIDDATA; } avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_S32; avctx->bits_per_raw_sample = avctx->bits_per_coded_sample; avctx->sample_rate = frequencies[header[1] >> 4 & 3]; avctx->channels = 1 + (header[1] & 7); avctx->bit_rate = avctx->channels * avctx->sample_rate * avctx->bits_per_coded_sample; if (avctx->bits_per_coded_sample == 16) { s->samples_per_block = 1; s->block_size = avctx->channels * 2; } else { switch (avctx->channels) { case 1: case 2: case 4: s->block_size = 4 * avctx->bits_per_coded_sample / 8; s->samples_per_block = 4 / avctx->channels; s->groups_per_block = 1; break; case 8: s->block_size = 8 * avctx->bits_per_coded_sample / 8; s->samples_per_block = 1; s->groups_per_block = 2; break; default: s->block_size = 4 * avctx->channels * avctx->bits_per_coded_sample / 8; s->samples_per_block = 4; s->groups_per_block = avctx->channels; break; } } if (avctx->debug & FF_DEBUG_PICT_INFO) av_dlog(avctx, "pcm_dvd_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n", avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate, avctx->bit_rate); s->last_header = header_int; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1) { static const uint32_t VAR_2[4] = { 48000, 96000, 44100, 32000 }; PCMDVDContext *s = VAR_0->priv_data; int VAR_3 = (VAR_1[0] & 0xe0) | (VAR_1[1] << 8) | (VAR_1[2] << 16); if (s->last_header == VAR_3) return 0; if (VAR_0->debug & FF_DEBUG_PICT_INFO) av_dlog(VAR_0, "FUNC_0: VAR_1 = %02x%02x%02x\n", VAR_1[0], VAR_1[1], VAR_1[2]); s->extra_sample_count = 0; VAR_0->bits_per_coded_sample = 16 + (VAR_1[1] >> 6 & 3) * 4; if (VAR_0->bits_per_coded_sample == 28) { av_log(VAR_0, AV_LOG_ERROR, "PCM DVD unsupported sample depth %i\n", VAR_0->bits_per_coded_sample); return AVERROR_INVALIDDATA; } VAR_0->sample_fmt = VAR_0->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_S32; VAR_0->bits_per_raw_sample = VAR_0->bits_per_coded_sample; VAR_0->sample_rate = VAR_2[VAR_1[1] >> 4 & 3]; VAR_0->channels = 1 + (VAR_1[1] & 7); VAR_0->bit_rate = VAR_0->channels * VAR_0->sample_rate * VAR_0->bits_per_coded_sample; if (VAR_0->bits_per_coded_sample == 16) { s->samples_per_block = 1; s->block_size = VAR_0->channels * 2; } else { switch (VAR_0->channels) { case 1: case 2: case 4: s->block_size = 4 * VAR_0->bits_per_coded_sample / 8; s->samples_per_block = 4 / VAR_0->channels; s->groups_per_block = 1; break; case 8: s->block_size = 8 * VAR_0->bits_per_coded_sample / 8; s->samples_per_block = 1; s->groups_per_block = 2; break; default: s->block_size = 4 * VAR_0->channels * VAR_0->bits_per_coded_sample / 8; s->samples_per_block = 4; s->groups_per_block = VAR_0->channels; break; } } if (VAR_0->debug & FF_DEBUG_PICT_INFO) av_dlog(VAR_0, "FUNC_0: %d channels, %d bits per sample, %d Hz, %d bit/s\n", VAR_0->channels, VAR_0->bits_per_coded_sample, VAR_0->sample_rate, VAR_0->bit_rate); s->last_header = VAR_3; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1)\n{", "static const uint32_t VAR_2[4] = { 48000, 96000, 44100, 32000 };", "PCMDVDContext *s = VAR_0->priv_data;", "int VAR_3 = (VAR_1[0] & 0xe0) | (VAR_1[1] << 8) | (VAR_1[2] << 16);", "if (s->last_header == VAR_3)\nreturn 0;", "if (VAR_0->debug & FF_DEBUG_PICT_INFO)\nav_dlog(VAR_0, \"FUNC_0: VAR_1 = %02x%02x%02x\\n\",\nVAR_1[0], VAR_1[1], VAR_1[2]);", "s->extra_sample_count = 0;", "VAR_0->bits_per_coded_sample = 16 + (VAR_1[1] >> 6 & 3) * 4;", "if (VAR_0->bits_per_coded_sample == 28) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"PCM DVD unsupported sample depth %i\\n\",\nVAR_0->bits_per_coded_sample);", "return AVERROR_INVALIDDATA;", "}", "VAR_0->sample_fmt = VAR_0->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16\n: AV_SAMPLE_FMT_S32;", "VAR_0->bits_per_raw_sample = VAR_0->bits_per_coded_sample;", "VAR_0->sample_rate = VAR_2[VAR_1[1] >> 4 & 3];", "VAR_0->channels = 1 + (VAR_1[1] & 7);", "VAR_0->bit_rate = VAR_0->channels *\nVAR_0->sample_rate *\nVAR_0->bits_per_coded_sample;", "if (VAR_0->bits_per_coded_sample == 16) {", "s->samples_per_block = 1;", "s->block_size = VAR_0->channels * 2;", "} else {", "switch (VAR_0->channels) {", "case 1:\ncase 2:\ncase 4:\ns->block_size = 4 * VAR_0->bits_per_coded_sample / 8;", "s->samples_per_block = 4 / VAR_0->channels;", "s->groups_per_block = 1;", "break;", "case 8:\ns->block_size = 8 * VAR_0->bits_per_coded_sample / 8;", "s->samples_per_block = 1;", "s->groups_per_block = 2;", "break;", "default:\ns->block_size = 4 * VAR_0->channels *\nVAR_0->bits_per_coded_sample / 8;", "s->samples_per_block = 4;", "s->groups_per_block = VAR_0->channels;", "break;", "}", "}", "if (VAR_0->debug & FF_DEBUG_PICT_INFO)\nav_dlog(VAR_0,\n\"FUNC_0: %d channels, %d bits per sample, %d Hz, %d bit/s\\n\",\nVAR_0->channels, VAR_0->bits_per_coded_sample,\nVAR_0->sample_rate, VAR_0->bit_rate);", "s->last_header = VAR_3;", "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 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 17, 19 ], [ 24, 26, 28 ], [ 44 ], [ 50 ], [ 52 ], [ 54, 56, 58 ], [ 60 ], [ 62 ], [ 64, 66 ], [ 68 ], [ 74 ], [ 80 ], [ 84, 86, 88 ], [ 98 ], [ 100 ], [ 102 ], [ 104 ], [ 106 ], [ 108, 110, 112, 116 ], [ 118 ], [ 120 ], [ 122 ], [ 124, 128 ], [ 130 ], [ 132 ], [ 134 ], [ 136, 140, 142 ], [ 144 ], [ 146 ], [ 148 ], [ 150 ], [ 152 ], [ 156, 158, 160, 162, 164 ], [ 168 ], [ 172 ], [ 174 ] ]
9,777
static int64_t nfs_client_open(NFSClient *client, QDict *options, int flags, int open_flags, Error **errp) { int ret = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat st; char *file = NULL, *strp = NULL; qemu_mutex_init(&client->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } client->path = g_strdup(qemu_opt_get(opts, "path")); if (!client->path) { ret = -EINVAL; error_setg(errp, "No path was specified"); goto fail; } strp = strrchr(client->path, '/'); if (strp == NULL) { error_setg(errp, "Invalid URL specified"); goto fail; } file = g_strdup(strp); *strp = 0; /* Pop the config into our state object, Exit if invalid */ client->server = nfs_config(options, errp); if (!client->server) { ret = -EINVAL; goto fail; } client->context = nfs_init_context(); if (client->context == NULL) { error_setg(errp, "Failed to init NFS context"); goto fail; } if (qemu_opt_get(opts, "user")) { client->uid = qemu_opt_get_number(opts, "user", 0); nfs_set_uid(client->context, client->uid); } if (qemu_opt_get(opts, "group")) { client->gid = qemu_opt_get_number(opts, "group", 0); nfs_set_gid(client->context, client->gid); } if (qemu_opt_get(opts, "tcp-syn-count")) { client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syn-count", 0); nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); } #ifdef LIBNFS_FEATURE_READAHEAD if (qemu_opt_get(opts, "readahead-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS readahead " "if cache.direct = on"); goto fail; } client->readahead = qemu_opt_get_number(opts, "readahead-size", 0); if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { warn_report("Truncating NFS readahead size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE; } nfs_set_readahead(client->context, client->readahead); #ifdef LIBNFS_FEATURE_PAGECACHE nfs_set_pagecache_ttl(client->context, 0); #endif client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_PAGECACHE if (qemu_opt_get(opts, "page-cache-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS pagecache " "if cache.direct = on"); goto fail; } client->pagecache = qemu_opt_get_number(opts, "page-cache-size", 0); if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { warn_report("Truncating NFS pagecache size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE; } nfs_set_pagecache(client->context, client->pagecache); nfs_set_pagecache_ttl(client->context, 0); client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_DEBUG if (qemu_opt_get(opts, "debug")) { client->debug = qemu_opt_get_number(opts, "debug", 0); /* limit the maximum debug level to avoid potential flooding * of our log files. */ if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) { warn_report("Limiting NFS debug level to %d", QEMU_NFS_MAX_DEBUG_LEVEL); client->debug = QEMU_NFS_MAX_DEBUG_LEVEL; } nfs_set_debug(client->context, client->debug); } #endif ret = nfs_mount(client->context, client->server->host, client->path); if (ret < 0) { error_setg(errp, "Failed to mount nfs share: %s", nfs_get_error(client->context)); goto fail; } if (flags & O_CREAT) { ret = nfs_creat(client->context, file, 0600, &client->fh); if (ret < 0) { error_setg(errp, "Failed to create file: %s", nfs_get_error(client->context)); goto fail; } } else { ret = nfs_open(client->context, file, flags, &client->fh); if (ret < 0) { error_setg(errp, "Failed to open file : %s", nfs_get_error(client->context)); goto fail; } } ret = nfs_fstat(client->context, client->fh, &st); if (ret < 0) { error_setg(errp, "Failed to fstat file: %s", nfs_get_error(client->context)); goto fail; } ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE); client->st_blocks = st.st_blocks; client->has_zero_init = S_ISREG(st.st_mode); *strp = '/'; goto out; fail: nfs_client_close(client); out: qemu_opts_del(opts); g_free(file); return ret; }
true
qemu
f1a7ff770f7d71ee7833ff019aac9d6cc3d13f71
static int64_t nfs_client_open(NFSClient *client, QDict *options, int flags, int open_flags, Error **errp) { int ret = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat st; char *file = NULL, *strp = NULL; qemu_mutex_init(&client->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } client->path = g_strdup(qemu_opt_get(opts, "path")); if (!client->path) { ret = -EINVAL; error_setg(errp, "No path was specified"); goto fail; } strp = strrchr(client->path, '/'); if (strp == NULL) { error_setg(errp, "Invalid URL specified"); goto fail; } file = g_strdup(strp); *strp = 0; client->server = nfs_config(options, errp); if (!client->server) { ret = -EINVAL; goto fail; } client->context = nfs_init_context(); if (client->context == NULL) { error_setg(errp, "Failed to init NFS context"); goto fail; } if (qemu_opt_get(opts, "user")) { client->uid = qemu_opt_get_number(opts, "user", 0); nfs_set_uid(client->context, client->uid); } if (qemu_opt_get(opts, "group")) { client->gid = qemu_opt_get_number(opts, "group", 0); nfs_set_gid(client->context, client->gid); } if (qemu_opt_get(opts, "tcp-syn-count")) { client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syn-count", 0); nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); } #ifdef LIBNFS_FEATURE_READAHEAD if (qemu_opt_get(opts, "readahead-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS readahead " "if cache.direct = on"); goto fail; } client->readahead = qemu_opt_get_number(opts, "readahead-size", 0); if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { warn_report("Truncating NFS readahead size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE; } nfs_set_readahead(client->context, client->readahead); #ifdef LIBNFS_FEATURE_PAGECACHE nfs_set_pagecache_ttl(client->context, 0); #endif client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_PAGECACHE if (qemu_opt_get(opts, "page-cache-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS pagecache " "if cache.direct = on"); goto fail; } client->pagecache = qemu_opt_get_number(opts, "page-cache-size", 0); if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { warn_report("Truncating NFS pagecache size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE; } nfs_set_pagecache(client->context, client->pagecache); nfs_set_pagecache_ttl(client->context, 0); client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_DEBUG if (qemu_opt_get(opts, "debug")) { client->debug = qemu_opt_get_number(opts, "debug", 0); if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) { warn_report("Limiting NFS debug level to %d", QEMU_NFS_MAX_DEBUG_LEVEL); client->debug = QEMU_NFS_MAX_DEBUG_LEVEL; } nfs_set_debug(client->context, client->debug); } #endif ret = nfs_mount(client->context, client->server->host, client->path); if (ret < 0) { error_setg(errp, "Failed to mount nfs share: %s", nfs_get_error(client->context)); goto fail; } if (flags & O_CREAT) { ret = nfs_creat(client->context, file, 0600, &client->fh); if (ret < 0) { error_setg(errp, "Failed to create file: %s", nfs_get_error(client->context)); goto fail; } } else { ret = nfs_open(client->context, file, flags, &client->fh); if (ret < 0) { error_setg(errp, "Failed to open file : %s", nfs_get_error(client->context)); goto fail; } } ret = nfs_fstat(client->context, client->fh, &st); if (ret < 0) { error_setg(errp, "Failed to fstat file: %s", nfs_get_error(client->context)); goto fail; } ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE); client->st_blocks = st.st_blocks; client->has_zero_init = S_ISREG(st.st_mode); *strp = '/'; goto out; fail: nfs_client_close(client); out: qemu_opts_del(opts); g_free(file); return ret; }
{ "code": [ " int ret = -EINVAL;" ], "line_no": [ 7 ] }
static int64_t FUNC_0(NFSClient *client, QDict *options, int flags, int open_flags, Error **errp) { int VAR_0 = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat VAR_1; char *VAR_2 = NULL, *VAR_3 = NULL; qemu_mutex_init(&client->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); VAR_0 = -EINVAL; goto fail; } client->path = g_strdup(qemu_opt_get(opts, "path")); if (!client->path) { VAR_0 = -EINVAL; error_setg(errp, "No path was specified"); goto fail; } VAR_3 = strrchr(client->path, '/'); if (VAR_3 == NULL) { error_setg(errp, "Invalid URL specified"); goto fail; } VAR_2 = g_strdup(VAR_3); *VAR_3 = 0; client->server = nfs_config(options, errp); if (!client->server) { VAR_0 = -EINVAL; goto fail; } client->context = nfs_init_context(); if (client->context == NULL) { error_setg(errp, "Failed to init NFS context"); goto fail; } if (qemu_opt_get(opts, "user")) { client->uid = qemu_opt_get_number(opts, "user", 0); nfs_set_uid(client->context, client->uid); } if (qemu_opt_get(opts, "group")) { client->gid = qemu_opt_get_number(opts, "group", 0); nfs_set_gid(client->context, client->gid); } if (qemu_opt_get(opts, "tcp-syn-count")) { client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syn-count", 0); nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); } #ifdef LIBNFS_FEATURE_READAHEAD if (qemu_opt_get(opts, "readahead-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS readahead " "if cache.direct = on"); goto fail; } client->readahead = qemu_opt_get_number(opts, "readahead-size", 0); if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { warn_report("Truncating NFS readahead size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE; } nfs_set_readahead(client->context, client->readahead); #ifdef LIBNFS_FEATURE_PAGECACHE nfs_set_pagecache_ttl(client->context, 0); #endif client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_PAGECACHE if (qemu_opt_get(opts, "page-cache-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS pagecache " "if cache.direct = on"); goto fail; } client->pagecache = qemu_opt_get_number(opts, "page-cache-size", 0); if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { warn_report("Truncating NFS pagecache size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE; } nfs_set_pagecache(client->context, client->pagecache); nfs_set_pagecache_ttl(client->context, 0); client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_DEBUG if (qemu_opt_get(opts, "debug")) { client->debug = qemu_opt_get_number(opts, "debug", 0); if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) { warn_report("Limiting NFS debug level to %d", QEMU_NFS_MAX_DEBUG_LEVEL); client->debug = QEMU_NFS_MAX_DEBUG_LEVEL; } nfs_set_debug(client->context, client->debug); } #endif VAR_0 = nfs_mount(client->context, client->server->host, client->path); if (VAR_0 < 0) { error_setg(errp, "Failed to mount nfs share: %s", nfs_get_error(client->context)); goto fail; } if (flags & O_CREAT) { VAR_0 = nfs_creat(client->context, VAR_2, 0600, &client->fh); if (VAR_0 < 0) { error_setg(errp, "Failed to create VAR_2: %s", nfs_get_error(client->context)); goto fail; } } else { VAR_0 = nfs_open(client->context, VAR_2, flags, &client->fh); if (VAR_0 < 0) { error_setg(errp, "Failed to open VAR_2 : %s", nfs_get_error(client->context)); goto fail; } } VAR_0 = nfs_fstat(client->context, client->fh, &VAR_1); if (VAR_0 < 0) { error_setg(errp, "Failed to fstat VAR_2: %s", nfs_get_error(client->context)); goto fail; } VAR_0 = DIV_ROUND_UP(VAR_1.st_size, BDRV_SECTOR_SIZE); client->st_blocks = VAR_1.st_blocks; client->has_zero_init = S_ISREG(VAR_1.st_mode); *VAR_3 = '/'; goto out; fail: nfs_client_close(client); out: qemu_opts_del(opts); g_free(VAR_2); return VAR_0; }
[ "static int64_t FUNC_0(NFSClient *client, QDict *options,\nint flags, int open_flags, Error **errp)\n{", "int VAR_0 = -EINVAL;", "QemuOpts *opts = NULL;", "Error *local_err = NULL;", "struct stat VAR_1;", "char *VAR_2 = NULL, *VAR_3 = NULL;", "qemu_mutex_init(&client->mutex);", "opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, options, &local_err);", "if (local_err) {", "error_propagate(errp, local_err);", "VAR_0 = -EINVAL;", "goto fail;", "}", "client->path = g_strdup(qemu_opt_get(opts, \"path\"));", "if (!client->path) {", "VAR_0 = -EINVAL;", "error_setg(errp, \"No path was specified\");", "goto fail;", "}", "VAR_3 = strrchr(client->path, '/');", "if (VAR_3 == NULL) {", "error_setg(errp, \"Invalid URL specified\");", "goto fail;", "}", "VAR_2 = g_strdup(VAR_3);", "*VAR_3 = 0;", "client->server = nfs_config(options, errp);", "if (!client->server) {", "VAR_0 = -EINVAL;", "goto fail;", "}", "client->context = nfs_init_context();", "if (client->context == NULL) {", "error_setg(errp, \"Failed to init NFS context\");", "goto fail;", "}", "if (qemu_opt_get(opts, \"user\")) {", "client->uid = qemu_opt_get_number(opts, \"user\", 0);", "nfs_set_uid(client->context, client->uid);", "}", "if (qemu_opt_get(opts, \"group\")) {", "client->gid = qemu_opt_get_number(opts, \"group\", 0);", "nfs_set_gid(client->context, client->gid);", "}", "if (qemu_opt_get(opts, \"tcp-syn-count\")) {", "client->tcp_syncnt = qemu_opt_get_number(opts, \"tcp-syn-count\", 0);", "nfs_set_tcp_syncnt(client->context, client->tcp_syncnt);", "}", "#ifdef LIBNFS_FEATURE_READAHEAD\nif (qemu_opt_get(opts, \"readahead-size\")) {", "if (open_flags & BDRV_O_NOCACHE) {", "error_setg(errp, \"Cannot enable NFS readahead \"\n\"if cache.direct = on\");", "goto fail;", "}", "client->readahead = qemu_opt_get_number(opts, \"readahead-size\", 0);", "if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) {", "warn_report(\"Truncating NFS readahead size to %d\",\nQEMU_NFS_MAX_READAHEAD_SIZE);", "client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE;", "}", "nfs_set_readahead(client->context, client->readahead);", "#ifdef LIBNFS_FEATURE_PAGECACHE\nnfs_set_pagecache_ttl(client->context, 0);", "#endif\nclient->cache_used = true;", "}", "#endif\n#ifdef LIBNFS_FEATURE_PAGECACHE\nif (qemu_opt_get(opts, \"page-cache-size\")) {", "if (open_flags & BDRV_O_NOCACHE) {", "error_setg(errp, \"Cannot enable NFS pagecache \"\n\"if cache.direct = on\");", "goto fail;", "}", "client->pagecache = qemu_opt_get_number(opts, \"page-cache-size\", 0);", "if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) {", "warn_report(\"Truncating NFS pagecache size to %d pages\",\nQEMU_NFS_MAX_PAGECACHE_SIZE);", "client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE;", "}", "nfs_set_pagecache(client->context, client->pagecache);", "nfs_set_pagecache_ttl(client->context, 0);", "client->cache_used = true;", "}", "#endif\n#ifdef LIBNFS_FEATURE_DEBUG\nif (qemu_opt_get(opts, \"debug\")) {", "client->debug = qemu_opt_get_number(opts, \"debug\", 0);", "if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) {", "warn_report(\"Limiting NFS debug level to %d\",\nQEMU_NFS_MAX_DEBUG_LEVEL);", "client->debug = QEMU_NFS_MAX_DEBUG_LEVEL;", "}", "nfs_set_debug(client->context, client->debug);", "}", "#endif\nVAR_0 = nfs_mount(client->context, client->server->host, client->path);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to mount nfs share: %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "if (flags & O_CREAT) {", "VAR_0 = nfs_creat(client->context, VAR_2, 0600, &client->fh);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to create VAR_2: %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "} else {", "VAR_0 = nfs_open(client->context, VAR_2, flags, &client->fh);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to open VAR_2 : %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "}", "VAR_0 = nfs_fstat(client->context, client->fh, &VAR_1);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to fstat VAR_2: %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "VAR_0 = DIV_ROUND_UP(VAR_1.st_size, BDRV_SECTOR_SIZE);", "client->st_blocks = VAR_1.st_blocks;", "client->has_zero_init = S_ISREG(VAR_1.st_mode);", "*VAR_3 = '/';", "goto out;", "fail:\nnfs_client_close(client);", "out:\nqemu_opts_del(opts);", "g_free(VAR_2);", "return VAR_0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 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 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 203, 205 ], [ 207 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 231 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303, 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ] ]
9,778
ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags) { if (so->s == -1 && so->extra) { qemu_chr_fe_write(so->extra, buf, len); return len; } return send(so->s, buf, len, flags); }
true
qemu
6ab3fc32ea640026726bc5f9f4db622d0954fb8a
ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags) { if (so->s == -1 && so->extra) { qemu_chr_fe_write(so->extra, buf, len); return len; } return send(so->s, buf, len, flags); }
{ "code": [ " qemu_chr_fe_write(so->extra, buf, len);" ], "line_no": [ 7 ] }
ssize_t FUNC_0(struct socket *so, const void *buf, size_t len, int flags) { if (so->s == -1 && so->extra) { qemu_chr_fe_write(so->extra, buf, len); return len; } return send(so->s, buf, len, flags); }
[ "ssize_t FUNC_0(struct socket *so, const void *buf, size_t len, int flags)\n{", "if (so->s == -1 && so->extra) {", "qemu_chr_fe_write(so->extra, buf, len);", "return len;", "}", "return send(so->s, buf, len, flags);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
9,782
static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) { int x, y, d=0; for (y = 8; y; y--) { for (x = 8; x; x--) { d += abs(new[x] - old[x]); } new += ns; old += os; } return d; }
true
FFmpeg
6c0107822d3ed7588fa857c3ed1ee886b4ba62e9
static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) { int x, y, d=0; for (y = 8; y; y--) { for (x = 8; x; x--) { d += abs(new[x] - old[x]); } new += ns; old += os; } return d; }
{ "code": [ " for (y = 8; y; y--) {", " for (x = 8; x; x--) {" ], "line_no": [ 7, 9 ] }
static int FUNC_0(unsigned char *VAR_0, unsigned char *VAR_1, int VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6=0; for (VAR_5 = 8; VAR_5; VAR_5--) { for (VAR_4 = 8; VAR_4; VAR_4--) { VAR_6 += abs(VAR_1[VAR_4] - VAR_0[VAR_4]); } VAR_1 += VAR_3; VAR_0 += VAR_2; } return VAR_6; }
[ "static int FUNC_0(unsigned char *VAR_0, unsigned char *VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6=0;", "for (VAR_5 = 8; VAR_5; VAR_5--) {", "for (VAR_4 = 8; VAR_4; VAR_4--) {", "VAR_6 += abs(VAR_1[VAR_4] - VAR_0[VAR_4]);", "}", "VAR_1 += VAR_3;", "VAR_0 += VAR_2;", "}", "return VAR_6;", "}" ]
[ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
9,783
void do_icbi (void) { uint32_t tmp; /* Invalidate one cache line : * PowerPC specification says this is to be treated like a load * (not a fetch) by the MMU. To be sure it will be so, * do the load "by hand". */ #if defined(TARGET_PPC64) if (!msr_sf) T0 &= 0xFFFFFFFFULL; #endif tmp = ldl_kernel(T0); T0 &= ~(ICACHE_LINE_SIZE - 1); tb_invalidate_page_range(T0, T0 + ICACHE_LINE_SIZE); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void do_icbi (void) { uint32_t tmp; #if defined(TARGET_PPC64) if (!msr_sf) T0 &= 0xFFFFFFFFULL; #endif tmp = ldl_kernel(T0); T0 &= ~(ICACHE_LINE_SIZE - 1); tb_invalidate_page_range(T0, T0 + ICACHE_LINE_SIZE); }
{ "code": [ " if (!msr_sf)", " T0 &= 0xFFFFFFFFULL;", "#endif", " tmp = ldl_kernel(T0);", " tb_invalidate_page_range(T0, T0 + ICACHE_LINE_SIZE);", "#endif" ], "line_no": [ 19, 21, 23, 25, 29, 23 ] }
void FUNC_0 (void) { uint32_t tmp; #if defined(TARGET_PPC64) if (!msr_sf) T0 &= 0xFFFFFFFFULL; #endif tmp = ldl_kernel(T0); T0 &= ~(ICACHE_LINE_SIZE - 1); tb_invalidate_page_range(T0, T0 + ICACHE_LINE_SIZE); }
[ "void FUNC_0 (void)\n{", "uint32_t tmp;", "#if defined(TARGET_PPC64)\nif (!msr_sf)\nT0 &= 0xFFFFFFFFULL;", "#endif\ntmp = ldl_kernel(T0);", "T0 &= ~(ICACHE_LINE_SIZE - 1);", "tb_invalidate_page_range(T0, T0 + ICACHE_LINE_SIZE);", "}" ]
[ 0, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 17, 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ] ]
9,784
static int xen_pt_register_regions(XenPCIPassthroughState *s) { int i = 0; XenHostPCIDevice *d = &s->real_device; /* Register PIO/MMIO BARs */ for (i = 0; i < PCI_ROM_SLOT; i++) { XenHostPCIIORegion *r = &d->io_regions[i]; uint8_t type; if (r->base_addr == 0 || r->size == 0) { continue; } s->bases[i].access.u = r->base_addr; if (r->type & XEN_HOST_PCI_REGION_TYPE_IO) { type = PCI_BASE_ADDRESS_SPACE_IO; } else { type = PCI_BASE_ADDRESS_SPACE_MEMORY; if (r->type & XEN_HOST_PCI_REGION_TYPE_PREFETCH) { type |= PCI_BASE_ADDRESS_MEM_PREFETCH; } if (r->type & XEN_HOST_PCI_REGION_TYPE_MEM_64) { type |= PCI_BASE_ADDRESS_MEM_TYPE_64; } } memory_region_init_io(&s->bar[i], OBJECT(s), &ops, &s->dev, "xen-pci-pt-bar", r->size); pci_register_bar(&s->dev, i, type, &s->bar[i]); XEN_PT_LOG(&s->dev, "IO region %i registered (size=0x%08"PRIx64 " base_addr=0x%08"PRIx64" type: %#x)\n", i, r->size, r->base_addr, type); } /* Register expansion ROM address */ if (d->rom.base_addr && d->rom.size) { uint32_t bar_data = 0; /* Re-set BAR reported by OS, otherwise ROM can't be read. */ if (xen_host_pci_get_long(d, PCI_ROM_ADDRESS, &bar_data)) { return 0; } if ((bar_data & PCI_ROM_ADDRESS_MASK) == 0) { bar_data |= d->rom.base_addr & PCI_ROM_ADDRESS_MASK; xen_host_pci_set_long(d, PCI_ROM_ADDRESS, bar_data); } s->bases[PCI_ROM_SLOT].access.maddr = d->rom.base_addr; memory_region_init_io(&s->rom, OBJECT(s), &ops, &s->dev, "xen-pci-pt-rom", d->rom.size); pci_register_bar(&s->dev, PCI_ROM_SLOT, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->rom); XEN_PT_LOG(&s->dev, "Expansion ROM registered (size=0x%08"PRIx64 " base_addr=0x%08"PRIx64")\n", d->rom.size, d->rom.base_addr); } return 0; }
true
qemu
81b23ef82cd1be29ca3d69ab7e98b5b5e55926ce
static int xen_pt_register_regions(XenPCIPassthroughState *s) { int i = 0; XenHostPCIDevice *d = &s->real_device; for (i = 0; i < PCI_ROM_SLOT; i++) { XenHostPCIIORegion *r = &d->io_regions[i]; uint8_t type; if (r->base_addr == 0 || r->size == 0) { continue; } s->bases[i].access.u = r->base_addr; if (r->type & XEN_HOST_PCI_REGION_TYPE_IO) { type = PCI_BASE_ADDRESS_SPACE_IO; } else { type = PCI_BASE_ADDRESS_SPACE_MEMORY; if (r->type & XEN_HOST_PCI_REGION_TYPE_PREFETCH) { type |= PCI_BASE_ADDRESS_MEM_PREFETCH; } if (r->type & XEN_HOST_PCI_REGION_TYPE_MEM_64) { type |= PCI_BASE_ADDRESS_MEM_TYPE_64; } } memory_region_init_io(&s->bar[i], OBJECT(s), &ops, &s->dev, "xen-pci-pt-bar", r->size); pci_register_bar(&s->dev, i, type, &s->bar[i]); XEN_PT_LOG(&s->dev, "IO region %i registered (size=0x%08"PRIx64 " base_addr=0x%08"PRIx64" type: %#x)\n", i, r->size, r->base_addr, type); } if (d->rom.base_addr && d->rom.size) { uint32_t bar_data = 0; if (xen_host_pci_get_long(d, PCI_ROM_ADDRESS, &bar_data)) { return 0; } if ((bar_data & PCI_ROM_ADDRESS_MASK) == 0) { bar_data |= d->rom.base_addr & PCI_ROM_ADDRESS_MASK; xen_host_pci_set_long(d, PCI_ROM_ADDRESS, bar_data); } s->bases[PCI_ROM_SLOT].access.maddr = d->rom.base_addr; memory_region_init_io(&s->rom, OBJECT(s), &ops, &s->dev, "xen-pci-pt-rom", d->rom.size); pci_register_bar(&s->dev, PCI_ROM_SLOT, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->rom); XEN_PT_LOG(&s->dev, "Expansion ROM registered (size=0x%08"PRIx64 " base_addr=0x%08"PRIx64")\n", d->rom.size, d->rom.base_addr); } return 0; }
{ "code": [ "static int xen_pt_register_regions(XenPCIPassthroughState *s)", " return 0;" ], "line_no": [ 1, 125 ] }
static int FUNC_0(XenPCIPassthroughState *VAR_0) { int VAR_1 = 0; XenHostPCIDevice *d = &VAR_0->real_device; for (VAR_1 = 0; VAR_1 < PCI_ROM_SLOT; VAR_1++) { XenHostPCIIORegion *r = &d->io_regions[VAR_1]; uint8_t type; if (r->base_addr == 0 || r->size == 0) { continue; } VAR_0->bases[VAR_1].access.u = r->base_addr; if (r->type & XEN_HOST_PCI_REGION_TYPE_IO) { type = PCI_BASE_ADDRESS_SPACE_IO; } else { type = PCI_BASE_ADDRESS_SPACE_MEMORY; if (r->type & XEN_HOST_PCI_REGION_TYPE_PREFETCH) { type |= PCI_BASE_ADDRESS_MEM_PREFETCH; } if (r->type & XEN_HOST_PCI_REGION_TYPE_MEM_64) { type |= PCI_BASE_ADDRESS_MEM_TYPE_64; } } memory_region_init_io(&VAR_0->bar[VAR_1], OBJECT(VAR_0), &ops, &VAR_0->dev, "xen-pci-pt-bar", r->size); pci_register_bar(&VAR_0->dev, VAR_1, type, &VAR_0->bar[VAR_1]); XEN_PT_LOG(&VAR_0->dev, "IO region %VAR_1 registered (size=0x%08"PRIx64 " base_addr=0x%08"PRIx64" type: %#x)\n", VAR_1, r->size, r->base_addr, type); } if (d->rom.base_addr && d->rom.size) { uint32_t bar_data = 0; if (xen_host_pci_get_long(d, PCI_ROM_ADDRESS, &bar_data)) { return 0; } if ((bar_data & PCI_ROM_ADDRESS_MASK) == 0) { bar_data |= d->rom.base_addr & PCI_ROM_ADDRESS_MASK; xen_host_pci_set_long(d, PCI_ROM_ADDRESS, bar_data); } VAR_0->bases[PCI_ROM_SLOT].access.maddr = d->rom.base_addr; memory_region_init_io(&VAR_0->rom, OBJECT(VAR_0), &ops, &VAR_0->dev, "xen-pci-pt-rom", d->rom.size); pci_register_bar(&VAR_0->dev, PCI_ROM_SLOT, PCI_BASE_ADDRESS_MEM_PREFETCH, &VAR_0->rom); XEN_PT_LOG(&VAR_0->dev, "Expansion ROM registered (size=0x%08"PRIx64 " base_addr=0x%08"PRIx64")\n", d->rom.size, d->rom.base_addr); } return 0; }
[ "static int FUNC_0(XenPCIPassthroughState *VAR_0)\n{", "int VAR_1 = 0;", "XenHostPCIDevice *d = &VAR_0->real_device;", "for (VAR_1 = 0; VAR_1 < PCI_ROM_SLOT; VAR_1++) {", "XenHostPCIIORegion *r = &d->io_regions[VAR_1];", "uint8_t type;", "if (r->base_addr == 0 || r->size == 0) {", "continue;", "}", "VAR_0->bases[VAR_1].access.u = r->base_addr;", "if (r->type & XEN_HOST_PCI_REGION_TYPE_IO) {", "type = PCI_BASE_ADDRESS_SPACE_IO;", "} else {", "type = PCI_BASE_ADDRESS_SPACE_MEMORY;", "if (r->type & XEN_HOST_PCI_REGION_TYPE_PREFETCH) {", "type |= PCI_BASE_ADDRESS_MEM_PREFETCH;", "}", "if (r->type & XEN_HOST_PCI_REGION_TYPE_MEM_64) {", "type |= PCI_BASE_ADDRESS_MEM_TYPE_64;", "}", "}", "memory_region_init_io(&VAR_0->bar[VAR_1], OBJECT(VAR_0), &ops, &VAR_0->dev,\n\"xen-pci-pt-bar\", r->size);", "pci_register_bar(&VAR_0->dev, VAR_1, type, &VAR_0->bar[VAR_1]);", "XEN_PT_LOG(&VAR_0->dev, \"IO region %VAR_1 registered (size=0x%08\"PRIx64\n\" base_addr=0x%08\"PRIx64\" type: %#x)\\n\",\nVAR_1, r->size, r->base_addr, type);", "}", "if (d->rom.base_addr && d->rom.size) {", "uint32_t bar_data = 0;", "if (xen_host_pci_get_long(d, PCI_ROM_ADDRESS, &bar_data)) {", "return 0;", "}", "if ((bar_data & PCI_ROM_ADDRESS_MASK) == 0) {", "bar_data |= d->rom.base_addr & PCI_ROM_ADDRESS_MASK;", "xen_host_pci_set_long(d, PCI_ROM_ADDRESS, bar_data);", "}", "VAR_0->bases[PCI_ROM_SLOT].access.maddr = d->rom.base_addr;", "memory_region_init_io(&VAR_0->rom, OBJECT(VAR_0), &ops, &VAR_0->dev,\n\"xen-pci-pt-rom\", d->rom.size);", "pci_register_bar(&VAR_0->dev, PCI_ROM_SLOT, PCI_BASE_ADDRESS_MEM_PREFETCH,\n&VAR_0->rom);", "XEN_PT_LOG(&VAR_0->dev, \"Expansion ROM registered (size=0x%08\"PRIx64\n\" base_addr=0x%08\"PRIx64\")\\n\",\nd->rom.size, d->rom.base_addr);", "}", "return 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, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 65, 67, 69 ], [ 71 ], [ 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105, 107 ], [ 109, 111 ], [ 115, 117, 119 ], [ 121 ], [ 125 ], [ 127 ] ]
9,785
void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector, int nr_sectors) { BdrvDirtyBitmap *bitmap; QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) { hbitmap_set(bitmap->bitmap, cur_sector, nr_sectors); } }
true
qemu
c4237dfa635900e4d1cdc6038d5efe3507f45f0c
void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector, int nr_sectors) { BdrvDirtyBitmap *bitmap; QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) { hbitmap_set(bitmap->bitmap, cur_sector, nr_sectors); } }
{ "code": [ "void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector,", " int nr_sectors)" ], "line_no": [ 1, 3 ] }
void FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2) { BdrvDirtyBitmap *bitmap; QLIST_FOREACH(bitmap, &VAR_0->dirty_bitmaps, list) { hbitmap_set(bitmap->bitmap, VAR_1, VAR_2); } }
[ "void FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nint VAR_2)\n{", "BdrvDirtyBitmap *bitmap;", "QLIST_FOREACH(bitmap, &VAR_0->dirty_bitmaps, list) {", "hbitmap_set(bitmap->bitmap, VAR_1, VAR_2);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
9,786
av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6; dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; dsp->vp8_idct_add = ff_vp8_idct_add_armv6; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6; }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6; dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; dsp->vp8_idct_add = ff_vp8_idct_add_armv6; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6; }
{ "code": [ "av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp)", " dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6;", " dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6;", " dsp->vp8_idct_add = ff_vp8_idct_add_armv6;", " dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6;", " dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6;", " dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6;", " dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6;", " dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6;", " dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6;", " dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6;", " dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6;", " dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6;", " dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6;", " dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6;", " dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6;", " dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6;" ], "line_no": [ 1, 5, 7, 11, 13, 15, 17, 21, 23, 25, 27, 31, 33, 35, 37, 41, 43 ] }
av_cold void FUNC_0(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6; dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; dsp->vp8_idct_add = ff_vp8_idct_add_armv6; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6; }
[ "av_cold void FUNC_0(VP8DSPContext *dsp)\n{", "dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6;", "dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6;", "dsp->vp8_idct_add = ff_vp8_idct_add_armv6;", "dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6;", "dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6;", "dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6;", "dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6;", "dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6;", "dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6;", "dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6;", "dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6;", "dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6;", "dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6;", "dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6;", "dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6;", "dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6;", "dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6;", "dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6;", "dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6;", "dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6;", "dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6;", "dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6;", "dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6;", "dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6;", "dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6;", "dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6;", "dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6;", "dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6;", "dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6;", "dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6;", "dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6;", "dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6;", "dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6;", "dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6;", "dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6;", "dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6;", "dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6;", "dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6;", "dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ] ]
9,788
static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) { #if defined(TARGET_I386) cpu_synchronize_state(s->c_cpu); s->c_cpu->eip = pc; #elif defined (TARGET_PPC) s->c_cpu->nip = pc; #elif defined (TARGET_SPARC) s->c_cpu->npc = pc + 4; #elif defined (TARGET_ARM) s->c_cpu->regs[15] = pc; #elif defined (TARGET_SH4) #elif defined (TARGET_MIPS) s->c_cpu->active_tc.PC = pc & ~(target_ulong)1; if (pc & 1) { s->c_cpu->hflags |= MIPS_HFLAG_M16; } else { s->c_cpu->hflags &= ~(MIPS_HFLAG_M16); } #elif defined (TARGET_MICROBLAZE) s->c_cpu->sregs[SR_PC] = pc; #elif defined (TARGET_CRIS) #elif defined (TARGET_ALPHA) #elif defined (TARGET_S390X) cpu_synchronize_state(s->c_cpu); s->c_cpu->psw.addr = pc; #elif defined (TARGET_LM32) #endif }
true
qemu
ccfcaba6fd9f69a9322af1911302e71127bee1e0
static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) { #if defined(TARGET_I386) cpu_synchronize_state(s->c_cpu); s->c_cpu->eip = pc; #elif defined (TARGET_PPC) s->c_cpu->nip = pc; #elif defined (TARGET_SPARC) s->c_cpu->npc = pc + 4; #elif defined (TARGET_ARM) s->c_cpu->regs[15] = pc; #elif defined (TARGET_SH4) #elif defined (TARGET_MIPS) s->c_cpu->active_tc.PC = pc & ~(target_ulong)1; if (pc & 1) { s->c_cpu->hflags |= MIPS_HFLAG_M16; } else { s->c_cpu->hflags &= ~(MIPS_HFLAG_M16); } #elif defined (TARGET_MICROBLAZE) s->c_cpu->sregs[SR_PC] = pc; #elif defined (TARGET_CRIS) #elif defined (TARGET_ALPHA) #elif defined (TARGET_S390X) cpu_synchronize_state(s->c_cpu); s->c_cpu->psw.addr = pc; #elif defined (TARGET_LM32) #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(GDBState *VAR_0, target_ulong VAR_1) { #if defined(TARGET_I386) cpu_synchronize_state(VAR_0->c_cpu); VAR_0->c_cpu->eip = VAR_1; #elif defined (TARGET_PPC) VAR_0->c_cpu->nip = VAR_1; #elif defined (TARGET_SPARC) VAR_0->c_cpu->npc = VAR_1 + 4; #elif defined (TARGET_ARM) VAR_0->c_cpu->regs[15] = VAR_1; #elif defined (TARGET_SH4) #elif defined (TARGET_MIPS) VAR_0->c_cpu->active_tc.PC = VAR_1 & ~(target_ulong)1; if (VAR_1 & 1) { VAR_0->c_cpu->hflags |= MIPS_HFLAG_M16; } else { VAR_0->c_cpu->hflags &= ~(MIPS_HFLAG_M16); } #elif defined (TARGET_MICROBLAZE) VAR_0->c_cpu->sregs[SR_PC] = VAR_1; #elif defined (TARGET_CRIS) #elif defined (TARGET_ALPHA) #elif defined (TARGET_S390X) cpu_synchronize_state(VAR_0->c_cpu); VAR_0->c_cpu->psw.addr = VAR_1; #elif defined (TARGET_LM32) #endif }
[ "static void FUNC_0(GDBState *VAR_0, target_ulong VAR_1)\n{", "#if defined(TARGET_I386)\ncpu_synchronize_state(VAR_0->c_cpu);", "VAR_0->c_cpu->eip = VAR_1;", "#elif defined (TARGET_PPC)\nVAR_0->c_cpu->nip = VAR_1;", "#elif defined (TARGET_SPARC)\nVAR_0->c_cpu->npc = VAR_1 + 4;", "#elif defined (TARGET_ARM)\nVAR_0->c_cpu->regs[15] = VAR_1;", "#elif defined (TARGET_SH4)\n#elif defined (TARGET_MIPS)\nVAR_0->c_cpu->active_tc.PC = VAR_1 & ~(target_ulong)1;", "if (VAR_1 & 1) {", "VAR_0->c_cpu->hflags |= MIPS_HFLAG_M16;", "} else {", "VAR_0->c_cpu->hflags &= ~(MIPS_HFLAG_M16);", "}", "#elif defined (TARGET_MICROBLAZE)\nVAR_0->c_cpu->sregs[SR_PC] = VAR_1;", "#elif defined (TARGET_CRIS)\n#elif defined (TARGET_ALPHA)\n#elif defined (TARGET_S390X)\ncpu_synchronize_state(VAR_0->c_cpu);", "VAR_0->c_cpu->psw.addr = VAR_1;", "#elif defined (TARGET_LM32)\n#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, 18 ], [ 20, 22 ], [ 24, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 48, 51, 53 ], [ 55 ], [ 57, 62, 64 ] ]
9,790
void hid_reset(HIDState *hs) { switch (hs->kind) { case HID_KEYBOARD: memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes)); memset(hs->kbd.key, 0, sizeof(hs->kbd.key)); hs->kbd.keys = 0; break; case HID_MOUSE: case HID_TABLET: memset(hs->ptr.queue, 0, sizeof(hs->ptr.queue)); break; } hs->head = 0; hs->n = 0; hs->protocol = 1; hs->idle = 0; hs->idle_pending = false; hid_del_idle_timer(hs); }
true
qemu
51dbea77a29ea46173373a6dad4ebd95d4661f42
void hid_reset(HIDState *hs) { switch (hs->kind) { case HID_KEYBOARD: memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes)); memset(hs->kbd.key, 0, sizeof(hs->kbd.key)); hs->kbd.keys = 0; break; case HID_MOUSE: case HID_TABLET: memset(hs->ptr.queue, 0, sizeof(hs->ptr.queue)); break; } hs->head = 0; hs->n = 0; hs->protocol = 1; hs->idle = 0; hs->idle_pending = false; hid_del_idle_timer(hs); }
{ "code": [], "line_no": [] }
void FUNC_0(HIDState *VAR_0) { switch (VAR_0->kind) { case HID_KEYBOARD: memset(VAR_0->kbd.keycodes, 0, sizeof(VAR_0->kbd.keycodes)); memset(VAR_0->kbd.key, 0, sizeof(VAR_0->kbd.key)); VAR_0->kbd.keys = 0; break; case HID_MOUSE: case HID_TABLET: memset(VAR_0->ptr.queue, 0, sizeof(VAR_0->ptr.queue)); break; } VAR_0->head = 0; VAR_0->n = 0; VAR_0->protocol = 1; VAR_0->idle = 0; VAR_0->idle_pending = false; hid_del_idle_timer(VAR_0); }
[ "void FUNC_0(HIDState *VAR_0)\n{", "switch (VAR_0->kind) {", "case HID_KEYBOARD:\nmemset(VAR_0->kbd.keycodes, 0, sizeof(VAR_0->kbd.keycodes));", "memset(VAR_0->kbd.key, 0, sizeof(VAR_0->kbd.key));", "VAR_0->kbd.keys = 0;", "break;", "case HID_MOUSE:\ncase HID_TABLET:\nmemset(VAR_0->ptr.queue, 0, sizeof(VAR_0->ptr.queue));", "break;", "}", "VAR_0->head = 0;", "VAR_0->n = 0;", "VAR_0->protocol = 1;", "VAR_0->idle = 0;", "VAR_0->idle_pending = false;", "hid_del_idle_timer(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 16 ], [ 18, 20, 22 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ] ]
9,791
av_cold int avcodec_close(AVCodecContext *avctx) { /* If there is a user-supplied mutex locking routine, call it. */ if (ff_lockmgr_cb) { if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; } entangled_thread_counter++; if (entangled_thread_counter != 1) { av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); entangled_thread_counter--; return -1; } if (avcodec_is_open(avctx)) { if (HAVE_THREADS && avctx->internal->frame_thread_encoder && avctx->thread_count > 1) { entangled_thread_counter --; ff_frame_thread_encoder_free(avctx); entangled_thread_counter ++; } if (HAVE_THREADS && avctx->thread_opaque) ff_thread_free(avctx); if (avctx->codec && avctx->codec->close) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx); avctx->coded_frame = NULL; avctx->internal->byte_buffer_size = 0; av_freep(&avctx->internal->byte_buffer); av_freep(&avctx->internal); } if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) av_opt_free(avctx->priv_data); av_opt_free(avctx); av_freep(&avctx->priv_data); if (av_codec_is_encoder(avctx->codec)) av_freep(&avctx->extradata); avctx->codec = NULL; avctx->active_thread_type = 0; entangled_thread_counter--; /* Release any user-supplied mutex. */ if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); } return 0; }
true
FFmpeg
6fb2fd895e858ab93f46e656a322778ee181c307
av_cold int avcodec_close(AVCodecContext *avctx) { if (ff_lockmgr_cb) { if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; } entangled_thread_counter++; if (entangled_thread_counter != 1) { av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); entangled_thread_counter--; return -1; } if (avcodec_is_open(avctx)) { if (HAVE_THREADS && avctx->internal->frame_thread_encoder && avctx->thread_count > 1) { entangled_thread_counter --; ff_frame_thread_encoder_free(avctx); entangled_thread_counter ++; } if (HAVE_THREADS && avctx->thread_opaque) ff_thread_free(avctx); if (avctx->codec && avctx->codec->close) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx); avctx->coded_frame = NULL; avctx->internal->byte_buffer_size = 0; av_freep(&avctx->internal->byte_buffer); av_freep(&avctx->internal); } if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) av_opt_free(avctx->priv_data); av_opt_free(avctx); av_freep(&avctx->priv_data); if (av_codec_is_encoder(avctx->codec)) av_freep(&avctx->extradata); avctx->codec = NULL; avctx->active_thread_type = 0; entangled_thread_counter--; if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); } return 0; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(AVCodecContext *avctx) { if (ff_lockmgr_cb) { if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; } entangled_thread_counter++; if (entangled_thread_counter != 1) { av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); entangled_thread_counter--; return -1; } if (avcodec_is_open(avctx)) { if (HAVE_THREADS && avctx->internal->frame_thread_encoder && avctx->thread_count > 1) { entangled_thread_counter --; ff_frame_thread_encoder_free(avctx); entangled_thread_counter ++; } if (HAVE_THREADS && avctx->thread_opaque) ff_thread_free(avctx); if (avctx->codec && avctx->codec->close) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx); avctx->coded_frame = NULL; avctx->internal->byte_buffer_size = 0; av_freep(&avctx->internal->byte_buffer); av_freep(&avctx->internal); } if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) av_opt_free(avctx->priv_data); av_opt_free(avctx); av_freep(&avctx->priv_data); if (av_codec_is_encoder(avctx->codec)) av_freep(&avctx->extradata); avctx->codec = NULL; avctx->active_thread_type = 0; entangled_thread_counter--; if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); } return 0; }
[ "av_cold int FUNC_0(AVCodecContext *avctx)\n{", "if (ff_lockmgr_cb) {", "if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))\nreturn -1;", "}", "entangled_thread_counter++;", "if (entangled_thread_counter != 1) {", "av_log(avctx, AV_LOG_ERROR, \"insufficient thread locking around avcodec_open/close()\\n\");", "entangled_thread_counter--;", "return -1;", "}", "if (avcodec_is_open(avctx)) {", "if (HAVE_THREADS && avctx->internal->frame_thread_encoder && avctx->thread_count > 1) {", "entangled_thread_counter --;", "ff_frame_thread_encoder_free(avctx);", "entangled_thread_counter ++;", "}", "if (HAVE_THREADS && avctx->thread_opaque)\nff_thread_free(avctx);", "if (avctx->codec && avctx->codec->close)\navctx->codec->close(avctx);", "avcodec_default_free_buffers(avctx);", "avctx->coded_frame = NULL;", "avctx->internal->byte_buffer_size = 0;", "av_freep(&avctx->internal->byte_buffer);", "av_freep(&avctx->internal);", "}", "if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)\nav_opt_free(avctx->priv_data);", "av_opt_free(avctx);", "av_freep(&avctx->priv_data);", "if (av_codec_is_encoder(avctx->codec))\nav_freep(&avctx->extradata);", "avctx->codec = NULL;", "avctx->active_thread_type = 0;", "entangled_thread_counter--;", "if (ff_lockmgr_cb) {", "(*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);", "}", "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 ]
[ [ 1, 3 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 62 ], [ 66, 68 ], [ 70 ], [ 72 ], [ 74, 76 ], [ 78 ], [ 80 ], [ 82 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ] ]
9,792
static SCSIDiskReq *scsi_find_request(SCSIDiskState *s, uint32_t tag) { return DO_UPCAST(SCSIDiskReq, req, scsi_req_find(&s->qdev, tag)); }
true
qemu
5c6c0e513600ba57c3e73b7151d3c0664438f7b5
static SCSIDiskReq *scsi_find_request(SCSIDiskState *s, uint32_t tag) { return DO_UPCAST(SCSIDiskReq, req, scsi_req_find(&s->qdev, tag)); }
{ "code": [ "static SCSIDiskReq *scsi_find_request(SCSIDiskState *s, uint32_t tag)", " return DO_UPCAST(SCSIDiskReq, req, scsi_req_find(&s->qdev, tag));" ], "line_no": [ 1, 5 ] }
static SCSIDiskReq *FUNC_0(SCSIDiskState *s, uint32_t tag) { return DO_UPCAST(SCSIDiskReq, req, scsi_req_find(&s->qdev, tag)); }
[ "static SCSIDiskReq *FUNC_0(SCSIDiskState *s, uint32_t tag)\n{", "return DO_UPCAST(SCSIDiskReq, req, scsi_req_find(&s->qdev, tag));", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
9,794
static ssize_t sdp_svc_search(struct bt_l2cap_sdp_state_s *sdp, uint8_t *rsp, const uint8_t *req, ssize_t len) { ssize_t seqlen; int i, count, start, end, max; int32_t handle; /* Perform the search */ for (i = 0; i < sdp->services; i ++) sdp->service_list[i].match = 0; if (len < 1) return -SDP_INVALID_SYNTAX; if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) { seqlen = sdp_datalen(&req, &len); if (seqlen < 3 || len < seqlen) return -SDP_INVALID_SYNTAX; len -= seqlen; while (seqlen) if (sdp_svc_match(sdp, &req, &seqlen)) return -SDP_INVALID_SYNTAX; } else if (sdp_svc_match(sdp, &req, &seqlen)) return -SDP_INVALID_SYNTAX; if (len < 3) return -SDP_INVALID_SYNTAX; max = (req[0] << 8) | req[1]; req += 2; len -= 2; if (*req) { if (len <= sizeof(int)) return -SDP_INVALID_SYNTAX; len -= sizeof(int); memcpy(&start, req + 1, sizeof(int)); } else start = 0; if (len > 1) return -SDP_INVALID_SYNTAX; /* Output the results */ len = 4; count = 0; end = start; for (i = 0; i < sdp->services; i ++) if (sdp->service_list[i].match) { if (count >= start && count < max && len + 4 < MAX_RSP_PARAM_SIZE) { handle = i; memcpy(rsp + len, &handle, 4); len += 4; end = count + 1; } count ++; } rsp[0] = count >> 8; rsp[1] = count & 0xff; rsp[2] = (end - start) >> 8; rsp[3] = (end - start) & 0xff; if (end < count) { rsp[len ++] = sizeof(int); memcpy(rsp + len, &end, sizeof(int)); len += 4; } else rsp[len ++] = 0; return len; }
true
qemu
374ec0669a1aa3affac7850a16c6cad18221c439
static ssize_t sdp_svc_search(struct bt_l2cap_sdp_state_s *sdp, uint8_t *rsp, const uint8_t *req, ssize_t len) { ssize_t seqlen; int i, count, start, end, max; int32_t handle; for (i = 0; i < sdp->services; i ++) sdp->service_list[i].match = 0; if (len < 1) return -SDP_INVALID_SYNTAX; if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) { seqlen = sdp_datalen(&req, &len); if (seqlen < 3 || len < seqlen) return -SDP_INVALID_SYNTAX; len -= seqlen; while (seqlen) if (sdp_svc_match(sdp, &req, &seqlen)) return -SDP_INVALID_SYNTAX; } else if (sdp_svc_match(sdp, &req, &seqlen)) return -SDP_INVALID_SYNTAX; if (len < 3) return -SDP_INVALID_SYNTAX; max = (req[0] << 8) | req[1]; req += 2; len -= 2; if (*req) { if (len <= sizeof(int)) return -SDP_INVALID_SYNTAX; len -= sizeof(int); memcpy(&start, req + 1, sizeof(int)); } else start = 0; if (len > 1) return -SDP_INVALID_SYNTAX; len = 4; count = 0; end = start; for (i = 0; i < sdp->services; i ++) if (sdp->service_list[i].match) { if (count >= start && count < max && len + 4 < MAX_RSP_PARAM_SIZE) { handle = i; memcpy(rsp + len, &handle, 4); len += 4; end = count + 1; } count ++; } rsp[0] = count >> 8; rsp[1] = count & 0xff; rsp[2] = (end - start) >> 8; rsp[3] = (end - start) & 0xff; if (end < count) { rsp[len ++] = sizeof(int); memcpy(rsp + len, &end, sizeof(int)); len += 4; } else rsp[len ++] = 0; return len; }
{ "code": [ " } else if (sdp_svc_match(sdp, &req, &seqlen))", " return -SDP_INVALID_SYNTAX;", " return -SDP_INVALID_SYNTAX;", " } else if (sdp_svc_match(sdp, &req, &seqlen))", " return -SDP_INVALID_SYNTAX;", " return -SDP_INVALID_SYNTAX;" ], "line_no": [ 45, 25, 25, 45, 25, 25 ] }
static ssize_t FUNC_0(struct bt_l2cap_sdp_state_s *sdp, uint8_t *rsp, const uint8_t *req, ssize_t len) { ssize_t seqlen; int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4; int32_t handle; for (VAR_0 = 0; VAR_0 < sdp->services; VAR_0 ++) sdp->service_list[VAR_0].match = 0; if (len < 1) return -SDP_INVALID_SYNTAX; if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) { seqlen = sdp_datalen(&req, &len); if (seqlen < 3 || len < seqlen) return -SDP_INVALID_SYNTAX; len -= seqlen; while (seqlen) if (sdp_svc_match(sdp, &req, &seqlen)) return -SDP_INVALID_SYNTAX; } else if (sdp_svc_match(sdp, &req, &seqlen)) return -SDP_INVALID_SYNTAX; if (len < 3) return -SDP_INVALID_SYNTAX; VAR_4 = (req[0] << 8) | req[1]; req += 2; len -= 2; if (*req) { if (len <= sizeof(int)) return -SDP_INVALID_SYNTAX; len -= sizeof(int); memcpy(&VAR_2, req + 1, sizeof(int)); } else VAR_2 = 0; if (len > 1) return -SDP_INVALID_SYNTAX; len = 4; VAR_1 = 0; VAR_3 = VAR_2; for (VAR_0 = 0; VAR_0 < sdp->services; VAR_0 ++) if (sdp->service_list[VAR_0].match) { if (VAR_1 >= VAR_2 && VAR_1 < VAR_4 && len + 4 < MAX_RSP_PARAM_SIZE) { handle = VAR_0; memcpy(rsp + len, &handle, 4); len += 4; VAR_3 = VAR_1 + 1; } VAR_1 ++; } rsp[0] = VAR_1 >> 8; rsp[1] = VAR_1 & 0xff; rsp[2] = (VAR_3 - VAR_2) >> 8; rsp[3] = (VAR_3 - VAR_2) & 0xff; if (VAR_3 < VAR_1) { rsp[len ++] = sizeof(int); memcpy(rsp + len, &VAR_3, sizeof(int)); len += 4; } else rsp[len ++] = 0; return len; }
[ "static ssize_t FUNC_0(struct bt_l2cap_sdp_state_s *sdp,\nuint8_t *rsp, const uint8_t *req, ssize_t len)\n{", "ssize_t seqlen;", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4;", "int32_t handle;", "for (VAR_0 = 0; VAR_0 < sdp->services; VAR_0 ++)", "sdp->service_list[VAR_0].match = 0;", "if (len < 1)\nreturn -SDP_INVALID_SYNTAX;", "if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) {", "seqlen = sdp_datalen(&req, &len);", "if (seqlen < 3 || len < seqlen)\nreturn -SDP_INVALID_SYNTAX;", "len -= seqlen;", "while (seqlen)\nif (sdp_svc_match(sdp, &req, &seqlen))\nreturn -SDP_INVALID_SYNTAX;", "} else if (sdp_svc_match(sdp, &req, &seqlen))", "return -SDP_INVALID_SYNTAX;", "if (len < 3)\nreturn -SDP_INVALID_SYNTAX;", "VAR_4 = (req[0] << 8) | req[1];", "req += 2;", "len -= 2;", "if (*req) {", "if (len <= sizeof(int))\nreturn -SDP_INVALID_SYNTAX;", "len -= sizeof(int);", "memcpy(&VAR_2, req + 1, sizeof(int));", "} else", "VAR_2 = 0;", "if (len > 1)\nreturn -SDP_INVALID_SYNTAX;", "len = 4;", "VAR_1 = 0;", "VAR_3 = VAR_2;", "for (VAR_0 = 0; VAR_0 < sdp->services; VAR_0 ++)", "if (sdp->service_list[VAR_0].match) {", "if (VAR_1 >= VAR_2 && VAR_1 < VAR_4 && len + 4 < MAX_RSP_PARAM_SIZE) {", "handle = VAR_0;", "memcpy(rsp + len, &handle, 4);", "len += 4;", "VAR_3 = VAR_1 + 1;", "}", "VAR_1 ++;", "}", "rsp[0] = VAR_1 >> 8;", "rsp[1] = VAR_1 & 0xff;", "rsp[2] = (VAR_3 - VAR_2) >> 8;", "rsp[3] = (VAR_3 - VAR_2) & 0xff;", "if (VAR_3 < VAR_1) {", "rsp[len ++] = sizeof(int);", "memcpy(rsp + len, &VAR_3, sizeof(int));", "len += 4;", "} else", "rsp[len ++] = 0;", "return len;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ] ]
9,796
void ff_id3v1_read(AVFormatContext *s) { int ret; uint8_t buf[ID3v1_TAG_SIZE]; int64_t filesize, position = avio_tell(s->pb); if (s->pb->seekable) { /* XXX: change that */ filesize = avio_size(s->pb); if (filesize > 128) { avio_seek(s->pb, filesize - 128, SEEK_SET); ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); if (ret == ID3v1_TAG_SIZE) { parse_tag(s, buf); } avio_seek(s->pb, position, SEEK_SET); } } }
false
FFmpeg
83548fe894cdb455cc127f754d09905b6d23c173
void ff_id3v1_read(AVFormatContext *s) { int ret; uint8_t buf[ID3v1_TAG_SIZE]; int64_t filesize, position = avio_tell(s->pb); if (s->pb->seekable) { filesize = avio_size(s->pb); if (filesize > 128) { avio_seek(s->pb, filesize - 128, SEEK_SET); ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); if (ret == ID3v1_TAG_SIZE) { parse_tag(s, buf); } avio_seek(s->pb, position, SEEK_SET); } } }
{ "code": [], "line_no": [] }
void FUNC_0(AVFormatContext *VAR_0) { int VAR_1; uint8_t buf[ID3v1_TAG_SIZE]; int64_t filesize, position = avio_tell(VAR_0->pb); if (VAR_0->pb->seekable) { filesize = avio_size(VAR_0->pb); if (filesize > 128) { avio_seek(VAR_0->pb, filesize - 128, SEEK_SET); VAR_1 = avio_read(VAR_0->pb, buf, ID3v1_TAG_SIZE); if (VAR_1 == ID3v1_TAG_SIZE) { parse_tag(VAR_0, buf); } avio_seek(VAR_0->pb, position, SEEK_SET); } } }
[ "void FUNC_0(AVFormatContext *VAR_0)\n{", "int VAR_1;", "uint8_t buf[ID3v1_TAG_SIZE];", "int64_t filesize, position = avio_tell(VAR_0->pb);", "if (VAR_0->pb->seekable) {", "filesize = avio_size(VAR_0->pb);", "if (filesize > 128) {", "avio_seek(VAR_0->pb, filesize - 128, SEEK_SET);", "VAR_1 = avio_read(VAR_0->pb, buf, ID3v1_TAG_SIZE);", "if (VAR_1 == ID3v1_TAG_SIZE) {", "parse_tag(VAR_0, buf);", "}", "avio_seek(VAR_0->pb, position, SEEK_SET);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
9,797
static av_cold int dvvideo_encode_init(AVCodecContext *avctx) { DVVideoContext *s = avctx->priv_data; FDCTDSPContext fdsp; MECmpContext mecc; PixblockDSPContext pdsp; int ret; s->sys = av_dv_codec_profile(avctx->width, avctx->height, avctx->pix_fmt); if (!s->sys) { av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. " "Valid DV profiles are:\n", avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt)); ff_dv_print_profiles(avctx, AV_LOG_ERROR); return AVERROR(EINVAL); } ret = ff_dv_init_dynamic_tables(s, s->sys); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n"); return ret; } avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); dv_vlc_map_tableinit(); ff_fdctdsp_init(&fdsp, avctx); ff_me_cmp_init(&mecc, avctx); ff_pixblockdsp_init(&pdsp, avctx); ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp); s->get_pixels = pdsp.get_pixels; s->ildct_cmp = mecc.ildct_cmp[5]; s->fdct[0] = fdsp.fdct; s->fdct[1] = fdsp.fdct248; return ff_dvvideo_init(avctx); }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static av_cold int dvvideo_encode_init(AVCodecContext *avctx) { DVVideoContext *s = avctx->priv_data; FDCTDSPContext fdsp; MECmpContext mecc; PixblockDSPContext pdsp; int ret; s->sys = av_dv_codec_profile(avctx->width, avctx->height, avctx->pix_fmt); if (!s->sys) { av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. " "Valid DV profiles are:\n", avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt)); ff_dv_print_profiles(avctx, AV_LOG_ERROR); return AVERROR(EINVAL); } ret = ff_dv_init_dynamic_tables(s, s->sys); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n"); return ret; } avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); dv_vlc_map_tableinit(); ff_fdctdsp_init(&fdsp, avctx); ff_me_cmp_init(&mecc, avctx); ff_pixblockdsp_init(&pdsp, avctx); ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp); s->get_pixels = pdsp.get_pixels; s->ildct_cmp = mecc.ildct_cmp[5]; s->fdct[0] = fdsp.fdct; s->fdct[1] = fdsp.fdct248; return ff_dvvideo_init(avctx); }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { DVVideoContext *s = avctx->priv_data; FDCTDSPContext fdsp; MECmpContext mecc; PixblockDSPContext pdsp; int VAR_0; s->sys = av_dv_codec_profile(avctx->width, avctx->height, avctx->pix_fmt); if (!s->sys) { av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. " "Valid DV profiles are:\n", avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt)); ff_dv_print_profiles(avctx, AV_LOG_ERROR); return AVERROR(EINVAL); } VAR_0 = ff_dv_init_dynamic_tables(s, s->sys); if (VAR_0 < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n"); return VAR_0; } avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); dv_vlc_map_tableinit(); ff_fdctdsp_init(&fdsp, avctx); ff_me_cmp_init(&mecc, avctx); ff_pixblockdsp_init(&pdsp, avctx); ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp); s->get_pixels = pdsp.get_pixels; s->ildct_cmp = mecc.ildct_cmp[5]; s->fdct[0] = fdsp.fdct; s->fdct[1] = fdsp.fdct248; return ff_dvvideo_init(avctx); }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "DVVideoContext *s = avctx->priv_data;", "FDCTDSPContext fdsp;", "MECmpContext mecc;", "PixblockDSPContext pdsp;", "int VAR_0;", "s->sys = av_dv_codec_profile(avctx->width, avctx->height, avctx->pix_fmt);", "if (!s->sys) {", "av_log(avctx, AV_LOG_ERROR, \"Found no DV profile for %ix%i %s video. \"\n\"Valid DV profiles are:\\n\",\navctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));", "ff_dv_print_profiles(avctx, AV_LOG_ERROR);", "return AVERROR(EINVAL);", "}", "VAR_0 = ff_dv_init_dynamic_tables(s, s->sys);", "if (VAR_0 < 0) {", "av_log(avctx, AV_LOG_ERROR, \"Error initializing work tables.\\n\");", "return VAR_0;", "}", "avctx->coded_frame = av_frame_alloc();", "if (!avctx->coded_frame)\nreturn AVERROR(ENOMEM);", "dv_vlc_map_tableinit();", "ff_fdctdsp_init(&fdsp, avctx);", "ff_me_cmp_init(&mecc, avctx);", "ff_pixblockdsp_init(&pdsp, avctx);", "ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp);", "s->get_pixels = pdsp.get_pixels;", "s->ildct_cmp = mecc.ildct_cmp[5];", "s->fdct[0] = fdsp.fdct;", "s->fdct[1] = fdsp.fdct248;", "return ff_dvvideo_init(avctx);", "}" ]
[ 0, 0, 0, 0, 0, 0, 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 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
9,798
yuv2rgb48_2_c_template(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target) { int yalpha1 = 4095 - yalpha; int uvalpha1 = 4095 - uvalpha; int i; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; const uint8_t *r = (const uint8_t *) c->table_rV[V], *g = (const uint8_t *)(c->table_gU[U] + c->table_gV[V]), *b = (const uint8_t *) c->table_bU[U]; dest[ 0] = dest[ 1] = r_b[Y1]; dest[ 2] = dest[ 3] = g[Y1]; dest[ 4] = dest[ 5] = b_r[Y1]; dest[ 6] = dest[ 7] = r_b[Y2]; dest[ 8] = dest[ 9] = g[Y2]; dest[10] = dest[11] = b_r[Y2]; dest += 12; } }
false
FFmpeg
13a099799e89a76eb921ca452e1b04a7a28a9855
yuv2rgb48_2_c_template(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target) { int yalpha1 = 4095 - yalpha; int uvalpha1 = 4095 - uvalpha; int i; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; const uint8_t *r = (const uint8_t *) c->table_rV[V], *g = (const uint8_t *)(c->table_gU[U] + c->table_gV[V]), *b = (const uint8_t *) c->table_bU[U]; dest[ 0] = dest[ 1] = r_b[Y1]; dest[ 2] = dest[ 3] = g[Y1]; dest[ 4] = dest[ 5] = b_r[Y1]; dest[ 6] = dest[ 7] = r_b[Y2]; dest[ 8] = dest[ 9] = g[Y2]; dest[10] = dest[11] = b_r[Y2]; dest += 12; } }
{ "code": [], "line_no": [] }
FUNC_0(SwsContext *VAR_0, const uint16_t *VAR_1, const uint16_t *VAR_2, const uint16_t *VAR_3, const uint16_t *VAR_4, const uint16_t *VAR_5, const uint16_t *VAR_6, const uint16_t *VAR_7, const uint16_t *VAR_8, uint8_t *VAR_9, int VAR_10, int VAR_11, int VAR_12, int VAR_13, enum PixelFormat VAR_14) { int VAR_15 = 4095 - VAR_11; int VAR_16 = 4095 - VAR_12; int VAR_17; for (VAR_17 = 0; VAR_17 < (VAR_10 >> 1); VAR_17++) { int VAR_18 = (VAR_1[VAR_17 * 2] * VAR_15 + VAR_2[VAR_17 * 2] * VAR_11) >> 19; int VAR_19 = (VAR_1[VAR_17 * 2 + 1] * VAR_15 + VAR_2[VAR_17 * 2 + 1] * VAR_11) >> 19; int VAR_20 = (VAR_3[VAR_17] * VAR_16 + VAR_4[VAR_17] * VAR_12) >> 19; int VAR_21 = (VAR_5[VAR_17] * VAR_16 + VAR_6[VAR_17] * VAR_12) >> 19; const uint8_t *VAR_22 = (const uint8_t *) VAR_0->table_rV[VAR_21], *g = (const uint8_t *)(VAR_0->table_gU[VAR_20] + VAR_0->table_gV[VAR_21]), *b = (const uint8_t *) VAR_0->table_bU[VAR_20]; VAR_9[ 0] = VAR_9[ 1] = r_b[VAR_18]; VAR_9[ 2] = VAR_9[ 3] = g[VAR_18]; VAR_9[ 4] = VAR_9[ 5] = b_r[VAR_18]; VAR_9[ 6] = VAR_9[ 7] = r_b[VAR_19]; VAR_9[ 8] = VAR_9[ 9] = g[VAR_19]; VAR_9[10] = VAR_9[11] = b_r[VAR_19]; VAR_9 += 12; } }
[ "FUNC_0(SwsContext *VAR_0, const uint16_t *VAR_1,\nconst uint16_t *VAR_2, const uint16_t *VAR_3,\nconst uint16_t *VAR_4, const uint16_t *VAR_5,\nconst uint16_t *VAR_6, const uint16_t *VAR_7,\nconst uint16_t *VAR_8, uint8_t *VAR_9, int VAR_10,\nint VAR_11, int VAR_12, int VAR_13,\nenum PixelFormat VAR_14)\n{", "int VAR_15 = 4095 - VAR_11;", "int VAR_16 = 4095 - VAR_12;", "int VAR_17;", "for (VAR_17 = 0; VAR_17 < (VAR_10 >> 1); VAR_17++) {", "int VAR_18 = (VAR_1[VAR_17 * 2] * VAR_15 + VAR_2[VAR_17 * 2] * VAR_11) >> 19;", "int VAR_19 = (VAR_1[VAR_17 * 2 + 1] * VAR_15 + VAR_2[VAR_17 * 2 + 1] * VAR_11) >> 19;", "int VAR_20 = (VAR_3[VAR_17] * VAR_16 + VAR_4[VAR_17] * VAR_12) >> 19;", "int VAR_21 = (VAR_5[VAR_17] * VAR_16 + VAR_6[VAR_17] * VAR_12) >> 19;", "const uint8_t *VAR_22 = (const uint8_t *) VAR_0->table_rV[VAR_21],\n*g = (const uint8_t *)(VAR_0->table_gU[VAR_20] + VAR_0->table_gV[VAR_21]),\n*b = (const uint8_t *) VAR_0->table_bU[VAR_20];", "VAR_9[ 0] = VAR_9[ 1] = r_b[VAR_18];", "VAR_9[ 2] = VAR_9[ 3] = g[VAR_18];", "VAR_9[ 4] = VAR_9[ 5] = b_r[VAR_18];", "VAR_9[ 6] = VAR_9[ 7] = r_b[VAR_19];", "VAR_9[ 8] = VAR_9[ 9] = g[VAR_19];", "VAR_9[10] = VAR_9[11] = b_r[VAR_19];", "VAR_9 += 12;", "}", "}" ]
[ 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 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
9,799
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd) { struct kvm_create_spapr_tce args = { .liobn = liobn, .window_size = window_size, }; long len; int fd; void *table; /* Must set fd to -1 so we don't try to munmap when called for * destroying the table, which the upper layers -will- do */ *pfd = -1; if (!cap_spapr_tce) { return NULL; } fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args); if (fd < 0) { fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n", liobn); return NULL; } len = (window_size / SPAPR_TCE_PAGE_SIZE) * sizeof(sPAPRTCE); /* FIXME: round this up to page size */ table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); if (table == MAP_FAILED) { fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n", liobn); close(fd); return NULL; } *pfd = fd; return table; }
false
qemu
a83000f5e3fac30a7f213af1ba6a8f827622854d
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd) { struct kvm_create_spapr_tce args = { .liobn = liobn, .window_size = window_size, }; long len; int fd; void *table; *pfd = -1; if (!cap_spapr_tce) { return NULL; } fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args); if (fd < 0) { fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n", liobn); return NULL; } len = (window_size / SPAPR_TCE_PAGE_SIZE) * sizeof(sPAPRTCE); table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); if (table == MAP_FAILED) { fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n", liobn); close(fd); return NULL; } *pfd = fd; return table; }
{ "code": [], "line_no": [] }
void *FUNC_0(uint32_t VAR_0, uint32_t VAR_1, int *VAR_2) { struct kvm_create_spapr_tce VAR_3 = { .VAR_0 = VAR_0, .VAR_1 = VAR_1, }; long VAR_4; int VAR_5; void *VAR_6; *VAR_2 = -1; if (!cap_spapr_tce) { return NULL; } VAR_5 = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &VAR_3); if (VAR_5 < 0) { fprintf(stderr, "KVM: Failed to create TCE VAR_6 for VAR_0 0x%x\n", VAR_0); return NULL; } VAR_4 = (VAR_1 / SPAPR_TCE_PAGE_SIZE) * sizeof(sPAPRTCE); VAR_6 = mmap(NULL, VAR_4, PROT_READ|PROT_WRITE, MAP_SHARED, VAR_5, 0); if (VAR_6 == MAP_FAILED) { fprintf(stderr, "KVM: Failed to map TCE VAR_6 for VAR_0 0x%x\n", VAR_0); close(VAR_5); return NULL; } *VAR_2 = VAR_5; return VAR_6; }
[ "void *FUNC_0(uint32_t VAR_0, uint32_t VAR_1, int *VAR_2)\n{", "struct kvm_create_spapr_tce VAR_3 = {", ".VAR_0 = VAR_0,\n.VAR_1 = VAR_1,\n};", "long VAR_4;", "int VAR_5;", "void *VAR_6;", "*VAR_2 = -1;", "if (!cap_spapr_tce) {", "return NULL;", "}", "VAR_5 = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &VAR_3);", "if (VAR_5 < 0) {", "fprintf(stderr, \"KVM: Failed to create TCE VAR_6 for VAR_0 0x%x\\n\",\nVAR_0);", "return NULL;", "}", "VAR_4 = (VAR_1 / SPAPR_TCE_PAGE_SIZE) * sizeof(sPAPRTCE);", "VAR_6 = mmap(NULL, VAR_4, PROT_READ|PROT_WRITE, MAP_SHARED, VAR_5, 0);", "if (VAR_6 == MAP_FAILED) {", "fprintf(stderr, \"KVM: Failed to map TCE VAR_6 for VAR_0 0x%x\\n\",\nVAR_0);", "close(VAR_5);", "return NULL;", "}", "*VAR_2 = VAR_5;", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ] ]
9,800
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { int i; int index_a = qp + h->slice_alpha_c0_offset; int alpha = (alpha_table+52)[index_a]; int beta = (beta_table+52)[qp + h->slice_beta_offset]; for( i = 0; i < 4; i++, pix += stride) { const int bS_index = i*bsi; if( bS[bS_index] == 0 ) { continue; } if( bS[bS_index] < 4 ) { const int tc = (tc0_table+52)[index_a][bS[bS_index]] + 1; const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; const int q1 = pix[1]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { const int i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-1] = av_clip_uint8( p0 + i_delta ); /* p0' */ pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */ tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1); } }else{ const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; const int q1 = pix[1]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, pix[-3], p1, p0, q0, q1, pix[2], pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]); } } } }
false
FFmpeg
0c32e19d584ba6ddbc27f0a796260404daaf4b6a
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { int i; int index_a = qp + h->slice_alpha_c0_offset; int alpha = (alpha_table+52)[index_a]; int beta = (beta_table+52)[qp + h->slice_beta_offset]; for( i = 0; i < 4; i++, pix += stride) { const int bS_index = i*bsi; if( bS[bS_index] == 0 ) { continue; } if( bS[bS_index] < 4 ) { const int tc = (tc0_table+52)[index_a][bS[bS_index]] + 1; const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; const int q1 = pix[1]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { const int i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-1] = av_clip_uint8( p0 + i_delta ); pix[0] = av_clip_uint8( q0 - i_delta ); tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1); } }else{ const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; const int q1 = pix[1]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, pix[-3], p1, p0, q0, q1, pix[2], pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]); } } } }
{ "code": [], "line_no": [] }
static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int16_t VAR_3[4], int VAR_4, int VAR_5 ) { int VAR_6; int VAR_7 = VAR_5 + VAR_0->slice_alpha_c0_offset; int VAR_8 = (alpha_table+52)[VAR_7]; int VAR_9 = (beta_table+52)[VAR_5 + VAR_0->slice_beta_offset]; for( VAR_6 = 0; VAR_6 < 4; VAR_6++, VAR_1 += VAR_2) { const int VAR_10 = VAR_6*VAR_4; if( VAR_3[VAR_10] == 0 ) { continue; } if( VAR_3[VAR_10] < 4 ) { const int VAR_11 = (tc0_table+52)[VAR_7][VAR_3[VAR_10]] + 1; const int VAR_17 = VAR_1[-1]; const int VAR_17 = VAR_1[-2]; const int VAR_17 = VAR_1[0]; const int VAR_17 = VAR_1[1]; if( FFABS( VAR_17 - VAR_17 ) < VAR_8 && FFABS( VAR_17 - VAR_17 ) < VAR_9 && FFABS( VAR_17 - VAR_17 ) < VAR_9 ) { const int VAR_16 = av_clip( (((VAR_17 - VAR_17 ) << 2) + (VAR_17 - VAR_17) + 4) >> 3, -VAR_11, VAR_11 ); VAR_1[-1] = av_clip_uint8( VAR_17 + VAR_16 ); VAR_1[0] = av_clip_uint8( VAR_17 - VAR_16 ); tprintf(VAR_0->s.avctx, "FUNC_0 VAR_6:%d, VAR_5:%d, indexA:%d, VAR_8:%d, VAR_9:%d, VAR_11:%d\n# VAR_3:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", VAR_6, VAR_5[qp_index], VAR_7, VAR_8, VAR_9, VAR_11, VAR_3[VAR_10], VAR_1[-3], VAR_17, VAR_17, VAR_17, VAR_17, VAR_1[2], VAR_17, VAR_1[-1], VAR_1[0], VAR_17); } }else{ const int VAR_17 = VAR_1[-1]; const int VAR_17 = VAR_1[-2]; const int VAR_17 = VAR_1[0]; const int VAR_17 = VAR_1[1]; if( FFABS( VAR_17 - VAR_17 ) < VAR_8 && FFABS( VAR_17 - VAR_17 ) < VAR_9 && FFABS( VAR_17 - VAR_17 ) < VAR_9 ) { VAR_1[-1] = ( 2*VAR_17 + VAR_17 + VAR_17 + 2 ) >> 2; VAR_1[0] = ( 2*VAR_17 + VAR_17 + VAR_17 + 2 ) >> 2; tprintf(VAR_0->s.avctx, "FUNC_0 VAR_6:%d\n# VAR_3:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", VAR_6, VAR_1[-3], VAR_17, VAR_17, VAR_17, VAR_17, VAR_1[2], VAR_1[-3], VAR_1[-2], VAR_1[-1], VAR_1[0], VAR_1[1], VAR_1[2]); } } } }
[ "static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int16_t VAR_3[4], int VAR_4, int VAR_5 ) {", "int VAR_6;", "int VAR_7 = VAR_5 + VAR_0->slice_alpha_c0_offset;", "int VAR_8 = (alpha_table+52)[VAR_7];", "int VAR_9 = (beta_table+52)[VAR_5 + VAR_0->slice_beta_offset];", "for( VAR_6 = 0; VAR_6 < 4; VAR_6++, VAR_1 += VAR_2) {", "const int VAR_10 = VAR_6*VAR_4;", "if( VAR_3[VAR_10] == 0 ) {", "continue;", "}", "if( VAR_3[VAR_10] < 4 ) {", "const int VAR_11 = (tc0_table+52)[VAR_7][VAR_3[VAR_10]] + 1;", "const int VAR_17 = VAR_1[-1];", "const int VAR_17 = VAR_1[-2];", "const int VAR_17 = VAR_1[0];", "const int VAR_17 = VAR_1[1];", "if( FFABS( VAR_17 - VAR_17 ) < VAR_8 &&\nFFABS( VAR_17 - VAR_17 ) < VAR_9 &&\nFFABS( VAR_17 - VAR_17 ) < VAR_9 ) {", "const int VAR_16 = av_clip( (((VAR_17 - VAR_17 ) << 2) + (VAR_17 - VAR_17) + 4) >> 3, -VAR_11, VAR_11 );", "VAR_1[-1] = av_clip_uint8( VAR_17 + VAR_16 );", "VAR_1[0] = av_clip_uint8( VAR_17 - VAR_16 );", "tprintf(VAR_0->s.avctx, \"FUNC_0 VAR_6:%d, VAR_5:%d, indexA:%d, VAR_8:%d, VAR_9:%d, VAR_11:%d\\n# VAR_3:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\\n\", VAR_6, VAR_5[qp_index], VAR_7, VAR_8, VAR_9, VAR_11, VAR_3[VAR_10], VAR_1[-3], VAR_17, VAR_17, VAR_17, VAR_17, VAR_1[2], VAR_17, VAR_1[-1], VAR_1[0], VAR_17);", "}", "}else{", "const int VAR_17 = VAR_1[-1];", "const int VAR_17 = VAR_1[-2];", "const int VAR_17 = VAR_1[0];", "const int VAR_17 = VAR_1[1];", "if( FFABS( VAR_17 - VAR_17 ) < VAR_8 &&\nFFABS( VAR_17 - VAR_17 ) < VAR_9 &&\nFFABS( VAR_17 - VAR_17 ) < VAR_9 ) {", "VAR_1[-1] = ( 2*VAR_17 + VAR_17 + VAR_17 + 2 ) >> 2;", "VAR_1[0] = ( 2*VAR_17 + VAR_17 + VAR_17 + 2 ) >> 2;", "tprintf(VAR_0->s.avctx, \"FUNC_0 VAR_6:%d\\n# VAR_3:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\\n\", VAR_6, VAR_1[-3], VAR_17, VAR_17, VAR_17, VAR_17, VAR_1[2], VAR_1[-3], VAR_1[-2], VAR_1[-1], VAR_1[0], VAR_1[1], VAR_1[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 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41, 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
9,801
static void bdrv_qed_invalidate_cache(BlockDriverState *bs, Error **errp) { BDRVQEDState *s = bs->opaque; Error *local_err = NULL; int ret; bdrv_qed_close(bs); memset(s, 0, sizeof(BDRVQEDState)); ret = bdrv_qed_do_open(bs, NULL, bs->open_flags, &local_err); if (local_err) { error_propagate(errp, local_err); error_prepend(errp, "Could not reopen qed layer: "); return; } else if (ret < 0) { error_setg_errno(errp, -ret, "Could not reopen qed layer"); return; } }
false
qemu
61c7887e0f3dcfa9c4ccdfe43374243a4a5c0e8d
static void bdrv_qed_invalidate_cache(BlockDriverState *bs, Error **errp) { BDRVQEDState *s = bs->opaque; Error *local_err = NULL; int ret; bdrv_qed_close(bs); memset(s, 0, sizeof(BDRVQEDState)); ret = bdrv_qed_do_open(bs, NULL, bs->open_flags, &local_err); if (local_err) { error_propagate(errp, local_err); error_prepend(errp, "Could not reopen qed layer: "); return; } else if (ret < 0) { error_setg_errno(errp, -ret, "Could not reopen qed layer"); return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1) { BDRVQEDState *s = VAR_0->opaque; Error *local_err = NULL; int VAR_2; bdrv_qed_close(VAR_0); memset(s, 0, sizeof(BDRVQEDState)); VAR_2 = bdrv_qed_do_open(VAR_0, NULL, VAR_0->open_flags, &local_err); if (local_err) { error_propagate(VAR_1, local_err); error_prepend(VAR_1, "Could not reopen qed layer: "); return; } else if (VAR_2 < 0) { error_setg_errno(VAR_1, -VAR_2, "Could not reopen qed layer"); return; } }
[ "static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)\n{", "BDRVQEDState *s = VAR_0->opaque;", "Error *local_err = NULL;", "int VAR_2;", "bdrv_qed_close(VAR_0);", "memset(s, 0, sizeof(BDRVQEDState));", "VAR_2 = bdrv_qed_do_open(VAR_0, NULL, VAR_0->open_flags, &local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "error_prepend(VAR_1, \"Could not reopen qed layer: \");", "return;", "} else if (VAR_2 < 0) {", "error_setg_errno(VAR_1, -VAR_2, \"Could not reopen qed layer\");", "return;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
9,802
void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn) { spapr_hcall_fn *slot; if (opcode <= MAX_HCALL_OPCODE) { assert((opcode & 0x3) == 0); slot = &papr_hypercall_table[opcode / 4]; } else { assert((opcode >= KVMPPC_HCALL_BASE) && (opcode <= KVMPPC_HCALL_MAX)); slot = &kvmppc_hypercall_table[opcode - KVMPPC_HCALL_BASE]; } assert(!(*slot) || (fn == *slot)); *slot = fn; }
false
qemu
c89d52997cf4849a9ee16b5d2cf462d0cd137634
void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn) { spapr_hcall_fn *slot; if (opcode <= MAX_HCALL_OPCODE) { assert((opcode & 0x3) == 0); slot = &papr_hypercall_table[opcode / 4]; } else { assert((opcode >= KVMPPC_HCALL_BASE) && (opcode <= KVMPPC_HCALL_MAX)); slot = &kvmppc_hypercall_table[opcode - KVMPPC_HCALL_BASE]; } assert(!(*slot) || (fn == *slot)); *slot = fn; }
{ "code": [], "line_no": [] }
void FUNC_0(target_ulong VAR_0, spapr_hcall_fn VAR_1) { spapr_hcall_fn *slot; if (VAR_0 <= MAX_HCALL_OPCODE) { assert((VAR_0 & 0x3) == 0); slot = &papr_hypercall_table[VAR_0 / 4]; } else { assert((VAR_0 >= KVMPPC_HCALL_BASE) && (VAR_0 <= KVMPPC_HCALL_MAX)); slot = &kvmppc_hypercall_table[VAR_0 - KVMPPC_HCALL_BASE]; } assert(!(*slot) || (VAR_1 == *slot)); *slot = VAR_1; }
[ "void FUNC_0(target_ulong VAR_0, spapr_hcall_fn VAR_1)\n{", "spapr_hcall_fn *slot;", "if (VAR_0 <= MAX_HCALL_OPCODE) {", "assert((VAR_0 & 0x3) == 0);", "slot = &papr_hypercall_table[VAR_0 / 4];", "} else {", "assert((VAR_0 >= KVMPPC_HCALL_BASE) && (VAR_0 <= KVMPPC_HCALL_MAX));", "slot = &kvmppc_hypercall_table[VAR_0 - KVMPPC_HCALL_BASE];", "}", "assert(!(*slot) || (VAR_1 == *slot));", "*slot = VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ] ]
9,803
static int usb_host_open(USBHostDevice *dev, int bus_num, int addr, const char *port, const char *prod_name, int speed) { int fd = -1, ret; trace_usb_host_open_started(bus_num, addr); if (dev->fd != -1) { goto fail; } fd = usb_host_open_device(bus_num, addr); if (fd < 0) { goto fail; } DPRINTF("husb: opened %s\n", buf); dev->bus_num = bus_num; dev->addr = addr; strcpy(dev->port, port); dev->fd = fd; /* read the device description */ dev->descr_len = read(fd, dev->descr, sizeof(dev->descr)); if (dev->descr_len <= 0) { perror("husb: reading device data failed"); goto fail; } #ifdef DEBUG { int x; printf("=== begin dumping device descriptor data ===\n"); for (x = 0; x < dev->descr_len; x++) { printf("%02x ", dev->descr[x]); } printf("\n=== end dumping device descriptor data ===\n"); } #endif /* start unconfigured -- we'll wait for the guest to set a configuration */ if (!usb_host_claim_interfaces(dev, 0)) { goto fail; } usb_ep_init(&dev->dev); ret = usb_linux_update_endp_table(dev); if (ret) { goto fail; } if (speed == -1) { struct usbdevfs_connectinfo ci; ret = ioctl(fd, USBDEVFS_CONNECTINFO, &ci); if (ret < 0) { perror("usb_host_device_open: USBDEVFS_CONNECTINFO"); goto fail; } if (ci.slow) { speed = USB_SPEED_LOW; } else { speed = USB_SPEED_HIGH; } } dev->dev.speed = speed; dev->dev.speedmask = (1 << speed); if (dev->dev.speed == USB_SPEED_HIGH && usb_linux_full_speed_compat(dev)) { dev->dev.speedmask |= USB_SPEED_MASK_FULL; } trace_usb_host_open_success(bus_num, addr); if (!prod_name || prod_name[0] == '\0') { snprintf(dev->dev.product_desc, sizeof(dev->dev.product_desc), "host:%d.%d", bus_num, addr); } else { pstrcpy(dev->dev.product_desc, sizeof(dev->dev.product_desc), prod_name); } ret = usb_device_attach(&dev->dev); if (ret) { goto fail; } /* USB devio uses 'write' flag to check for async completions */ qemu_set_fd_handler(dev->fd, NULL, async_complete, dev); return 0; fail: trace_usb_host_open_failure(bus_num, addr); if (dev->fd != -1) { close(dev->fd); dev->fd = -1; } return -1; }
false
qemu
537e8f1aa838677c8efd5e0966e89c4b5423dd18
static int usb_host_open(USBHostDevice *dev, int bus_num, int addr, const char *port, const char *prod_name, int speed) { int fd = -1, ret; trace_usb_host_open_started(bus_num, addr); if (dev->fd != -1) { goto fail; } fd = usb_host_open_device(bus_num, addr); if (fd < 0) { goto fail; } DPRINTF("husb: opened %s\n", buf); dev->bus_num = bus_num; dev->addr = addr; strcpy(dev->port, port); dev->fd = fd; dev->descr_len = read(fd, dev->descr, sizeof(dev->descr)); if (dev->descr_len <= 0) { perror("husb: reading device data failed"); goto fail; } #ifdef DEBUG { int x; printf("=== begin dumping device descriptor data ===\n"); for (x = 0; x < dev->descr_len; x++) { printf("%02x ", dev->descr[x]); } printf("\n=== end dumping device descriptor data ===\n"); } #endif if (!usb_host_claim_interfaces(dev, 0)) { goto fail; } usb_ep_init(&dev->dev); ret = usb_linux_update_endp_table(dev); if (ret) { goto fail; } if (speed == -1) { struct usbdevfs_connectinfo ci; ret = ioctl(fd, USBDEVFS_CONNECTINFO, &ci); if (ret < 0) { perror("usb_host_device_open: USBDEVFS_CONNECTINFO"); goto fail; } if (ci.slow) { speed = USB_SPEED_LOW; } else { speed = USB_SPEED_HIGH; } } dev->dev.speed = speed; dev->dev.speedmask = (1 << speed); if (dev->dev.speed == USB_SPEED_HIGH && usb_linux_full_speed_compat(dev)) { dev->dev.speedmask |= USB_SPEED_MASK_FULL; } trace_usb_host_open_success(bus_num, addr); if (!prod_name || prod_name[0] == '\0') { snprintf(dev->dev.product_desc, sizeof(dev->dev.product_desc), "host:%d.%d", bus_num, addr); } else { pstrcpy(dev->dev.product_desc, sizeof(dev->dev.product_desc), prod_name); } ret = usb_device_attach(&dev->dev); if (ret) { goto fail; } qemu_set_fd_handler(dev->fd, NULL, async_complete, dev); return 0; fail: trace_usb_host_open_failure(bus_num, addr); if (dev->fd != -1) { close(dev->fd); dev->fd = -1; } return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(USBHostDevice *VAR_0, int VAR_1, int VAR_2, const char *VAR_3, const char *VAR_4, int VAR_5) { int VAR_6 = -1, VAR_7; trace_usb_host_open_started(VAR_1, VAR_2); if (VAR_0->VAR_6 != -1) { goto fail; } VAR_6 = usb_host_open_device(VAR_1, VAR_2); if (VAR_6 < 0) { goto fail; } DPRINTF("husb: opened %s\n", buf); VAR_0->VAR_1 = VAR_1; VAR_0->VAR_2 = VAR_2; strcpy(VAR_0->VAR_3, VAR_3); VAR_0->VAR_6 = VAR_6; VAR_0->descr_len = read(VAR_6, VAR_0->descr, sizeof(VAR_0->descr)); if (VAR_0->descr_len <= 0) { perror("husb: reading device data failed"); goto fail; } #ifdef DEBUG { int x; printf("=== begin dumping device descriptor data ===\n"); for (x = 0; x < VAR_0->descr_len; x++) { printf("%02x ", VAR_0->descr[x]); } printf("\n=== end dumping device descriptor data ===\n"); } #endif if (!usb_host_claim_interfaces(VAR_0, 0)) { goto fail; } usb_ep_init(&VAR_0->VAR_0); VAR_7 = usb_linux_update_endp_table(VAR_0); if (VAR_7) { goto fail; } if (VAR_5 == -1) { struct usbdevfs_connectinfo VAR_8; VAR_7 = ioctl(VAR_6, USBDEVFS_CONNECTINFO, &VAR_8); if (VAR_7 < 0) { perror("usb_host_device_open: USBDEVFS_CONNECTINFO"); goto fail; } if (VAR_8.slow) { VAR_5 = USB_SPEED_LOW; } else { VAR_5 = USB_SPEED_HIGH; } } VAR_0->VAR_0.VAR_5 = VAR_5; VAR_0->VAR_0.speedmask = (1 << VAR_5); if (VAR_0->VAR_0.VAR_5 == USB_SPEED_HIGH && usb_linux_full_speed_compat(VAR_0)) { VAR_0->VAR_0.speedmask |= USB_SPEED_MASK_FULL; } trace_usb_host_open_success(VAR_1, VAR_2); if (!VAR_4 || VAR_4[0] == '\0') { snprintf(VAR_0->VAR_0.product_desc, sizeof(VAR_0->VAR_0.product_desc), "host:%d.%d", VAR_1, VAR_2); } else { pstrcpy(VAR_0->VAR_0.product_desc, sizeof(VAR_0->VAR_0.product_desc), VAR_4); } VAR_7 = usb_device_attach(&VAR_0->VAR_0); if (VAR_7) { goto fail; } qemu_set_fd_handler(VAR_0->VAR_6, NULL, async_complete, VAR_0); return 0; fail: trace_usb_host_open_failure(VAR_1, VAR_2); if (VAR_0->VAR_6 != -1) { close(VAR_0->VAR_6); VAR_0->VAR_6 = -1; } return -1; }
[ "static int FUNC_0(USBHostDevice *VAR_0, int VAR_1,\nint VAR_2, const char *VAR_3,\nconst char *VAR_4, int VAR_5)\n{", "int VAR_6 = -1, VAR_7;", "trace_usb_host_open_started(VAR_1, VAR_2);", "if (VAR_0->VAR_6 != -1) {", "goto fail;", "}", "VAR_6 = usb_host_open_device(VAR_1, VAR_2);", "if (VAR_6 < 0) {", "goto fail;", "}", "DPRINTF(\"husb: opened %s\\n\", buf);", "VAR_0->VAR_1 = VAR_1;", "VAR_0->VAR_2 = VAR_2;", "strcpy(VAR_0->VAR_3, VAR_3);", "VAR_0->VAR_6 = VAR_6;", "VAR_0->descr_len = read(VAR_6, VAR_0->descr, sizeof(VAR_0->descr));", "if (VAR_0->descr_len <= 0) {", "perror(\"husb: reading device data failed\");", "goto fail;", "}", "#ifdef DEBUG\n{", "int x;", "printf(\"=== begin dumping device descriptor data ===\\n\");", "for (x = 0; x < VAR_0->descr_len; x++) {", "printf(\"%02x \", VAR_0->descr[x]);", "}", "printf(\"\\n=== end dumping device descriptor data ===\\n\");", "}", "#endif\nif (!usb_host_claim_interfaces(VAR_0, 0)) {", "goto fail;", "}", "usb_ep_init(&VAR_0->VAR_0);", "VAR_7 = usb_linux_update_endp_table(VAR_0);", "if (VAR_7) {", "goto fail;", "}", "if (VAR_5 == -1) {", "struct usbdevfs_connectinfo VAR_8;", "VAR_7 = ioctl(VAR_6, USBDEVFS_CONNECTINFO, &VAR_8);", "if (VAR_7 < 0) {", "perror(\"usb_host_device_open: USBDEVFS_CONNECTINFO\");", "goto fail;", "}", "if (VAR_8.slow) {", "VAR_5 = USB_SPEED_LOW;", "} else {", "VAR_5 = USB_SPEED_HIGH;", "}", "}", "VAR_0->VAR_0.VAR_5 = VAR_5;", "VAR_0->VAR_0.speedmask = (1 << VAR_5);", "if (VAR_0->VAR_0.VAR_5 == USB_SPEED_HIGH && usb_linux_full_speed_compat(VAR_0)) {", "VAR_0->VAR_0.speedmask |= USB_SPEED_MASK_FULL;", "}", "trace_usb_host_open_success(VAR_1, VAR_2);", "if (!VAR_4 || VAR_4[0] == '\\0') {", "snprintf(VAR_0->VAR_0.product_desc, sizeof(VAR_0->VAR_0.product_desc),\n\"host:%d.%d\", VAR_1, VAR_2);", "} else {", "pstrcpy(VAR_0->VAR_0.product_desc, sizeof(VAR_0->VAR_0.product_desc),\nVAR_4);", "}", "VAR_7 = usb_device_attach(&VAR_0->VAR_0);", "if (VAR_7) {", "goto fail;", "}", "qemu_set_fd_handler(VAR_0->VAR_6, NULL, async_complete, VAR_0);", "return 0;", "fail:\ntrace_usb_host_open_failure(VAR_1, VAR_2);", "if (VAR_0->VAR_6 != -1) {", "close(VAR_0->VAR_6);", "VAR_0->VAR_6 = -1;", "}", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 181 ], [ 185 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ] ]
9,804
static void ide_init2(IDEState *ide_state, BlockDriverState *hd0, BlockDriverState *hd1, qemu_irq irq) { IDEState *s; static int drive_serial = 1; int i, cylinders, heads, secs; uint64_t nb_sectors; for(i = 0; i < 2; i++) { s = ide_state + i; s->io_buffer = qemu_memalign(512, IDE_DMA_BUF_SECTORS*512 + 4); if (i == 0) s->bs = hd0; else s->bs = hd1; if (s->bs) { bdrv_get_geometry(s->bs, &nb_sectors); bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); s->cylinders = cylinders; s->heads = heads; s->sectors = secs; s->nb_sectors = nb_sectors; if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { s->is_cdrom = 1; bdrv_set_change_cb(s->bs, cdrom_change_cb, s); } } s->drive_serial = drive_serial++; strncpy(s->drive_serial_str, drive_get_serial(s->bs), sizeof(s->drive_serial_str)); if (strlen(s->drive_serial_str) == 0) snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), "QM%05d", s->drive_serial); s->irq = irq; s->sector_write_timer = qemu_new_timer(vm_clock, ide_sector_write_timer_cb, s); ide_reset(s); } }
false
qemu
e268ca52328eb0460ae0d10b7f4313a63d5b000c
static void ide_init2(IDEState *ide_state, BlockDriverState *hd0, BlockDriverState *hd1, qemu_irq irq) { IDEState *s; static int drive_serial = 1; int i, cylinders, heads, secs; uint64_t nb_sectors; for(i = 0; i < 2; i++) { s = ide_state + i; s->io_buffer = qemu_memalign(512, IDE_DMA_BUF_SECTORS*512 + 4); if (i == 0) s->bs = hd0; else s->bs = hd1; if (s->bs) { bdrv_get_geometry(s->bs, &nb_sectors); bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); s->cylinders = cylinders; s->heads = heads; s->sectors = secs; s->nb_sectors = nb_sectors; if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { s->is_cdrom = 1; bdrv_set_change_cb(s->bs, cdrom_change_cb, s); } } s->drive_serial = drive_serial++; strncpy(s->drive_serial_str, drive_get_serial(s->bs), sizeof(s->drive_serial_str)); if (strlen(s->drive_serial_str) == 0) snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), "QM%05d", s->drive_serial); s->irq = irq; s->sector_write_timer = qemu_new_timer(vm_clock, ide_sector_write_timer_cb, s); ide_reset(s); } }
{ "code": [], "line_no": [] }
static void FUNC_0(IDEState *VAR_0, BlockDriverState *VAR_1, BlockDriverState *VAR_2, qemu_irq VAR_3) { IDEState *s; static int VAR_4 = 1; int VAR_5, VAR_6, VAR_7, VAR_8; uint64_t nb_sectors; for(VAR_5 = 0; VAR_5 < 2; VAR_5++) { s = VAR_0 + VAR_5; s->io_buffer = qemu_memalign(512, IDE_DMA_BUF_SECTORS*512 + 4); if (VAR_5 == 0) s->bs = VAR_1; else s->bs = VAR_2; if (s->bs) { bdrv_get_geometry(s->bs, &nb_sectors); bdrv_guess_geometry(s->bs, &VAR_6, &VAR_7, &VAR_8); s->VAR_6 = VAR_6; s->VAR_7 = VAR_7; s->sectors = VAR_8; s->nb_sectors = nb_sectors; if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { s->is_cdrom = 1; bdrv_set_change_cb(s->bs, cdrom_change_cb, s); } } s->VAR_4 = VAR_4++; strncpy(s->drive_serial_str, drive_get_serial(s->bs), sizeof(s->drive_serial_str)); if (strlen(s->drive_serial_str) == 0) snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), "QM%05d", s->VAR_4); s->VAR_3 = VAR_3; s->sector_write_timer = qemu_new_timer(vm_clock, ide_sector_write_timer_cb, s); ide_reset(s); } }
[ "static void FUNC_0(IDEState *VAR_0,\nBlockDriverState *VAR_1, BlockDriverState *VAR_2,\nqemu_irq VAR_3)\n{", "IDEState *s;", "static int VAR_4 = 1;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "uint64_t nb_sectors;", "for(VAR_5 = 0; VAR_5 < 2; VAR_5++) {", "s = VAR_0 + VAR_5;", "s->io_buffer = qemu_memalign(512, IDE_DMA_BUF_SECTORS*512 + 4);", "if (VAR_5 == 0)\ns->bs = VAR_1;", "else\ns->bs = VAR_2;", "if (s->bs) {", "bdrv_get_geometry(s->bs, &nb_sectors);", "bdrv_guess_geometry(s->bs, &VAR_6, &VAR_7, &VAR_8);", "s->VAR_6 = VAR_6;", "s->VAR_7 = VAR_7;", "s->sectors = VAR_8;", "s->nb_sectors = nb_sectors;", "if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {", "s->is_cdrom = 1;", "bdrv_set_change_cb(s->bs, cdrom_change_cb, s);", "}", "}", "s->VAR_4 = VAR_4++;", "strncpy(s->drive_serial_str, drive_get_serial(s->bs),\nsizeof(s->drive_serial_str));", "if (strlen(s->drive_serial_str) == 0)\nsnprintf(s->drive_serial_str, sizeof(s->drive_serial_str),\n\"QM%05d\", s->VAR_4);", "s->VAR_3 = VAR_3;", "s->sector_write_timer = qemu_new_timer(vm_clock,\nide_sector_write_timer_cb, s);", "ide_reset(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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ] ]
9,806
static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply) { uint8_t buf[NBD_REPLY_SIZE]; reply->error = system_errno_to_nbd_errno(reply->error); TRACE("Sending response to client: { .error = %" PRId32 ", handle = %" PRIu64 " }", reply->error, reply->handle); /* Reply [ 0 .. 3] magic (NBD_REPLY_MAGIC) [ 4 .. 7] error (0 == no error) [ 7 .. 15] handle */ stl_be_p(buf, NBD_REPLY_MAGIC); stl_be_p(buf + 4, reply->error); stq_be_p(buf + 8, reply->handle); return write_sync(ioc, buf, sizeof(buf), NULL); }
false
qemu
d1fdf257d52822695f5ace6c586e059aa17d4b79
static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply) { uint8_t buf[NBD_REPLY_SIZE]; reply->error = system_errno_to_nbd_errno(reply->error); TRACE("Sending response to client: { .error = %" PRId32 ", handle = %" PRIu64 " }", reply->error, reply->handle); stl_be_p(buf, NBD_REPLY_MAGIC); stl_be_p(buf + 4, reply->error); stq_be_p(buf + 8, reply->handle); return write_sync(ioc, buf, sizeof(buf), NULL); }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(QIOChannel *ioc, NBDReply *reply) { uint8_t buf[NBD_REPLY_SIZE]; reply->error = system_errno_to_nbd_errno(reply->error); TRACE("Sending response to client: { .error = %" PRId32 ", handle = %" PRIu64 " }", reply->error, reply->handle); stl_be_p(buf, NBD_REPLY_MAGIC); stl_be_p(buf + 4, reply->error); stq_be_p(buf + 8, reply->handle); return write_sync(ioc, buf, sizeof(buf), NULL); }
[ "static ssize_t FUNC_0(QIOChannel *ioc, NBDReply *reply)\n{", "uint8_t buf[NBD_REPLY_SIZE];", "reply->error = system_errno_to_nbd_errno(reply->error);", "TRACE(\"Sending response to client: { .error = %\" PRId32", "\", handle = %\" PRIu64 \" }\",", "reply->error, reply->handle);", "stl_be_p(buf, NBD_REPLY_MAGIC);", "stl_be_p(buf + 4, reply->error);", "stq_be_p(buf + 8, reply->handle);", "return write_sync(ioc, buf, sizeof(buf), NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
9,807
static void q35_host_get_pci_hole64_end(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { PCIHostState *h = PCI_HOST_BRIDGE(obj); Range w64; pci_bus_get_w64_range(h->bus, &w64); visit_type_uint64(v, name, &w64.end, errp); }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
static void q35_host_get_pci_hole64_end(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { PCIHostState *h = PCI_HOST_BRIDGE(obj); Range w64; pci_bus_get_w64_range(h->bus, &w64); visit_type_uint64(v, name, &w64.end, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2, void *VAR_3, Error **VAR_4) { PCIHostState *h = PCI_HOST_BRIDGE(VAR_0); Range w64; pci_bus_get_w64_range(h->bus, &w64); visit_type_uint64(VAR_1, VAR_2, &w64.end, VAR_4); }
[ "static void FUNC_0(Object *VAR_0, Visitor *VAR_1,\nconst char *VAR_2, void *VAR_3,\nError **VAR_4)\n{", "PCIHostState *h = PCI_HOST_BRIDGE(VAR_0);", "Range w64;", "pci_bus_get_w64_range(h->bus, &w64);", "visit_type_uint64(VAR_1, VAR_2, &w64.end, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ] ]
9,808
static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque, bool is_write) { Coroutine *co; BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; acb->req.sector = sector_num; acb->req.nb_sectors = nb_sectors; acb->req.qiov = qiov; acb->req.flags = flags; acb->is_write = is_write; co = qemu_coroutine_create(bdrv_co_do_rw); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque, bool is_write) { Coroutine *co; BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; acb->req.sector = sector_num; acb->req.nb_sectors = nb_sectors; acb->req.qiov = qiov; acb->req.flags = flags; acb->is_write = is_write; co = qemu_coroutine_create(bdrv_co_do_rw); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
{ "code": [], "line_no": [] }
static BlockAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque, bool is_write) { Coroutine *co; BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; acb->req.sector = sector_num; acb->req.nb_sectors = nb_sectors; acb->req.qiov = qiov; acb->req.flags = flags; acb->is_write = is_write; co = qemu_coroutine_create(bdrv_co_do_rw); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
[ "static BlockAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num,\nQEMUIOVector *qiov,\nint nb_sectors,\nBdrvRequestFlags flags,\nBlockCompletionFunc *cb,\nvoid *opaque,\nbool is_write)\n{", "Coroutine *co;", "BlockAIOCBCoroutine *acb;", "acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);", "acb->need_bh = true;", "acb->req.error = -EINPROGRESS;", "acb->req.sector = sector_num;", "acb->req.nb_sectors = nb_sectors;", "acb->req.qiov = qiov;", "acb->req.flags = flags;", "acb->is_write = is_write;", "co = qemu_coroutine_create(bdrv_co_do_rw);", "qemu_coroutine_enter(co, acb);", "bdrv_co_maybe_schedule_bh(acb);", "return &acb->common;", "}" ]
[ 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 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ] ]
9,809
static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { *pnum = nb_sectors; return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA | (sector_num << BDRV_SECTOR_BITS); }
false
qemu
67a0fd2a9bca204d2b39f910a97c7137636a0715
static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { *pnum = nb_sectors; return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA | (sector_num << BDRV_SECTOR_BITS); }
{ "code": [], "line_no": [] }
static int64_t VAR_0 raw_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { *pnum = nb_sectors; return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA | (sector_num << BDRV_SECTOR_BITS); }
[ "static int64_t VAR_0 raw_co_get_block_status(BlockDriverState *bs,\nint64_t sector_num,\nint nb_sectors, int *pnum)\n{", "*pnum = nb_sectors;", "return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA |\n(sector_num << BDRV_SECTOR_BITS);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11, 13 ], [ 15 ] ]
9,810
static inline int check_fit_tl(tcg_target_long val, unsigned int bits) { return (val << ((sizeof(tcg_target_long) * 8 - bits)) >> (sizeof(tcg_target_long) * 8 - bits)) == val; }
false
qemu
425532d71d5d295cc9c649500e4969ac621ce51d
static inline int check_fit_tl(tcg_target_long val, unsigned int bits) { return (val << ((sizeof(tcg_target_long) * 8 - bits)) >> (sizeof(tcg_target_long) * 8 - bits)) == val; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(tcg_target_long VAR_0, unsigned int VAR_1) { return (VAR_0 << ((sizeof(tcg_target_long) * 8 - VAR_1)) >> (sizeof(tcg_target_long) * 8 - VAR_1)) == VAR_0; }
[ "static inline int FUNC_0(tcg_target_long VAR_0, unsigned int VAR_1)\n{", "return (VAR_0 << ((sizeof(tcg_target_long) * 8 - VAR_1))\n>> (sizeof(tcg_target_long) * 8 - VAR_1)) == VAR_0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
9,811
int av_cold ff_celt_pvq_init(CeltPVQ **pvq, int encode) { CeltPVQ *s = av_malloc(sizeof(CeltPVQ)); if (!s) return AVERROR(ENOMEM); s->pvq_search = ppp_pvq_search_c; s->quant_band = encode ? pvq_encode_band : pvq_decode_band; s->band_cost = pvq_band_cost; if (ARCH_X86) ff_opus_dsp_init_x86(s); *pvq = s; return 0; }
false
FFmpeg
7b46add7257628bffac96d3002308d1f9e1ed172
int av_cold ff_celt_pvq_init(CeltPVQ **pvq, int encode) { CeltPVQ *s = av_malloc(sizeof(CeltPVQ)); if (!s) return AVERROR(ENOMEM); s->pvq_search = ppp_pvq_search_c; s->quant_band = encode ? pvq_encode_band : pvq_decode_band; s->band_cost = pvq_band_cost; if (ARCH_X86) ff_opus_dsp_init_x86(s); *pvq = s; return 0; }
{ "code": [], "line_no": [] }
int VAR_0 ff_celt_pvq_init(CeltPVQ **pvq, int encode) { CeltPVQ *s = av_malloc(sizeof(CeltPVQ)); if (!s) return AVERROR(ENOMEM); s->pvq_search = ppp_pvq_search_c; s->quant_band = encode ? pvq_encode_band : pvq_decode_band; s->band_cost = pvq_band_cost; if (ARCH_X86) ff_opus_dsp_init_x86(s); *pvq = s; return 0; }
[ "int VAR_0 ff_celt_pvq_init(CeltPVQ **pvq, int encode)\n{", "CeltPVQ *s = av_malloc(sizeof(CeltPVQ));", "if (!s)\nreturn AVERROR(ENOMEM);", "s->pvq_search = ppp_pvq_search_c;", "s->quant_band = encode ? pvq_encode_band : pvq_decode_band;", "s->band_cost = pvq_band_cost;", "if (ARCH_X86)\nff_opus_dsp_init_x86(s);", "*pvq = s;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 31 ], [ 33 ] ]
9,812
static off_t v9fs_synth_telldir(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open = fs->private; return synth_open->offset; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static off_t v9fs_synth_telldir(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open = fs->private; return synth_open->offset; }
{ "code": [], "line_no": [] }
static off_t FUNC_0(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open = fs->private; return synth_open->offset; }
[ "static off_t FUNC_0(FsContext *ctx, V9fsFidOpenState *fs)\n{", "V9fsSynthOpenState *synth_open = fs->private;", "return synth_open->offset;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
9,813
bool gs_allowed(void) { if (kvm_enabled()) { MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); if (object_class_dynamic_cast(OBJECT_CLASS(mc), TYPE_S390_CCW_MACHINE)) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); return s390mc->gs_allowed; } /* Make sure the "none" machine can have gs */ return true; } return false; }
false
qemu
c50f65118b429e6847d5c11b1a20a560d61c34b7
bool gs_allowed(void) { if (kvm_enabled()) { MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); if (object_class_dynamic_cast(OBJECT_CLASS(mc), TYPE_S390_CCW_MACHINE)) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); return s390mc->gs_allowed; } return true; } return false; }
{ "code": [], "line_no": [] }
bool FUNC_0(void) { if (kvm_enabled()) { MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); if (object_class_dynamic_cast(OBJECT_CLASS(mc), TYPE_S390_CCW_MACHINE)) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); return s390mc->FUNC_0; } return true; } return false; }
[ "bool FUNC_0(void)\n{", "if (kvm_enabled()) {", "MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());", "if (object_class_dynamic_cast(OBJECT_CLASS(mc),\nTYPE_S390_CCW_MACHINE)) {", "S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);", "return s390mc->FUNC_0;", "}", "return true;", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
9,814
tight_filter_gradient24(VncState *vs, uint8_t *buf, int w, int h) { uint32_t *buf32; uint32_t pix32; int shift[3]; int *prev; int here[3], upper[3], left[3], upperleft[3]; int prediction; int x, y, c; buf32 = (uint32_t *)buf; memset(vs->tight_gradient.buffer, 0, w * 3 * sizeof(int)); if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) == (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) { shift[0] = vs->clientds.pf.rshift; shift[1] = vs->clientds.pf.gshift; shift[2] = vs->clientds.pf.bshift; } else { shift[0] = 24 - vs->clientds.pf.rshift; shift[1] = 24 - vs->clientds.pf.gshift; shift[2] = 24 - vs->clientds.pf.bshift; } for (y = 0; y < h; y++) { for (c = 0; c < 3; c++) { upper[c] = 0; here[c] = 0; } prev = (int *)vs->tight_gradient.buffer; for (x = 0; x < w; x++) { pix32 = *buf32++; for (c = 0; c < 3; c++) { upperleft[c] = upper[c]; left[c] = here[c]; upper[c] = *prev; here[c] = (int)(pix32 >> shift[c] & 0xFF); *prev++ = here[c]; prediction = left[c] + upper[c] - upperleft[c]; if (prediction < 0) { prediction = 0; } else if (prediction > 0xFF) { prediction = 0xFF; } *buf++ = (char)(here[c] - prediction); } } } }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
tight_filter_gradient24(VncState *vs, uint8_t *buf, int w, int h) { uint32_t *buf32; uint32_t pix32; int shift[3]; int *prev; int here[3], upper[3], left[3], upperleft[3]; int prediction; int x, y, c; buf32 = (uint32_t *)buf; memset(vs->tight_gradient.buffer, 0, w * 3 * sizeof(int)); if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) == (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) { shift[0] = vs->clientds.pf.rshift; shift[1] = vs->clientds.pf.gshift; shift[2] = vs->clientds.pf.bshift; } else { shift[0] = 24 - vs->clientds.pf.rshift; shift[1] = 24 - vs->clientds.pf.gshift; shift[2] = 24 - vs->clientds.pf.bshift; } for (y = 0; y < h; y++) { for (c = 0; c < 3; c++) { upper[c] = 0; here[c] = 0; } prev = (int *)vs->tight_gradient.buffer; for (x = 0; x < w; x++) { pix32 = *buf32++; for (c = 0; c < 3; c++) { upperleft[c] = upper[c]; left[c] = here[c]; upper[c] = *prev; here[c] = (int)(pix32 >> shift[c] & 0xFF); *prev++ = here[c]; prediction = left[c] + upper[c] - upperleft[c]; if (prediction < 0) { prediction = 0; } else if (prediction > 0xFF) { prediction = 0xFF; } *buf++ = (char)(here[c] - prediction); } } } }
{ "code": [], "line_no": [] }
FUNC_0(VncState *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3) { uint32_t *buf32; uint32_t pix32; int VAR_4[3]; int *VAR_5; int VAR_6[3], VAR_7[3], VAR_8[3], VAR_9[3]; int VAR_10; int VAR_11, VAR_12, VAR_13; buf32 = (uint32_t *)VAR_1; memset(VAR_0->tight_gradient.buffer, 0, VAR_2 * 3 * sizeof(int)); if ((VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG) == (VAR_0->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) { VAR_4[0] = VAR_0->clientds.pf.rshift; VAR_4[1] = VAR_0->clientds.pf.gshift; VAR_4[2] = VAR_0->clientds.pf.bshift; } else { VAR_4[0] = 24 - VAR_0->clientds.pf.rshift; VAR_4[1] = 24 - VAR_0->clientds.pf.gshift; VAR_4[2] = 24 - VAR_0->clientds.pf.bshift; } for (VAR_12 = 0; VAR_12 < VAR_3; VAR_12++) { for (VAR_13 = 0; VAR_13 < 3; VAR_13++) { VAR_7[VAR_13] = 0; VAR_6[VAR_13] = 0; } VAR_5 = (int *)VAR_0->tight_gradient.buffer; for (VAR_11 = 0; VAR_11 < VAR_2; VAR_11++) { pix32 = *buf32++; for (VAR_13 = 0; VAR_13 < 3; VAR_13++) { VAR_9[VAR_13] = VAR_7[VAR_13]; VAR_8[VAR_13] = VAR_6[VAR_13]; VAR_7[VAR_13] = *VAR_5; VAR_6[VAR_13] = (int)(pix32 >> VAR_4[VAR_13] & 0xFF); *VAR_5++ = VAR_6[VAR_13]; VAR_10 = VAR_8[VAR_13] + VAR_7[VAR_13] - VAR_9[VAR_13]; if (VAR_10 < 0) { VAR_10 = 0; } else if (VAR_10 > 0xFF) { VAR_10 = 0xFF; } *VAR_1++ = (char)(VAR_6[VAR_13] - VAR_10); } } } }
[ "FUNC_0(VncState *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "uint32_t *buf32;", "uint32_t pix32;", "int VAR_4[3];", "int *VAR_5;", "int VAR_6[3], VAR_7[3], VAR_8[3], VAR_9[3];", "int VAR_10;", "int VAR_11, VAR_12, VAR_13;", "buf32 = (uint32_t *)VAR_1;", "memset(VAR_0->tight_gradient.buffer, 0, VAR_2 * 3 * sizeof(int));", "if ((VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==\n(VAR_0->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) {", "VAR_4[0] = VAR_0->clientds.pf.rshift;", "VAR_4[1] = VAR_0->clientds.pf.gshift;", "VAR_4[2] = VAR_0->clientds.pf.bshift;", "} else {", "VAR_4[0] = 24 - VAR_0->clientds.pf.rshift;", "VAR_4[1] = 24 - VAR_0->clientds.pf.gshift;", "VAR_4[2] = 24 - VAR_0->clientds.pf.bshift;", "}", "for (VAR_12 = 0; VAR_12 < VAR_3; VAR_12++) {", "for (VAR_13 = 0; VAR_13 < 3; VAR_13++) {", "VAR_7[VAR_13] = 0;", "VAR_6[VAR_13] = 0;", "}", "VAR_5 = (int *)VAR_0->tight_gradient.buffer;", "for (VAR_11 = 0; VAR_11 < VAR_2; VAR_11++) {", "pix32 = *buf32++;", "for (VAR_13 = 0; VAR_13 < 3; VAR_13++) {", "VAR_9[VAR_13] = VAR_7[VAR_13];", "VAR_8[VAR_13] = VAR_6[VAR_13];", "VAR_7[VAR_13] = *VAR_5;", "VAR_6[VAR_13] = (int)(pix32 >> VAR_4[VAR_13] & 0xFF);", "*VAR_5++ = VAR_6[VAR_13];", "VAR_10 = VAR_8[VAR_13] + VAR_7[VAR_13] - VAR_9[VAR_13];", "if (VAR_10 < 0) {", "VAR_10 = 0;", "} else if (VAR_10 > 0xFF) {", "VAR_10 = 0xFF;", "}", "*VAR_1++ = (char)(VAR_6[VAR_13] - VAR_10);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
9,815
static void qmp_output_type_uint64(Visitor *v, const char *name, uint64_t *obj, Error **errp) { /* FIXME values larger than INT64_MAX become negative */ QmpOutputVisitor *qov = to_qov(v); qmp_output_add(qov, name, qint_from_int(*obj)); }
false
qemu
7d5e199ade76c53ec316ab6779800581bb47c50a
static void qmp_output_type_uint64(Visitor *v, const char *name, uint64_t *obj, Error **errp) { QmpOutputVisitor *qov = to_qov(v); qmp_output_add(qov, name, qint_from_int(*obj)); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, uint64_t *VAR_2, Error **VAR_3) { QmpOutputVisitor *qov = to_qov(VAR_0); qmp_output_add(qov, VAR_1, qint_from_int(*VAR_2)); }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, uint64_t *VAR_2,\nError **VAR_3)\n{", "QmpOutputVisitor *qov = to_qov(VAR_0);", "qmp_output_add(qov, VAR_1, qint_from_int(*VAR_2));", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 9 ], [ 11 ], [ 13 ] ]
9,816
static void bh_run_aio_completions(void *opaque) { QEMUBH **bh = opaque; qemu_bh_delete(*bh); qemu_free(bh); qemu_aio_process_queue(); }
false
qemu
384acbf46b70edf0d2c1648aa1a92a90bcf7057d
static void bh_run_aio_completions(void *opaque) { QEMUBH **bh = opaque; qemu_bh_delete(*bh); qemu_free(bh); qemu_aio_process_queue(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { QEMUBH **bh = VAR_0; qemu_bh_delete(*bh); qemu_free(bh); qemu_aio_process_queue(); }
[ "static void FUNC_0(void *VAR_0)\n{", "QEMUBH **bh = VAR_0;", "qemu_bh_delete(*bh);", "qemu_free(bh);", "qemu_aio_process_queue();", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
9,818
long do_rt_sigreturn(CPUARMState *env) { struct target_rt_sigframe *frame = NULL; abi_ulong frame_addr = env->xregs[31]; trace_user_do_rt_sigreturn(env, frame_addr); if (frame_addr & 15) { goto badframe; } if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } if (target_restore_sigframe(env, frame)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return env->xregs[0]; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
false
qemu
f0267ef7115656119bf00ed77857789adc036bda
long do_rt_sigreturn(CPUARMState *env) { struct target_rt_sigframe *frame = NULL; abi_ulong frame_addr = env->xregs[31]; trace_user_do_rt_sigreturn(env, frame_addr); if (frame_addr & 15) { goto badframe; } if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } if (target_restore_sigframe(env, frame)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return env->xregs[0]; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
{ "code": [], "line_no": [] }
long FUNC_0(CPUARMState *VAR_0) { struct target_rt_sigframe *VAR_1 = NULL; abi_ulong frame_addr = VAR_0->xregs[31]; trace_user_do_rt_sigreturn(VAR_0, frame_addr); if (frame_addr & 15) { goto badframe; } if (!lock_user_struct(VERIFY_READ, VAR_1, frame_addr, 1)) { goto badframe; } if (target_restore_sigframe(VAR_0, VAR_1)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(VAR_0)) == -EFAULT) { goto badframe; } unlock_user_struct(VAR_1, frame_addr, 0); return VAR_0->xregs[0]; badframe: unlock_user_struct(VAR_1, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
[ "long FUNC_0(CPUARMState *VAR_0)\n{", "struct target_rt_sigframe *VAR_1 = NULL;", "abi_ulong frame_addr = VAR_0->xregs[31];", "trace_user_do_rt_sigreturn(VAR_0, frame_addr);", "if (frame_addr & 15) {", "goto badframe;", "}", "if (!lock_user_struct(VERIFY_READ, VAR_1, frame_addr, 1)) {", "goto badframe;", "}", "if (target_restore_sigframe(VAR_0, VAR_1)) {", "goto badframe;", "}", "if (do_sigaltstack(frame_addr +\noffsetof(struct target_rt_sigframe, uc.tuc_stack),\n0, get_sp_from_cpustate(VAR_0)) == -EFAULT) {", "goto badframe;", "}", "unlock_user_struct(VAR_1, frame_addr, 0);", "return VAR_0->xregs[0];", "badframe:\nunlock_user_struct(VAR_1, frame_addr, 0);", "force_sig(TARGET_SIGSEGV);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ] ]
9,819
static void update(NUTContext *nut, int stream_index, int64_t frame_start, int frame_type, int frame_code, int key_frame, int size, int64_t pts){ StreamContext *stream= &nut->stream[stream_index]; stream->last_key_frame= key_frame; nut->last_frame_start[ frame_type ]= frame_start; update_lru(stream->lru_pts_delta, pts - stream->last_pts, 3); update_lru(stream->lru_size , size, 2); stream->last_pts= pts; if( nut->frame_code[frame_code].flags & FLAG_PTS && nut->frame_code[frame_code].flags & FLAG_FULL_PTS) stream->last_full_pts= pts; }
false
FFmpeg
465e1dadbef7596a3eb87089a66bb4ecdc26d3c4
static void update(NUTContext *nut, int stream_index, int64_t frame_start, int frame_type, int frame_code, int key_frame, int size, int64_t pts){ StreamContext *stream= &nut->stream[stream_index]; stream->last_key_frame= key_frame; nut->last_frame_start[ frame_type ]= frame_start; update_lru(stream->lru_pts_delta, pts - stream->last_pts, 3); update_lru(stream->lru_size , size, 2); stream->last_pts= pts; if( nut->frame_code[frame_code].flags & FLAG_PTS && nut->frame_code[frame_code].flags & FLAG_FULL_PTS) stream->last_full_pts= pts; }
{ "code": [], "line_no": [] }
static void FUNC_0(NUTContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int64_t VAR_7){ StreamContext *stream= &VAR_0->stream[VAR_1]; stream->last_key_frame= VAR_5; VAR_0->last_frame_start[ VAR_3 ]= VAR_2; update_lru(stream->lru_pts_delta, VAR_7 - stream->last_pts, 3); update_lru(stream->lru_size , VAR_6, 2); stream->last_pts= VAR_7; if( VAR_0->VAR_4[VAR_4].flags & FLAG_PTS && VAR_0->VAR_4[VAR_4].flags & FLAG_FULL_PTS) stream->last_full_pts= VAR_7; }
[ "static void FUNC_0(NUTContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int64_t VAR_7){", "StreamContext *stream= &VAR_0->stream[VAR_1];", "stream->last_key_frame= VAR_5;", "VAR_0->last_frame_start[ VAR_3 ]= VAR_2;", "update_lru(stream->lru_pts_delta, VAR_7 - stream->last_pts, 3);", "update_lru(stream->lru_size , VAR_6, 2);", "stream->last_pts= VAR_7;", "if( VAR_0->VAR_4[VAR_4].flags & FLAG_PTS\n&& VAR_0->VAR_4[VAR_4].flags & FLAG_FULL_PTS)\nstream->last_full_pts= VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ] ]
9,820
void ff_rv34dsp_init_neon(RV34DSPContext *c, DSPContext* dsp) { c->rv34_inv_transform = ff_rv34_inv_transform_noround_neon; c->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon; c->rv34_idct_add = ff_rv34_idct_add_neon; c->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon; }
false
FFmpeg
507dce2536fea4b78a9f4973f77e1fa20cfe1b81
void ff_rv34dsp_init_neon(RV34DSPContext *c, DSPContext* dsp) { c->rv34_inv_transform = ff_rv34_inv_transform_noround_neon; c->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon; c->rv34_idct_add = ff_rv34_idct_add_neon; c->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon; }
{ "code": [], "line_no": [] }
void FUNC_0(RV34DSPContext *VAR_0, DSPContext* VAR_1) { VAR_0->rv34_inv_transform = ff_rv34_inv_transform_noround_neon; VAR_0->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon; VAR_0->rv34_idct_add = ff_rv34_idct_add_neon; VAR_0->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon; }
[ "void FUNC_0(RV34DSPContext *VAR_0, DSPContext* VAR_1)\n{", "VAR_0->rv34_inv_transform = ff_rv34_inv_transform_noround_neon;", "VAR_0->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon;", "VAR_0->rv34_idct_add = ff_rv34_idct_add_neon;", "VAR_0->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
9,821
static int request_samples(AVFilterContext *ctx, int min_samples) { MixContext *s = ctx->priv; int i, ret; av_assert0(s->nb_inputs > 1); for (i = 1; i < s->nb_inputs; i++) { ret = 0; if (!(s->input_state[i] & INPUT_ON)) continue; if (av_audio_fifo_size(s->fifos[i]) >= min_samples) continue; ret = ff_request_frame(ctx->inputs[i]); if (ret == AVERROR_EOF) { s->input_state[i] |= INPUT_EOF; if (av_audio_fifo_size(s->fifos[i]) == 0) { s->input_state[i] = 0; continue; } } else if (ret < 0) return ret; } return output_frame(ctx->outputs[0], 1); }
false
FFmpeg
15e9c4afdc8efbf8da86bb3f7eaf374310b44bf8
static int request_samples(AVFilterContext *ctx, int min_samples) { MixContext *s = ctx->priv; int i, ret; av_assert0(s->nb_inputs > 1); for (i = 1; i < s->nb_inputs; i++) { ret = 0; if (!(s->input_state[i] & INPUT_ON)) continue; if (av_audio_fifo_size(s->fifos[i]) >= min_samples) continue; ret = ff_request_frame(ctx->inputs[i]); if (ret == AVERROR_EOF) { s->input_state[i] |= INPUT_EOF; if (av_audio_fifo_size(s->fifos[i]) == 0) { s->input_state[i] = 0; continue; } } else if (ret < 0) return ret; } return output_frame(ctx->outputs[0], 1); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0, int VAR_1) { MixContext *s = VAR_0->priv; int VAR_2, VAR_3; av_assert0(s->nb_inputs > 1); for (VAR_2 = 1; VAR_2 < s->nb_inputs; VAR_2++) { VAR_3 = 0; if (!(s->input_state[VAR_2] & INPUT_ON)) continue; if (av_audio_fifo_size(s->fifos[VAR_2]) >= VAR_1) continue; VAR_3 = ff_request_frame(VAR_0->inputs[VAR_2]); if (VAR_3 == AVERROR_EOF) { s->input_state[VAR_2] |= INPUT_EOF; if (av_audio_fifo_size(s->fifos[VAR_2]) == 0) { s->input_state[VAR_2] = 0; continue; } } else if (VAR_3 < 0) return VAR_3; } return output_frame(VAR_0->outputs[0], 1); }
[ "static int FUNC_0(AVFilterContext *VAR_0, int VAR_1)\n{", "MixContext *s = VAR_0->priv;", "int VAR_2, VAR_3;", "av_assert0(s->nb_inputs > 1);", "for (VAR_2 = 1; VAR_2 < s->nb_inputs; VAR_2++) {", "VAR_3 = 0;", "if (!(s->input_state[VAR_2] & INPUT_ON))\ncontinue;", "if (av_audio_fifo_size(s->fifos[VAR_2]) >= VAR_1)\ncontinue;", "VAR_3 = ff_request_frame(VAR_0->inputs[VAR_2]);", "if (VAR_3 == AVERROR_EOF) {", "s->input_state[VAR_2] |= INPUT_EOF;", "if (av_audio_fifo_size(s->fifos[VAR_2]) == 0) {", "s->input_state[VAR_2] = 0;", "continue;", "}", "} else if (VAR_3 < 0)", "return VAR_3;", "}", "return output_frame(VAR_0->outputs[0], 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 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
9,822
void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/){ int i, dc = (block[0] + 15) >> 5; for(i = 0; i < 8; i++){ dest[0] = av_clip_uint8(dest[0] + dc); dest[1] = av_clip_uint8(dest[1] + dc); dest[2] = av_clip_uint8(dest[2] + dc); dest[3] = av_clip_uint8(dest[3] + dc); dest[4] = av_clip_uint8(dest[4] + dc); dest[5] = av_clip_uint8(dest[5] + dc); dest[6] = av_clip_uint8(dest[6] + dc); dest[7] = av_clip_uint8(dest[7] + dc); dest += line_size; } }
false
FFmpeg
28f9ab7029bd1a02f659995919f899f84ee7361b
void ff_vp3_idct_dc_add_c(uint8_t *dest, int line_size, const DCTELEM *block){ int i, dc = (block[0] + 15) >> 5; for(i = 0; i < 8; i++){ dest[0] = av_clip_uint8(dest[0] + dc); dest[1] = av_clip_uint8(dest[1] + dc); dest[2] = av_clip_uint8(dest[2] + dc); dest[3] = av_clip_uint8(dest[3] + dc); dest[4] = av_clip_uint8(dest[4] + dc); dest[5] = av_clip_uint8(dest[5] + dc); dest[6] = av_clip_uint8(dest[6] + dc); dest[7] = av_clip_uint8(dest[7] + dc); dest += line_size; } }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, int VAR_1, const DCTELEM *VAR_2){ int VAR_3, VAR_4 = (VAR_2[0] + 15) >> 5; for(VAR_3 = 0; VAR_3 < 8; VAR_3++){ VAR_0[0] = av_clip_uint8(VAR_0[0] + VAR_4); VAR_0[1] = av_clip_uint8(VAR_0[1] + VAR_4); VAR_0[2] = av_clip_uint8(VAR_0[2] + VAR_4); VAR_0[3] = av_clip_uint8(VAR_0[3] + VAR_4); VAR_0[4] = av_clip_uint8(VAR_0[4] + VAR_4); VAR_0[5] = av_clip_uint8(VAR_0[5] + VAR_4); VAR_0[6] = av_clip_uint8(VAR_0[6] + VAR_4); VAR_0[7] = av_clip_uint8(VAR_0[7] + VAR_4); VAR_0 += VAR_1; } }
[ "void FUNC_0(uint8_t *VAR_0, int VAR_1, const DCTELEM *VAR_2){", "int VAR_3, VAR_4 = (VAR_2[0] + 15) >> 5;", "for(VAR_3 = 0; VAR_3 < 8; VAR_3++){", "VAR_0[0] = av_clip_uint8(VAR_0[0] + VAR_4);", "VAR_0[1] = av_clip_uint8(VAR_0[1] + VAR_4);", "VAR_0[2] = av_clip_uint8(VAR_0[2] + VAR_4);", "VAR_0[3] = av_clip_uint8(VAR_0[3] + VAR_4);", "VAR_0[4] = av_clip_uint8(VAR_0[4] + VAR_4);", "VAR_0[5] = av_clip_uint8(VAR_0[5] + VAR_4);", "VAR_0[6] = av_clip_uint8(VAR_0[6] + VAR_4);", "VAR_0[7] = av_clip_uint8(VAR_0[7] + VAR_4);", "VAR_0 += VAR_1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
9,823
static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; const enum AVPixelFormat *pix_fmts; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if (avctx->xvmc_acceleration) return ff_get_format(avctx, pixfmt_xvmc_mpg2_420); FF_ENABLE_DEPRECATION_WARNINGS #endif /* FF_API_XVMC */ if (s->chroma_format < 2) pix_fmts = mpeg12_hwaccel_pixfmt_list_420; else if (s->chroma_format == 2) pix_fmts = mpeg12_pixfmt_list_422; else pix_fmts = mpeg12_pixfmt_list_444; return ff_get_format(avctx, pix_fmts); }
false
FFmpeg
dcc39ee10e82833ce24aa57926c00ffeb1948198
static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; const enum AVPixelFormat *pix_fmts; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if (avctx->xvmc_acceleration) return ff_get_format(avctx, pixfmt_xvmc_mpg2_420); FF_ENABLE_DEPRECATION_WARNINGS #endif if (s->chroma_format < 2) pix_fmts = mpeg12_hwaccel_pixfmt_list_420; else if (s->chroma_format == 2) pix_fmts = mpeg12_pixfmt_list_422; else pix_fmts = mpeg12_pixfmt_list_444; return ff_get_format(avctx, pix_fmts); }
{ "code": [], "line_no": [] }
static enum AVPixelFormat FUNC_0(AVCodecContext *VAR_0) { Mpeg1Context *s1 = VAR_0->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; const enum AVPixelFormat *VAR_1; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if (VAR_0->xvmc_acceleration) return ff_get_format(VAR_0, pixfmt_xvmc_mpg2_420); FF_ENABLE_DEPRECATION_WARNINGS #endif if (s->chroma_format < 2) VAR_1 = mpeg12_hwaccel_pixfmt_list_420; else if (s->chroma_format == 2) VAR_1 = mpeg12_pixfmt_list_422; else VAR_1 = mpeg12_pixfmt_list_444; return ff_get_format(VAR_0, VAR_1); }
[ "static enum AVPixelFormat FUNC_0(AVCodecContext *VAR_0)\n{", "Mpeg1Context *s1 = VAR_0->priv_data;", "MpegEncContext *s = &s1->mpeg_enc_ctx;", "const enum AVPixelFormat *VAR_1;", "#if FF_API_XVMC\nFF_DISABLE_DEPRECATION_WARNINGS\nif (VAR_0->xvmc_acceleration)\nreturn ff_get_format(VAR_0, pixfmt_xvmc_mpg2_420);", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nif (s->chroma_format < 2)\nVAR_1 = mpeg12_hwaccel_pixfmt_list_420;", "else if (s->chroma_format == 2)\nVAR_1 = mpeg12_pixfmt_list_422;", "else\nVAR_1 = mpeg12_pixfmt_list_444;", "return ff_get_format(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15, 17, 19 ], [ 21, 23, 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 41 ], [ 43 ] ]
9,824
static int init_tiles(Jpeg2000EncoderContext *s) { int tileno, tilex, tiley, compno; Jpeg2000CodingStyle *codsty = &s->codsty; Jpeg2000QuantStyle *qntsty = &s->qntsty; s->numXtiles = ff_jpeg2000_ceildiv(s->width, s->tile_width); s->numYtiles = ff_jpeg2000_ceildiv(s->height, s->tile_height); s->tile = av_malloc_array(s->numXtiles, s->numYtiles * sizeof(Jpeg2000Tile)); if (!s->tile) return AVERROR(ENOMEM); for (tileno = 0, tiley = 0; tiley < s->numYtiles; tiley++) for (tilex = 0; tilex < s->numXtiles; tilex++, tileno++){ Jpeg2000Tile *tile = s->tile + tileno; tile->comp = av_mallocz_array(s->ncomponents, sizeof(Jpeg2000Component)); if (!tile->comp) return AVERROR(ENOMEM); for (compno = 0; compno < s->ncomponents; compno++){ Jpeg2000Component *comp = tile->comp + compno; int ret, i, j; comp->coord[0][0] = comp->coord_o[0][0] = tilex * s->tile_width; comp->coord[0][1] = comp->coord_o[0][1] = FFMIN((tilex+1)*s->tile_width, s->width); comp->coord[1][0] = comp->coord_o[1][0] = tiley * s->tile_height; comp->coord[1][1] = comp->coord_o[1][1] = FFMIN((tiley+1)*s->tile_height, s->height); if (compno > 0) for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) comp->coord[i][j] = comp->coord_o[i][j] = ff_jpeg2000_ceildivpow2(comp->coord[i][j], s->chroma_shift[i]); if (ret = ff_jpeg2000_init_component(comp, codsty, qntsty, s->cbps[compno], compno?1<<s->chroma_shift[0]:1, compno?1<<s->chroma_shift[1]:1, s->avctx )) return ret; } } return 0; }
true
FFmpeg
2580bae54a45d6aaf85ddc5e780389e7e90b2c86
static int init_tiles(Jpeg2000EncoderContext *s) { int tileno, tilex, tiley, compno; Jpeg2000CodingStyle *codsty = &s->codsty; Jpeg2000QuantStyle *qntsty = &s->qntsty; s->numXtiles = ff_jpeg2000_ceildiv(s->width, s->tile_width); s->numYtiles = ff_jpeg2000_ceildiv(s->height, s->tile_height); s->tile = av_malloc_array(s->numXtiles, s->numYtiles * sizeof(Jpeg2000Tile)); if (!s->tile) return AVERROR(ENOMEM); for (tileno = 0, tiley = 0; tiley < s->numYtiles; tiley++) for (tilex = 0; tilex < s->numXtiles; tilex++, tileno++){ Jpeg2000Tile *tile = s->tile + tileno; tile->comp = av_mallocz_array(s->ncomponents, sizeof(Jpeg2000Component)); if (!tile->comp) return AVERROR(ENOMEM); for (compno = 0; compno < s->ncomponents; compno++){ Jpeg2000Component *comp = tile->comp + compno; int ret, i, j; comp->coord[0][0] = comp->coord_o[0][0] = tilex * s->tile_width; comp->coord[0][1] = comp->coord_o[0][1] = FFMIN((tilex+1)*s->tile_width, s->width); comp->coord[1][0] = comp->coord_o[1][0] = tiley * s->tile_height; comp->coord[1][1] = comp->coord_o[1][1] = FFMIN((tiley+1)*s->tile_height, s->height); if (compno > 0) for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) comp->coord[i][j] = comp->coord_o[i][j] = ff_jpeg2000_ceildivpow2(comp->coord[i][j], s->chroma_shift[i]); if (ret = ff_jpeg2000_init_component(comp, codsty, qntsty, s->cbps[compno], compno?1<<s->chroma_shift[0]:1, compno?1<<s->chroma_shift[1]:1, s->avctx )) return ret; } } return 0; }
{ "code": [ " if (ret = ff_jpeg2000_init_component(comp,", " ))" ], "line_no": [ 65, 79 ] }
static int FUNC_0(Jpeg2000EncoderContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4; Jpeg2000CodingStyle *codsty = &VAR_0->codsty; Jpeg2000QuantStyle *qntsty = &VAR_0->qntsty; VAR_0->numXtiles = ff_jpeg2000_ceildiv(VAR_0->width, VAR_0->tile_width); VAR_0->numYtiles = ff_jpeg2000_ceildiv(VAR_0->height, VAR_0->tile_height); VAR_0->tile = av_malloc_array(VAR_0->numXtiles, VAR_0->numYtiles * sizeof(Jpeg2000Tile)); if (!VAR_0->tile) return AVERROR(ENOMEM); for (VAR_1 = 0, VAR_3 = 0; VAR_3 < VAR_0->numYtiles; VAR_3++) for (VAR_2 = 0; VAR_2 < VAR_0->numXtiles; VAR_2++, VAR_1++){ Jpeg2000Tile *tile = VAR_0->tile + VAR_1; tile->comp = av_mallocz_array(VAR_0->ncomponents, sizeof(Jpeg2000Component)); if (!tile->comp) return AVERROR(ENOMEM); for (VAR_4 = 0; VAR_4 < VAR_0->ncomponents; VAR_4++){ Jpeg2000Component *comp = tile->comp + VAR_4; int ret, i, j; comp->coord[0][0] = comp->coord_o[0][0] = VAR_2 * VAR_0->tile_width; comp->coord[0][1] = comp->coord_o[0][1] = FFMIN((VAR_2+1)*VAR_0->tile_width, VAR_0->width); comp->coord[1][0] = comp->coord_o[1][0] = VAR_3 * VAR_0->tile_height; comp->coord[1][1] = comp->coord_o[1][1] = FFMIN((VAR_3+1)*VAR_0->tile_height, VAR_0->height); if (VAR_4 > 0) for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) comp->coord[i][j] = comp->coord_o[i][j] = ff_jpeg2000_ceildivpow2(comp->coord[i][j], VAR_0->chroma_shift[i]); if (ret = ff_jpeg2000_init_component(comp, codsty, qntsty, VAR_0->cbps[VAR_4], VAR_4?1<<VAR_0->chroma_shift[0]:1, VAR_4?1<<VAR_0->chroma_shift[1]:1, VAR_0->avctx )) return ret; } } return 0; }
[ "static int FUNC_0(Jpeg2000EncoderContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4;", "Jpeg2000CodingStyle *codsty = &VAR_0->codsty;", "Jpeg2000QuantStyle *qntsty = &VAR_0->qntsty;", "VAR_0->numXtiles = ff_jpeg2000_ceildiv(VAR_0->width, VAR_0->tile_width);", "VAR_0->numYtiles = ff_jpeg2000_ceildiv(VAR_0->height, VAR_0->tile_height);", "VAR_0->tile = av_malloc_array(VAR_0->numXtiles, VAR_0->numYtiles * sizeof(Jpeg2000Tile));", "if (!VAR_0->tile)\nreturn AVERROR(ENOMEM);", "for (VAR_1 = 0, VAR_3 = 0; VAR_3 < VAR_0->numYtiles; VAR_3++)", "for (VAR_2 = 0; VAR_2 < VAR_0->numXtiles; VAR_2++, VAR_1++){", "Jpeg2000Tile *tile = VAR_0->tile + VAR_1;", "tile->comp = av_mallocz_array(VAR_0->ncomponents, sizeof(Jpeg2000Component));", "if (!tile->comp)\nreturn AVERROR(ENOMEM);", "for (VAR_4 = 0; VAR_4 < VAR_0->ncomponents; VAR_4++){", "Jpeg2000Component *comp = tile->comp + VAR_4;", "int ret, i, j;", "comp->coord[0][0] = comp->coord_o[0][0] = VAR_2 * VAR_0->tile_width;", "comp->coord[0][1] = comp->coord_o[0][1] = FFMIN((VAR_2+1)*VAR_0->tile_width, VAR_0->width);", "comp->coord[1][0] = comp->coord_o[1][0] = VAR_3 * VAR_0->tile_height;", "comp->coord[1][1] = comp->coord_o[1][1] = FFMIN((VAR_3+1)*VAR_0->tile_height, VAR_0->height);", "if (VAR_4 > 0)\nfor (i = 0; i < 2; i++)", "for (j = 0; j < 2; j++)", "comp->coord[i][j] = comp->coord_o[i][j] = ff_jpeg2000_ceildivpow2(comp->coord[i][j], VAR_0->chroma_shift[i]);", "if (ret = ff_jpeg2000_init_component(comp,\ncodsty,\nqntsty,\nVAR_0->cbps[VAR_4],\nVAR_4?1<<VAR_0->chroma_shift[0]:1,\nVAR_4?1<<VAR_0->chroma_shift[1]:1,\nVAR_0->avctx\n))\nreturn ret;", "}", "}", "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, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65, 67, 69, 71, 73, 75, 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
9,825
static TCGv neon_load_reg(int reg, int pass) { TCGv tmp = new_tmp(); tcg_gen_ld_i32(tmp, cpu_env, neon_reg_offset(reg, pass)); return tmp; }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static TCGv neon_load_reg(int reg, int pass) { TCGv tmp = new_tmp(); tcg_gen_ld_i32(tmp, cpu_env, neon_reg_offset(reg, pass)); return tmp; }
{ "code": [ " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] }
static TCGv FUNC_0(int reg, int pass) { TCGv tmp = new_tmp(); tcg_gen_ld_i32(tmp, cpu_env, neon_reg_offset(reg, pass)); return tmp; }
[ "static TCGv FUNC_0(int reg, int pass)\n{", "TCGv tmp = new_tmp();", "tcg_gen_ld_i32(tmp, cpu_env, neon_reg_offset(reg, pass));", "return tmp;", "}" ]
[ 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
9,826
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) { int i, count, ret = 0, j; int64_t read_size; AVStream *st; AVPacket pkt1, *pkt; int64_t old_offset = avio_tell(ic->pb); int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those int flush_codecs = ic->probesize > 0; if(ic->pb) av_log(ic, AV_LOG_DEBUG, "File position before avformat_find_stream_info() is %"PRId64"\n", avio_tell(ic->pb)); for(i=0;i<ic->nb_streams;i++) { const AVCodec *codec; AVDictionary *thread_opt = NULL; st = ic->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { /* if(!st->time_base.num) st->time_base= */ if(!st->codec->time_base.num) st->codec->time_base= st->time_base; } //only for the split stuff if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) { st->parser = av_parser_init(st->codec->codec_id); if(st->parser){ if(st->need_parsing == AVSTREAM_PARSE_HEADERS){ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; } else if(st->need_parsing == AVSTREAM_PARSE_FULL_RAW) { st->parser->flags |= PARSER_FLAG_USE_CODEC_TS; } } else if (st->need_parsing) { av_log(ic, AV_LOG_VERBOSE, "parser not found for codec " "%s, packets or times may be invalid.\n", avcodec_get_name(st->codec->codec_id)); } } codec = st->codec->codec ? st->codec->codec : avcodec_find_decoder(st->codec->codec_id); /* force thread count to 1 since the h264 decoder will not extract SPS * and PPS to extradata during multi-threaded decoding */ av_dict_set(options ? &options[i] : &thread_opt, "threads", "1", 0); /* Ensure that subtitle_header is properly set. */ if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && codec && !st->codec->codec) avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt); //try to just open decoders, in case this is enough to get parameters if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) { if (codec && !st->codec->codec) avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt); } if (!options) av_dict_free(&thread_opt); } for (i=0; i<ic->nb_streams; i++) { #if FF_API_R_FRAME_RATE ic->streams[i]->info->last_dts = AV_NOPTS_VALUE; #endif ic->streams[i]->info->fps_first_dts = AV_NOPTS_VALUE; ic->streams[i]->info->fps_last_dts = AV_NOPTS_VALUE; } count = 0; read_size = 0; for(;;) { if (ff_check_interrupt(&ic->interrupt_callback)){ ret= AVERROR_EXIT; av_log(ic, AV_LOG_DEBUG, "interrupted\n"); break; } /* check if one codec still needs to be handled */ for(i=0;i<ic->nb_streams;i++) { int fps_analyze_framecount = 20; st = ic->streams[i]; if (!has_codec_parameters(st, NULL)) break; /* if the timebase is coarse (like the usual millisecond precision of mkv), we need to analyze more frames to reliably arrive at the correct fps */ if (av_q2d(st->time_base) > 0.0005) fps_analyze_framecount *= 2; if (ic->fps_probe_size >= 0) fps_analyze_framecount = ic->fps_probe_size; if (st->disposition & AV_DISPOSITION_ATTACHED_PIC) fps_analyze_framecount = 0; /* variable fps and no guess at the real fps */ if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num) && st->info->duration_count < fps_analyze_framecount && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; if (st->first_dts == AV_NOPTS_VALUE && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO)) break; } if (i == ic->nb_streams) { /* NOTE: if the format has no header, then we need to read some packets to get most of the streams, so we cannot stop here */ if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) { /* if we found the info for all the codecs, we can stop */ ret = count; av_log(ic, AV_LOG_DEBUG, "All info found\n"); flush_codecs = 0; break; } } /* we did not get all the codec info, but we read too much data */ if (read_size >= ic->probesize) { ret = count; av_log(ic, AV_LOG_DEBUG, "Probe buffer size limit of %d bytes reached\n", ic->probesize); for (i = 0; i < ic->nb_streams; i++) if (!ic->streams[i]->r_frame_rate.num && ic->streams[i]->info->duration_count <= 1) av_log(ic, AV_LOG_WARNING, "Stream #%d: not enough frames to estimate rate; " "consider increasing probesize\n", i); break; } /* NOTE: a new stream can be added there if no header in file (AVFMTCTX_NOHEADER) */ ret = read_frame_internal(ic, &pkt1); if (ret == AVERROR(EAGAIN)) continue; if (ret < 0) { /* EOF or error*/ break; } if (ic->flags & AVFMT_FLAG_NOBUFFER) { pkt = &pkt1; } else { pkt = add_to_pktbuf(&ic->packet_buffer, &pkt1, &ic->packet_buffer_end); if ((ret = av_dup_packet(pkt)) < 0) goto find_stream_info_err; } read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) { /* check for non-increasing dts */ if (st->info->fps_last_dts != AV_NOPTS_VALUE && st->info->fps_last_dts >= pkt->dts) { av_log(ic, AV_LOG_DEBUG, "Non-increasing DTS in stream %d: " "packet %d with DTS %"PRId64", packet %d with DTS " "%"PRId64"\n", st->index, st->info->fps_last_dts_idx, st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts); st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE; } /* check for a discontinuity in dts - if the difference in dts * is more than 1000 times the average packet duration in the sequence, * we treat it as a discontinuity */ if (st->info->fps_last_dts != AV_NOPTS_VALUE && st->info->fps_last_dts_idx > st->info->fps_first_dts_idx && (pkt->dts - st->info->fps_last_dts) / 1000 > (st->info->fps_last_dts - st->info->fps_first_dts) / (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) { av_log(ic, AV_LOG_WARNING, "DTS discontinuity in stream %d: " "packet %d with DTS %"PRId64", packet %d with DTS " "%"PRId64"\n", st->index, st->info->fps_last_dts_idx, st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts); st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE; } /* update stored dts values */ if (st->info->fps_first_dts == AV_NOPTS_VALUE) { st->info->fps_first_dts = pkt->dts; st->info->fps_first_dts_idx = st->codec_info_nb_frames; } st->info->fps_last_dts = pkt->dts; st->info->fps_last_dts_idx = st->codec_info_nb_frames; } if (st->codec_info_nb_frames>1) { int64_t t=0; if (st->time_base.den > 0) t = av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q); if (st->avg_frame_rate.num > 0) t = FFMAX(t, av_rescale_q(st->codec_info_nb_frames, av_inv_q(st->avg_frame_rate), AV_TIME_BASE_Q)); if ( t==0 && st->codec_info_nb_frames>15 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ( !strcmp(ic->iformat->name, "mpeg") // this breaks some flvs thus use only for mpegps/ts for now (for ts we have a sample that needs it) || !strcmp(ic->iformat->name, "mpegts")) && st->info->fps_first_dts != AV_NOPTS_VALUE && st->info->fps_last_dts != AV_NOPTS_VALUE) t = FFMAX(t, av_rescale_q(st->info->fps_last_dts - st->info->fps_first_dts, st->time_base, AV_TIME_BASE_Q)); if (t >= ic->max_analyze_duration) { av_log(ic, AV_LOG_VERBOSE, "max_analyze_duration %d reached at %"PRId64" microseconds\n", ic->max_analyze_duration, t); break; } if (pkt->duration) { st->info->codec_info_duration += pkt->duration; st->info->codec_info_duration_fields += st->parser && st->codec->ticks_per_frame==2 ? st->parser->repeat_pict + 1 : 2; } } #if FF_API_R_FRAME_RATE { int64_t last = st->info->last_dts; if( pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last && pkt->dts - (uint64_t)last < INT64_MAX){ double dts= (is_relative(pkt->dts) ? pkt->dts - RELATIVE_TS_BASE : pkt->dts) * av_q2d(st->time_base); int64_t duration= pkt->dts - last; if (!st->info->duration_error) st->info->duration_error = av_mallocz(sizeof(st->info->duration_error[0])*2); // if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO) // av_log(NULL, AV_LOG_ERROR, "%f\n", dts); for (i=0; i<MAX_STD_TIMEBASES; i++) { int framerate= get_std_framerate(i); double sdts= dts*framerate/(1001*12); for(j=0; j<2; j++){ int64_t ticks= llrint(sdts+j*0.5); double error= sdts - ticks + j*0.5; st->info->duration_error[j][0][i] += error; st->info->duration_error[j][1][i] += error*error; } } st->info->duration_count++; // ignore the first 4 values, they might have some random jitter if (st->info->duration_count > 3 && is_relative(pkt->dts) == is_relative(last)) st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration); } if (pkt->dts != AV_NOPTS_VALUE) st->info->last_dts = pkt->dts; } #endif if(st->parser && st->parser->parser->split && !st->codec->extradata){ int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) { st->codec->extradata_size= i; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size); memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE); } } /* if still no information, we try to open the codec and to decompress the frame. We try to avoid that in most cases as it takes longer and uses more memory. For MPEG-4, we need to decompress for QuickTime. If CODEC_CAP_CHANNEL_CONF is set this will force decoding of at least one frame of codec data, this makes sure the codec initializes the channel configuration and does not only trust the values from the container. */ try_decode_frame(st, pkt, (options && i < orig_nb_streams ) ? &options[i] : NULL); st->codec_info_nb_frames++; count++; } if (flush_codecs) { AVPacket empty_pkt = { 0 }; int err = 0; av_init_packet(&empty_pkt); for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; /* flush the decoders */ if (st->info->found_decoder == 1) { do { err = try_decode_frame(st, &empty_pkt, (options && i < orig_nb_streams) ? &options[i] : NULL); } while (err > 0 && !has_codec_parameters(st, NULL)); if (err < 0) { av_log(ic, AV_LOG_INFO, "decoding for stream %d failed\n", st->index); } } } } // close codecs which were opened in try_decode_frame() for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; avcodec_close(st->codec); } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample){ uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); if (avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, tag) == st->codec->pix_fmt) st->codec->codec_tag= tag; } /* estimate average framerate if not set by demuxer */ if (st->info->codec_info_duration_fields && !st->avg_frame_rate.num && st->info->codec_info_duration) { int best_fps = 0; double best_error = 0.01; av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, st->info->codec_info_duration_fields*(int64_t)st->time_base.den, st->info->codec_info_duration*2*(int64_t)st->time_base.num, 60000); /* round guessed framerate to a "standard" framerate if it's * within 1% of the original estimate*/ for (j = 1; j < MAX_STD_TIMEBASES; j++) { AVRational std_fps = { get_std_framerate(j), 12*1001 }; double error = fabs(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1); if (error < best_error) { best_error = error; best_fps = std_fps.num; } } if (best_fps) { av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, best_fps, 12*1001, INT_MAX); } } // the check for tb_unreliable() is not completely correct, since this is not about handling // a unreliable/inexact time base, but a time base that is finer than necessary, as e.g. // ipmovie.c produces. if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX); if (st->info->duration_count>1 && !st->r_frame_rate.num && tb_unreliable(st->codec)) { int num = 0; double best_error= 0.01; for (j=0; j<MAX_STD_TIMEBASES; j++) { int k; if(st->info->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*12.0)/get_std_framerate(j)) continue; if(!st->info->codec_info_duration && 1.0 < (1001*12.0)/get_std_framerate(j)) continue; for(k=0; k<2; k++){ int n= st->info->duration_count; double a= st->info->duration_error[k][0][j] / n; double error= st->info->duration_error[k][1][j]/n - a*a; if(error < best_error && best_error> 0.000000001){ best_error= error; num = get_std_framerate(j); } if(error < 0.02) av_log(NULL, AV_LOG_DEBUG, "rfps: %f %f\n", get_std_framerate(j) / 12.0/1001, error); } } // do not increase frame rate by more than 1 % in order to match a standard rate. if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate))) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); } if (!st->r_frame_rate.num){ if( st->codec->time_base.den * (int64_t)st->time_base.num <= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t)st->time_base.den){ st->r_frame_rate.num = st->codec->time_base.den; st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame; }else{ st->r_frame_rate.num = st->time_base.den; st->r_frame_rate.den = st->time_base.num; } } }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if(!st->codec->bits_per_coded_sample) st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id); // set stream disposition based on audio service type switch (st->codec->audio_service_type) { case AV_AUDIO_SERVICE_TYPE_EFFECTS: st->disposition = AV_DISPOSITION_CLEAN_EFFECTS; break; case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED: st->disposition = AV_DISPOSITION_VISUAL_IMPAIRED; break; case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED: st->disposition = AV_DISPOSITION_HEARING_IMPAIRED; break; case AV_AUDIO_SERVICE_TYPE_COMMENTARY: st->disposition = AV_DISPOSITION_COMMENT; break; case AV_AUDIO_SERVICE_TYPE_KARAOKE: st->disposition = AV_DISPOSITION_KARAOKE; break; } } } if(ic->probesize) estimate_timings(ic, old_offset); if (ret >= 0 && ic->nb_streams) ret = -1; /* we could not have all the codec parameters before EOF */ for(i=0;i<ic->nb_streams;i++) { const char *errmsg; st = ic->streams[i]; if (!has_codec_parameters(st, &errmsg)) { char buf[256]; avcodec_string(buf, sizeof(buf), st->codec, 0); av_log(ic, AV_LOG_WARNING, "Could not find codec parameters for stream %d (%s): %s\n" "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n", i, buf, errmsg); } else { ret = 0; } } compute_chapters_end(ic); find_stream_info_err: for (i=0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (ic->streams[i]->codec && ic->streams[i]->codec->codec_type != AVMEDIA_TYPE_AUDIO) ic->streams[i]->codec->thread_count = 0; if (st->info) av_freep(&st->info->duration_error); av_freep(&ic->streams[i]->info); } if(ic->pb) av_log(ic, AV_LOG_DEBUG, "File position after avformat_find_stream_info() is %"PRId64"\n", avio_tell(ic->pb)); return ret; }
true
FFmpeg
5312c319be98c63b8e59695222a13068a0dbc7ab
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) { int i, count, ret = 0, j; int64_t read_size; AVStream *st; AVPacket pkt1, *pkt; int64_t old_offset = avio_tell(ic->pb); int orig_nb_streams = ic->nb_streams; int flush_codecs = ic->probesize > 0; if(ic->pb) av_log(ic, AV_LOG_DEBUG, "File position before avformat_find_stream_info() is %"PRId64"\n", avio_tell(ic->pb)); for(i=0;i<ic->nb_streams;i++) { const AVCodec *codec; AVDictionary *thread_opt = NULL; st = ic->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { if(!st->codec->time_base.num) st->codec->time_base= st->time_base; } if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) { st->parser = av_parser_init(st->codec->codec_id); if(st->parser){ if(st->need_parsing == AVSTREAM_PARSE_HEADERS){ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; } else if(st->need_parsing == AVSTREAM_PARSE_FULL_RAW) { st->parser->flags |= PARSER_FLAG_USE_CODEC_TS; } } else if (st->need_parsing) { av_log(ic, AV_LOG_VERBOSE, "parser not found for codec " "%s, packets or times may be invalid.\n", avcodec_get_name(st->codec->codec_id)); } } codec = st->codec->codec ? st->codec->codec : avcodec_find_decoder(st->codec->codec_id); av_dict_set(options ? &options[i] : &thread_opt, "threads", "1", 0); if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && codec && !st->codec->codec) avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt); if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) { if (codec && !st->codec->codec) avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt); } if (!options) av_dict_free(&thread_opt); } for (i=0; i<ic->nb_streams; i++) { #if FF_API_R_FRAME_RATE ic->streams[i]->info->last_dts = AV_NOPTS_VALUE; #endif ic->streams[i]->info->fps_first_dts = AV_NOPTS_VALUE; ic->streams[i]->info->fps_last_dts = AV_NOPTS_VALUE; } count = 0; read_size = 0; for(;;) { if (ff_check_interrupt(&ic->interrupt_callback)){ ret= AVERROR_EXIT; av_log(ic, AV_LOG_DEBUG, "interrupted\n"); break; } for(i=0;i<ic->nb_streams;i++) { int fps_analyze_framecount = 20; st = ic->streams[i]; if (!has_codec_parameters(st, NULL)) break; if (av_q2d(st->time_base) > 0.0005) fps_analyze_framecount *= 2; if (ic->fps_probe_size >= 0) fps_analyze_framecount = ic->fps_probe_size; if (st->disposition & AV_DISPOSITION_ATTACHED_PIC) fps_analyze_framecount = 0; if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num) && st->info->duration_count < fps_analyze_framecount && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; if (st->first_dts == AV_NOPTS_VALUE && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO)) break; } if (i == ic->nb_streams) { if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) { ret = count; av_log(ic, AV_LOG_DEBUG, "All info found\n"); flush_codecs = 0; break; } } if (read_size >= ic->probesize) { ret = count; av_log(ic, AV_LOG_DEBUG, "Probe buffer size limit of %d bytes reached\n", ic->probesize); for (i = 0; i < ic->nb_streams; i++) if (!ic->streams[i]->r_frame_rate.num && ic->streams[i]->info->duration_count <= 1) av_log(ic, AV_LOG_WARNING, "Stream #%d: not enough frames to estimate rate; " "consider increasing probesize\n", i); break; } ret = read_frame_internal(ic, &pkt1); if (ret == AVERROR(EAGAIN)) continue; if (ret < 0) { break; } if (ic->flags & AVFMT_FLAG_NOBUFFER) { pkt = &pkt1; } else { pkt = add_to_pktbuf(&ic->packet_buffer, &pkt1, &ic->packet_buffer_end); if ((ret = av_dup_packet(pkt)) < 0) goto find_stream_info_err; } read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) { if (st->info->fps_last_dts != AV_NOPTS_VALUE && st->info->fps_last_dts >= pkt->dts) { av_log(ic, AV_LOG_DEBUG, "Non-increasing DTS in stream %d: " "packet %d with DTS %"PRId64", packet %d with DTS " "%"PRId64"\n", st->index, st->info->fps_last_dts_idx, st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts); st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE; } if (st->info->fps_last_dts != AV_NOPTS_VALUE && st->info->fps_last_dts_idx > st->info->fps_first_dts_idx && (pkt->dts - st->info->fps_last_dts) / 1000 > (st->info->fps_last_dts - st->info->fps_first_dts) / (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) { av_log(ic, AV_LOG_WARNING, "DTS discontinuity in stream %d: " "packet %d with DTS %"PRId64", packet %d with DTS " "%"PRId64"\n", st->index, st->info->fps_last_dts_idx, st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts); st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE; } if (st->info->fps_first_dts == AV_NOPTS_VALUE) { st->info->fps_first_dts = pkt->dts; st->info->fps_first_dts_idx = st->codec_info_nb_frames; } st->info->fps_last_dts = pkt->dts; st->info->fps_last_dts_idx = st->codec_info_nb_frames; } if (st->codec_info_nb_frames>1) { int64_t t=0; if (st->time_base.den > 0) t = av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q); if (st->avg_frame_rate.num > 0) t = FFMAX(t, av_rescale_q(st->codec_info_nb_frames, av_inv_q(st->avg_frame_rate), AV_TIME_BASE_Q)); if ( t==0 && st->codec_info_nb_frames>15 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ( !strcmp(ic->iformat->name, "mpeg") || !strcmp(ic->iformat->name, "mpegts")) && st->info->fps_first_dts != AV_NOPTS_VALUE && st->info->fps_last_dts != AV_NOPTS_VALUE) t = FFMAX(t, av_rescale_q(st->info->fps_last_dts - st->info->fps_first_dts, st->time_base, AV_TIME_BASE_Q)); if (t >= ic->max_analyze_duration) { av_log(ic, AV_LOG_VERBOSE, "max_analyze_duration %d reached at %"PRId64" microseconds\n", ic->max_analyze_duration, t); break; } if (pkt->duration) { st->info->codec_info_duration += pkt->duration; st->info->codec_info_duration_fields += st->parser && st->codec->ticks_per_frame==2 ? st->parser->repeat_pict + 1 : 2; } } #if FF_API_R_FRAME_RATE { int64_t last = st->info->last_dts; if( pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last && pkt->dts - (uint64_t)last < INT64_MAX){ double dts= (is_relative(pkt->dts) ? pkt->dts - RELATIVE_TS_BASE : pkt->dts) * av_q2d(st->time_base); int64_t duration= pkt->dts - last; if (!st->info->duration_error) st->info->duration_error = av_mallocz(sizeof(st->info->duration_error[0])*2); for (i=0; i<MAX_STD_TIMEBASES; i++) { int framerate= get_std_framerate(i); double sdts= dts*framerate/(1001*12); for(j=0; j<2; j++){ int64_t ticks= llrint(sdts+j*0.5); double error= sdts - ticks + j*0.5; st->info->duration_error[j][0][i] += error; st->info->duration_error[j][1][i] += error*error; } } st->info->duration_count++; if (st->info->duration_count > 3 && is_relative(pkt->dts) == is_relative(last)) st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration); } if (pkt->dts != AV_NOPTS_VALUE) st->info->last_dts = pkt->dts; } #endif if(st->parser && st->parser->parser->split && !st->codec->extradata){ int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) { st->codec->extradata_size= i; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size); memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE); } } try_decode_frame(st, pkt, (options && i < orig_nb_streams ) ? &options[i] : NULL); st->codec_info_nb_frames++; count++; } if (flush_codecs) { AVPacket empty_pkt = { 0 }; int err = 0; av_init_packet(&empty_pkt); for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->info->found_decoder == 1) { do { err = try_decode_frame(st, &empty_pkt, (options && i < orig_nb_streams) ? &options[i] : NULL); } while (err > 0 && !has_codec_parameters(st, NULL)); if (err < 0) { av_log(ic, AV_LOG_INFO, "decoding for stream %d failed\n", st->index); } } } } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; avcodec_close(st->codec); } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample){ uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); if (avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, tag) == st->codec->pix_fmt) st->codec->codec_tag= tag; } if (st->info->codec_info_duration_fields && !st->avg_frame_rate.num && st->info->codec_info_duration) { int best_fps = 0; double best_error = 0.01; av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, st->info->codec_info_duration_fields*(int64_t)st->time_base.den, st->info->codec_info_duration*2*(int64_t)st->time_base.num, 60000); for (j = 1; j < MAX_STD_TIMEBASES; j++) { AVRational std_fps = { get_std_framerate(j), 12*1001 }; double error = fabs(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1); if (error < best_error) { best_error = error; best_fps = std_fps.num; } } if (best_fps) { av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, best_fps, 12*1001, INT_MAX); } } if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX); if (st->info->duration_count>1 && !st->r_frame_rate.num && tb_unreliable(st->codec)) { int num = 0; double best_error= 0.01; for (j=0; j<MAX_STD_TIMEBASES; j++) { int k; if(st->info->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*12.0)/get_std_framerate(j)) continue; if(!st->info->codec_info_duration && 1.0 < (1001*12.0)/get_std_framerate(j)) continue; for(k=0; k<2; k++){ int n= st->info->duration_count; double a= st->info->duration_error[k][0][j] / n; double error= st->info->duration_error[k][1][j]/n - a*a; if(error < best_error && best_error> 0.000000001){ best_error= error; num = get_std_framerate(j); } if(error < 0.02) av_log(NULL, AV_LOG_DEBUG, "rfps: %f %f\n", get_std_framerate(j) / 12.0/1001, error); } } if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate))) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); } if (!st->r_frame_rate.num){ if( st->codec->time_base.den * (int64_t)st->time_base.num <= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t)st->time_base.den){ st->r_frame_rate.num = st->codec->time_base.den; st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame; }else{ st->r_frame_rate.num = st->time_base.den; st->r_frame_rate.den = st->time_base.num; } } }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if(!st->codec->bits_per_coded_sample) st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id); switch (st->codec->audio_service_type) { case AV_AUDIO_SERVICE_TYPE_EFFECTS: st->disposition = AV_DISPOSITION_CLEAN_EFFECTS; break; case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED: st->disposition = AV_DISPOSITION_VISUAL_IMPAIRED; break; case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED: st->disposition = AV_DISPOSITION_HEARING_IMPAIRED; break; case AV_AUDIO_SERVICE_TYPE_COMMENTARY: st->disposition = AV_DISPOSITION_COMMENT; break; case AV_AUDIO_SERVICE_TYPE_KARAOKE: st->disposition = AV_DISPOSITION_KARAOKE; break; } } } if(ic->probesize) estimate_timings(ic, old_offset); if (ret >= 0 && ic->nb_streams) ret = -1; for(i=0;i<ic->nb_streams;i++) { const char *errmsg; st = ic->streams[i]; if (!has_codec_parameters(st, &errmsg)) { char buf[256]; avcodec_string(buf, sizeof(buf), st->codec, 0); av_log(ic, AV_LOG_WARNING, "Could not find codec parameters for stream %d (%s): %s\n" "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n", i, buf, errmsg); } else { ret = 0; } } compute_chapters_end(ic); find_stream_info_err: for (i=0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (ic->streams[i]->codec && ic->streams[i]->codec->codec_type != AVMEDIA_TYPE_AUDIO) ic->streams[i]->codec->thread_count = 0; if (st->info) av_freep(&st->info->duration_error); av_freep(&ic->streams[i]->info); } if(ic->pb) av_log(ic, AV_LOG_DEBUG, "File position after avformat_find_stream_info() is %"PRId64"\n", avio_tell(ic->pb)); return ret; }
{ "code": [ " && st->codec_info_nb_frames>15", " && st->codec->codec_type == AVMEDIA_TYPE_VIDEO", " || !strcmp(ic->iformat->name, \"mpegts\"))" ], "line_no": [ 393, 395, 399 ] }
int FUNC_0(AVFormatContext *VAR_0, AVDictionary **VAR_1) { int VAR_8, VAR_3, VAR_4 = 0, VAR_5; int64_t read_size; AVStream *st; AVPacket pkt1, *pkt; int64_t old_offset = avio_tell(VAR_0->pb); int VAR_6 = VAR_0->nb_streams; int VAR_7 = VAR_0->probesize > 0; if(VAR_0->pb) av_log(VAR_0, AV_LOG_DEBUG, "File position before FUNC_0() is %"PRId64"\n", avio_tell(VAR_0->pb)); for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) { const AVCodec *codec; AVDictionary *thread_opt = NULL; st = VAR_0->streams[VAR_8]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { if(!st->codec->time_base.num) st->codec->time_base= st->time_base; } if (!st->parser && !(VAR_0->flags & AVFMT_FLAG_NOPARSE)) { st->parser = av_parser_init(st->codec->codec_id); if(st->parser){ if(st->need_parsing == AVSTREAM_PARSE_HEADERS){ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; } else if(st->need_parsing == AVSTREAM_PARSE_FULL_RAW) { st->parser->flags |= PARSER_FLAG_USE_CODEC_TS; } } else if (st->need_parsing) { av_log(VAR_0, AV_LOG_VERBOSE, "parser not found for codec " "%s, packets or times may be invalid.\n", avcodec_get_name(st->codec->codec_id)); } } codec = st->codec->codec ? st->codec->codec : avcodec_find_decoder(st->codec->codec_id); av_dict_set(VAR_1 ? &VAR_1[VAR_8] : &thread_opt, "threads", "1", 0); if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && codec && !st->codec->codec) avcodec_open2(st->codec, codec, VAR_1 ? &VAR_1[VAR_8] : &thread_opt); if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) { if (codec && !st->codec->codec) avcodec_open2(st->codec, codec, VAR_1 ? &VAR_1[VAR_8] : &thread_opt); } if (!VAR_1) av_dict_free(&thread_opt); } for (VAR_8=0; VAR_8<VAR_0->nb_streams; VAR_8++) { #if FF_API_R_FRAME_RATE VAR_0->streams[VAR_8]->info->last_dts = AV_NOPTS_VALUE; #endif VAR_0->streams[VAR_8]->info->fps_first_dts = AV_NOPTS_VALUE; VAR_0->streams[VAR_8]->info->fps_last_dts = AV_NOPTS_VALUE; } VAR_3 = 0; read_size = 0; for(;;) { if (ff_check_interrupt(&VAR_0->interrupt_callback)){ VAR_4= AVERROR_EXIT; av_log(VAR_0, AV_LOG_DEBUG, "interrupted\n"); break; } for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) { int fps_analyze_framecount = 20; st = VAR_0->streams[VAR_8]; if (!has_codec_parameters(st, NULL)) break; if (av_q2d(st->time_base) > 0.0005) fps_analyze_framecount *= 2; if (VAR_0->fps_probe_size >= 0) fps_analyze_framecount = VAR_0->fps_probe_size; if (st->disposition & AV_DISPOSITION_ATTACHED_PIC) fps_analyze_framecount = 0; if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num) && st->info->duration_count < fps_analyze_framecount && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; if (st->first_dts == AV_NOPTS_VALUE && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO)) break; } if (VAR_8 == VAR_0->nb_streams) { if (!(VAR_0->ctx_flags & AVFMTCTX_NOHEADER)) { VAR_4 = VAR_3; av_log(VAR_0, AV_LOG_DEBUG, "All info found\n"); VAR_7 = 0; break; } } if (read_size >= VAR_0->probesize) { VAR_4 = VAR_3; av_log(VAR_0, AV_LOG_DEBUG, "Probe buffer size limit of %d bytes reached\n", VAR_0->probesize); for (VAR_8 = 0; VAR_8 < VAR_0->nb_streams; VAR_8++) if (!VAR_0->streams[VAR_8]->r_frame_rate.num && VAR_0->streams[VAR_8]->info->duration_count <= 1) av_log(VAR_0, AV_LOG_WARNING, "Stream #%d: not enough frames to estimate rate; " "consider increasing probesize\n", VAR_8); break; } VAR_4 = read_frame_internal(VAR_0, &pkt1); if (VAR_4 == AVERROR(EAGAIN)) continue; if (VAR_4 < 0) { break; } if (VAR_0->flags & AVFMT_FLAG_NOBUFFER) { pkt = &pkt1; } else { pkt = add_to_pktbuf(&VAR_0->packet_buffer, &pkt1, &VAR_0->packet_buffer_end); if ((VAR_4 = av_dup_packet(pkt)) < 0) goto find_stream_info_err; } read_size += pkt->size; st = VAR_0->streams[pkt->stream_index]; if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) { if (st->info->fps_last_dts != AV_NOPTS_VALUE && st->info->fps_last_dts >= pkt->dts) { av_log(VAR_0, AV_LOG_DEBUG, "Non-increasing DTS in stream %d: " "packet %d with DTS %"PRId64", packet %d with DTS " "%"PRId64"\n", st->index, st->info->fps_last_dts_idx, st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts); st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE; } if (st->info->fps_last_dts != AV_NOPTS_VALUE && st->info->fps_last_dts_idx > st->info->fps_first_dts_idx && (pkt->dts - st->info->fps_last_dts) / 1000 > (st->info->fps_last_dts - st->info->fps_first_dts) / (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) { av_log(VAR_0, AV_LOG_WARNING, "DTS discontinuity in stream %d: " "packet %d with DTS %"PRId64", packet %d with DTS " "%"PRId64"\n", st->index, st->info->fps_last_dts_idx, st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts); st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE; } if (st->info->fps_first_dts == AV_NOPTS_VALUE) { st->info->fps_first_dts = pkt->dts; st->info->fps_first_dts_idx = st->codec_info_nb_frames; } st->info->fps_last_dts = pkt->dts; st->info->fps_last_dts_idx = st->codec_info_nb_frames; } if (st->codec_info_nb_frames>1) { int64_t t=0; if (st->time_base.den > 0) t = av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q); if (st->avg_frame_rate.num > 0) t = FFMAX(t, av_rescale_q(st->codec_info_nb_frames, av_inv_q(st->avg_frame_rate), AV_TIME_BASE_Q)); if ( t==0 && st->codec_info_nb_frames>15 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ( !strcmp(VAR_0->iformat->name, "mpeg") || !strcmp(VAR_0->iformat->name, "mpegts")) && st->info->fps_first_dts != AV_NOPTS_VALUE && st->info->fps_last_dts != AV_NOPTS_VALUE) t = FFMAX(t, av_rescale_q(st->info->fps_last_dts - st->info->fps_first_dts, st->time_base, AV_TIME_BASE_Q)); if (t >= VAR_0->max_analyze_duration) { av_log(VAR_0, AV_LOG_VERBOSE, "max_analyze_duration %d reached at %"PRId64" microseconds\n", VAR_0->max_analyze_duration, t); break; } if (pkt->duration) { st->info->codec_info_duration += pkt->duration; st->info->codec_info_duration_fields += st->parser && st->codec->ticks_per_frame==2 ? st->parser->repeat_pict + 1 : 2; } } #if FF_API_R_FRAME_RATE { int64_t last = st->info->last_dts; if( pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last && pkt->dts - (uint64_t)last < INT64_MAX){ double dts= (is_relative(pkt->dts) ? pkt->dts - RELATIVE_TS_BASE : pkt->dts) * av_q2d(st->time_base); int64_t duration= pkt->dts - last; if (!st->info->duration_error) st->info->duration_error = av_mallocz(sizeof(st->info->duration_error[0])*2); for (VAR_8=0; VAR_8<MAX_STD_TIMEBASES; VAR_8++) { int framerate= get_std_framerate(VAR_8); double sdts= dts*framerate/(1001*12); for(VAR_5=0; VAR_5<2; VAR_5++){ int64_t ticks= llrint(sdts+VAR_5*0.5); double error= sdts - ticks + VAR_5*0.5; st->info->duration_error[VAR_5][0][VAR_8] += error; st->info->duration_error[VAR_5][1][VAR_8] += error*error; } } st->info->duration_count++; if (st->info->duration_count > 3 && is_relative(pkt->dts) == is_relative(last)) st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration); } if (pkt->dts != AV_NOPTS_VALUE) st->info->last_dts = pkt->dts; } #endif if(st->parser && st->parser->parser->split && !st->codec->extradata){ int VAR_8= st->parser->parser->split(st->codec, pkt->data, pkt->size); if (VAR_8 > 0 && VAR_8 < FF_MAX_EXTRADATA_SIZE) { st->codec->extradata_size= VAR_8; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size); memset(st->codec->extradata + VAR_8, 0, FF_INPUT_BUFFER_PADDING_SIZE); } } try_decode_frame(st, pkt, (VAR_1 && VAR_8 < VAR_6 ) ? &VAR_1[VAR_8] : NULL); st->codec_info_nb_frames++; VAR_3++; } if (VAR_7) { AVPacket empty_pkt = { 0 }; int VAR_8 = 0; av_init_packet(&empty_pkt); for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) { st = VAR_0->streams[VAR_8]; if (st->info->found_decoder == 1) { do { VAR_8 = try_decode_frame(st, &empty_pkt, (VAR_1 && VAR_8 < VAR_6) ? &VAR_1[VAR_8] : NULL); } while (VAR_8 > 0 && !has_codec_parameters(st, NULL)); if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_INFO, "decoding for stream %d failed\n", st->index); } } } } for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) { st = VAR_0->streams[VAR_8]; avcodec_close(st->codec); } for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) { st = VAR_0->streams[VAR_8]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample){ uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); if (avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, tag) == st->codec->pix_fmt) st->codec->codec_tag= tag; } if (st->info->codec_info_duration_fields && !st->avg_frame_rate.num && st->info->codec_info_duration) { int best_fps = 0; double best_error = 0.01; av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, st->info->codec_info_duration_fields*(int64_t)st->time_base.den, st->info->codec_info_duration*2*(int64_t)st->time_base.num, 60000); for (VAR_5 = 1; VAR_5 < MAX_STD_TIMEBASES; VAR_5++) { AVRational std_fps = { get_std_framerate(VAR_5), 12*1001 }; double error = fabs(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1); if (error < best_error) { best_error = error; best_fps = std_fps.num; } } if (best_fps) { av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, best_fps, 12*1001, INT_MAX); } } if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX); if (st->info->duration_count>1 && !st->r_frame_rate.num && tb_unreliable(st->codec)) { int num = 0; double best_error= 0.01; for (VAR_5=0; VAR_5<MAX_STD_TIMEBASES; VAR_5++) { int k; if(st->info->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*12.0)/get_std_framerate(VAR_5)) continue; if(!st->info->codec_info_duration && 1.0 < (1001*12.0)/get_std_framerate(VAR_5)) continue; for(k=0; k<2; k++){ int n= st->info->duration_count; double a= st->info->duration_error[k][0][VAR_5] / n; double error= st->info->duration_error[k][1][VAR_5]/n - a*a; if(error < best_error && best_error> 0.000000001){ best_error= error; num = get_std_framerate(VAR_5); } if(error < 0.02) av_log(NULL, AV_LOG_DEBUG, "rfps: %f %f\n", get_std_framerate(VAR_5) / 12.0/1001, error); } } if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate))) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); } if (!st->r_frame_rate.num){ if( st->codec->time_base.den * (int64_t)st->time_base.num <= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t)st->time_base.den){ st->r_frame_rate.num = st->codec->time_base.den; st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame; }else{ st->r_frame_rate.num = st->time_base.den; st->r_frame_rate.den = st->time_base.num; } } }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if(!st->codec->bits_per_coded_sample) st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id); switch (st->codec->audio_service_type) { case AV_AUDIO_SERVICE_TYPE_EFFECTS: st->disposition = AV_DISPOSITION_CLEAN_EFFECTS; break; case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED: st->disposition = AV_DISPOSITION_VISUAL_IMPAIRED; break; case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED: st->disposition = AV_DISPOSITION_HEARING_IMPAIRED; break; case AV_AUDIO_SERVICE_TYPE_COMMENTARY: st->disposition = AV_DISPOSITION_COMMENT; break; case AV_AUDIO_SERVICE_TYPE_KARAOKE: st->disposition = AV_DISPOSITION_KARAOKE; break; } } } if(VAR_0->probesize) estimate_timings(VAR_0, old_offset); if (VAR_4 >= 0 && VAR_0->nb_streams) VAR_4 = -1; for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) { const char *errmsg; st = VAR_0->streams[VAR_8]; if (!has_codec_parameters(st, &errmsg)) { char buf[256]; avcodec_string(buf, sizeof(buf), st->codec, 0); av_log(VAR_0, AV_LOG_WARNING, "Could not find codec parameters for stream %d (%s): %s\n" "Consider increasing the value for the 'analyzeduration' and 'probesize' VAR_1\n", VAR_8, buf, errmsg); } else { VAR_4 = 0; } } compute_chapters_end(VAR_0); find_stream_info_err: for (VAR_8=0; VAR_8 < VAR_0->nb_streams; VAR_8++) { st = VAR_0->streams[VAR_8]; if (VAR_0->streams[VAR_8]->codec && VAR_0->streams[VAR_8]->codec->codec_type != AVMEDIA_TYPE_AUDIO) VAR_0->streams[VAR_8]->codec->thread_count = 0; if (st->info) av_freep(&st->info->duration_error); av_freep(&VAR_0->streams[VAR_8]->info); } if(VAR_0->pb) av_log(VAR_0, AV_LOG_DEBUG, "File position after FUNC_0() is %"PRId64"\n", avio_tell(VAR_0->pb)); return VAR_4; }
[ "int FUNC_0(AVFormatContext *VAR_0, AVDictionary **VAR_1)\n{", "int VAR_8, VAR_3, VAR_4 = 0, VAR_5;", "int64_t read_size;", "AVStream *st;", "AVPacket pkt1, *pkt;", "int64_t old_offset = avio_tell(VAR_0->pb);", "int VAR_6 = VAR_0->nb_streams;", "int VAR_7 = VAR_0->probesize > 0;", "if(VAR_0->pb)\nav_log(VAR_0, AV_LOG_DEBUG, \"File position before FUNC_0() is %\"PRId64\"\\n\", avio_tell(VAR_0->pb));", "for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) {", "const AVCodec *codec;", "AVDictionary *thread_opt = NULL;", "st = VAR_0->streams[VAR_8];", "if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||\nst->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {", "if(!st->codec->time_base.num)\nst->codec->time_base= st->time_base;", "}", "if (!st->parser && !(VAR_0->flags & AVFMT_FLAG_NOPARSE)) {", "st->parser = av_parser_init(st->codec->codec_id);", "if(st->parser){", "if(st->need_parsing == AVSTREAM_PARSE_HEADERS){", "st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;", "} else if(st->need_parsing == AVSTREAM_PARSE_FULL_RAW) {", "st->parser->flags |= PARSER_FLAG_USE_CODEC_TS;", "}", "} else if (st->need_parsing) {", "av_log(VAR_0, AV_LOG_VERBOSE, \"parser not found for codec \"\n\"%s, packets or times may be invalid.\\n\",\navcodec_get_name(st->codec->codec_id));", "}", "}", "codec = st->codec->codec ? st->codec->codec :\navcodec_find_decoder(st->codec->codec_id);", "av_dict_set(VAR_1 ? &VAR_1[VAR_8] : &thread_opt, \"threads\", \"1\", 0);", "if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE\n&& codec && !st->codec->codec)\navcodec_open2(st->codec, codec, VAR_1 ? &VAR_1[VAR_8]\n: &thread_opt);", "if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) {", "if (codec && !st->codec->codec)\navcodec_open2(st->codec, codec, VAR_1 ? &VAR_1[VAR_8]\n: &thread_opt);", "}", "if (!VAR_1)\nav_dict_free(&thread_opt);", "}", "for (VAR_8=0; VAR_8<VAR_0->nb_streams; VAR_8++) {", "#if FF_API_R_FRAME_RATE\nVAR_0->streams[VAR_8]->info->last_dts = AV_NOPTS_VALUE;", "#endif\nVAR_0->streams[VAR_8]->info->fps_first_dts = AV_NOPTS_VALUE;", "VAR_0->streams[VAR_8]->info->fps_last_dts = AV_NOPTS_VALUE;", "}", "VAR_3 = 0;", "read_size = 0;", "for(;;) {", "if (ff_check_interrupt(&VAR_0->interrupt_callback)){", "VAR_4= AVERROR_EXIT;", "av_log(VAR_0, AV_LOG_DEBUG, \"interrupted\\n\");", "break;", "}", "for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) {", "int fps_analyze_framecount = 20;", "st = VAR_0->streams[VAR_8];", "if (!has_codec_parameters(st, NULL))\nbreak;", "if (av_q2d(st->time_base) > 0.0005)\nfps_analyze_framecount *= 2;", "if (VAR_0->fps_probe_size >= 0)\nfps_analyze_framecount = VAR_0->fps_probe_size;", "if (st->disposition & AV_DISPOSITION_ATTACHED_PIC)\nfps_analyze_framecount = 0;", "if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num)\n&& st->info->duration_count < fps_analyze_framecount\n&& st->codec->codec_type == AVMEDIA_TYPE_VIDEO)\nbreak;", "if(st->parser && st->parser->parser->split && !st->codec->extradata)\nbreak;", "if (st->first_dts == AV_NOPTS_VALUE &&\n(st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||\nst->codec->codec_type == AVMEDIA_TYPE_AUDIO))\nbreak;", "}", "if (VAR_8 == VAR_0->nb_streams) {", "if (!(VAR_0->ctx_flags & AVFMTCTX_NOHEADER)) {", "VAR_4 = VAR_3;", "av_log(VAR_0, AV_LOG_DEBUG, \"All info found\\n\");", "VAR_7 = 0;", "break;", "}", "}", "if (read_size >= VAR_0->probesize) {", "VAR_4 = VAR_3;", "av_log(VAR_0, AV_LOG_DEBUG, \"Probe buffer size limit of %d bytes reached\\n\", VAR_0->probesize);", "for (VAR_8 = 0; VAR_8 < VAR_0->nb_streams; VAR_8++)", "if (!VAR_0->streams[VAR_8]->r_frame_rate.num &&\nVAR_0->streams[VAR_8]->info->duration_count <= 1)\nav_log(VAR_0, AV_LOG_WARNING,\n\"Stream #%d: not enough frames to estimate rate; \"", "\"consider increasing probesize\\n\", VAR_8);", "break;", "}", "VAR_4 = read_frame_internal(VAR_0, &pkt1);", "if (VAR_4 == AVERROR(EAGAIN))\ncontinue;", "if (VAR_4 < 0) {", "break;", "}", "if (VAR_0->flags & AVFMT_FLAG_NOBUFFER) {", "pkt = &pkt1;", "} else {", "pkt = add_to_pktbuf(&VAR_0->packet_buffer, &pkt1,\n&VAR_0->packet_buffer_end);", "if ((VAR_4 = av_dup_packet(pkt)) < 0)\ngoto find_stream_info_err;", "}", "read_size += pkt->size;", "st = VAR_0->streams[pkt->stream_index];", "if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) {", "if (st->info->fps_last_dts != AV_NOPTS_VALUE &&\nst->info->fps_last_dts >= pkt->dts) {", "av_log(VAR_0, AV_LOG_DEBUG, \"Non-increasing DTS in stream %d: \"\n\"packet %d with DTS %\"PRId64\", packet %d with DTS \"\n\"%\"PRId64\"\\n\", st->index, st->info->fps_last_dts_idx,\nst->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts);", "st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE;", "}", "if (st->info->fps_last_dts != AV_NOPTS_VALUE &&\nst->info->fps_last_dts_idx > st->info->fps_first_dts_idx &&\n(pkt->dts - st->info->fps_last_dts) / 1000 >\n(st->info->fps_last_dts - st->info->fps_first_dts) / (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) {", "av_log(VAR_0, AV_LOG_WARNING, \"DTS discontinuity in stream %d: \"\n\"packet %d with DTS %\"PRId64\", packet %d with DTS \"\n\"%\"PRId64\"\\n\", st->index, st->info->fps_last_dts_idx,\nst->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts);", "st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE;", "}", "if (st->info->fps_first_dts == AV_NOPTS_VALUE) {", "st->info->fps_first_dts = pkt->dts;", "st->info->fps_first_dts_idx = st->codec_info_nb_frames;", "}", "st->info->fps_last_dts = pkt->dts;", "st->info->fps_last_dts_idx = st->codec_info_nb_frames;", "}", "if (st->codec_info_nb_frames>1) {", "int64_t t=0;", "if (st->time_base.den > 0)\nt = av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q);", "if (st->avg_frame_rate.num > 0)\nt = FFMAX(t, av_rescale_q(st->codec_info_nb_frames, av_inv_q(st->avg_frame_rate), AV_TIME_BASE_Q));", "if ( t==0\n&& st->codec_info_nb_frames>15\n&& st->codec->codec_type == AVMEDIA_TYPE_VIDEO\n&& ( !strcmp(VAR_0->iformat->name, \"mpeg\")\n|| !strcmp(VAR_0->iformat->name, \"mpegts\"))\n&& st->info->fps_first_dts != AV_NOPTS_VALUE\n&& st->info->fps_last_dts != AV_NOPTS_VALUE)\nt = FFMAX(t, av_rescale_q(st->info->fps_last_dts - st->info->fps_first_dts, st->time_base, AV_TIME_BASE_Q));", "if (t >= VAR_0->max_analyze_duration) {", "av_log(VAR_0, AV_LOG_VERBOSE, \"max_analyze_duration %d reached at %\"PRId64\" microseconds\\n\", VAR_0->max_analyze_duration, t);", "break;", "}", "if (pkt->duration) {", "st->info->codec_info_duration += pkt->duration;", "st->info->codec_info_duration_fields += st->parser && st->codec->ticks_per_frame==2 ? st->parser->repeat_pict + 1 : 2;", "}", "}", "#if FF_API_R_FRAME_RATE\n{", "int64_t last = st->info->last_dts;", "if( pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last\n&& pkt->dts - (uint64_t)last < INT64_MAX){", "double dts= (is_relative(pkt->dts) ? pkt->dts - RELATIVE_TS_BASE : pkt->dts) * av_q2d(st->time_base);", "int64_t duration= pkt->dts - last;", "if (!st->info->duration_error)\nst->info->duration_error = av_mallocz(sizeof(st->info->duration_error[0])*2);", "for (VAR_8=0; VAR_8<MAX_STD_TIMEBASES; VAR_8++) {", "int framerate= get_std_framerate(VAR_8);", "double sdts= dts*framerate/(1001*12);", "for(VAR_5=0; VAR_5<2; VAR_5++){", "int64_t ticks= llrint(sdts+VAR_5*0.5);", "double error= sdts - ticks + VAR_5*0.5;", "st->info->duration_error[VAR_5][0][VAR_8] += error;", "st->info->duration_error[VAR_5][1][VAR_8] += error*error;", "}", "}", "st->info->duration_count++;", "if (st->info->duration_count > 3 && is_relative(pkt->dts) == is_relative(last))\nst->info->duration_gcd = av_gcd(st->info->duration_gcd, duration);", "}", "if (pkt->dts != AV_NOPTS_VALUE)\nst->info->last_dts = pkt->dts;", "}", "#endif\nif(st->parser && st->parser->parser->split && !st->codec->extradata){", "int VAR_8= st->parser->parser->split(st->codec, pkt->data, pkt->size);", "if (VAR_8 > 0 && VAR_8 < FF_MAX_EXTRADATA_SIZE) {", "st->codec->extradata_size= VAR_8;", "st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata)\nreturn AVERROR(ENOMEM);", "memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);", "memset(st->codec->extradata + VAR_8, 0, FF_INPUT_BUFFER_PADDING_SIZE);", "}", "}", "try_decode_frame(st, pkt, (VAR_1 && VAR_8 < VAR_6 ) ? &VAR_1[VAR_8] : NULL);", "st->codec_info_nb_frames++;", "VAR_3++;", "}", "if (VAR_7) {", "AVPacket empty_pkt = { 0 };", "int VAR_8 = 0;", "av_init_packet(&empty_pkt);", "for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) {", "st = VAR_0->streams[VAR_8];", "if (st->info->found_decoder == 1) {", "do {", "VAR_8 = try_decode_frame(st, &empty_pkt,\n(VAR_1 && VAR_8 < VAR_6) ?\n&VAR_1[VAR_8] : NULL);", "} while (VAR_8 > 0 && !has_codec_parameters(st, NULL));", "if (VAR_8 < 0) {", "av_log(VAR_0, AV_LOG_INFO,\n\"decoding for stream %d failed\\n\", st->index);", "}", "}", "}", "}", "for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) {", "st = VAR_0->streams[VAR_8];", "avcodec_close(st->codec);", "}", "for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) {", "st = VAR_0->streams[VAR_8];", "if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {", "if(st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample){", "uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);", "if (avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, tag) == st->codec->pix_fmt)\nst->codec->codec_tag= tag;", "}", "if (st->info->codec_info_duration_fields && !st->avg_frame_rate.num && st->info->codec_info_duration) {", "int best_fps = 0;", "double best_error = 0.01;", "av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,\nst->info->codec_info_duration_fields*(int64_t)st->time_base.den,\nst->info->codec_info_duration*2*(int64_t)st->time_base.num, 60000);", "for (VAR_5 = 1; VAR_5 < MAX_STD_TIMEBASES; VAR_5++) {", "AVRational std_fps = { get_std_framerate(VAR_5), 12*1001 };", "double error = fabs(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1);", "if (error < best_error) {", "best_error = error;", "best_fps = std_fps.num;", "}", "}", "if (best_fps) {", "av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,\nbest_fps, 12*1001, INT_MAX);", "}", "}", "if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num)\nav_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX);", "if (st->info->duration_count>1 && !st->r_frame_rate.num\n&& tb_unreliable(st->codec)) {", "int num = 0;", "double best_error= 0.01;", "for (VAR_5=0; VAR_5<MAX_STD_TIMEBASES; VAR_5++) {", "int k;", "if(st->info->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*12.0)/get_std_framerate(VAR_5))\ncontinue;", "if(!st->info->codec_info_duration && 1.0 < (1001*12.0)/get_std_framerate(VAR_5))\ncontinue;", "for(k=0; k<2; k++){", "int n= st->info->duration_count;", "double a= st->info->duration_error[k][0][VAR_5] / n;", "double error= st->info->duration_error[k][1][VAR_5]/n - a*a;", "if(error < best_error && best_error> 0.000000001){", "best_error= error;", "num = get_std_framerate(VAR_5);", "}", "if(error < 0.02)\nav_log(NULL, AV_LOG_DEBUG, \"rfps: %f %f\\n\", get_std_framerate(VAR_5) / 12.0/1001, error);", "}", "}", "if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate)))\nav_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX);", "}", "if (!st->r_frame_rate.num){", "if( st->codec->time_base.den * (int64_t)st->time_base.num\n<= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t)st->time_base.den){", "st->r_frame_rate.num = st->codec->time_base.den;", "st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame;", "}else{", "st->r_frame_rate.num = st->time_base.den;", "st->r_frame_rate.den = st->time_base.num;", "}", "}", "}else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {", "if(!st->codec->bits_per_coded_sample)\nst->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id);", "switch (st->codec->audio_service_type) {", "case AV_AUDIO_SERVICE_TYPE_EFFECTS:\nst->disposition = AV_DISPOSITION_CLEAN_EFFECTS; break;", "case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:\nst->disposition = AV_DISPOSITION_VISUAL_IMPAIRED; break;", "case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:\nst->disposition = AV_DISPOSITION_HEARING_IMPAIRED; break;", "case AV_AUDIO_SERVICE_TYPE_COMMENTARY:\nst->disposition = AV_DISPOSITION_COMMENT; break;", "case AV_AUDIO_SERVICE_TYPE_KARAOKE:\nst->disposition = AV_DISPOSITION_KARAOKE; break;", "}", "}", "}", "if(VAR_0->probesize)\nestimate_timings(VAR_0, old_offset);", "if (VAR_4 >= 0 && VAR_0->nb_streams)\nVAR_4 = -1;", "for(VAR_8=0;VAR_8<VAR_0->nb_streams;VAR_8++) {", "const char *errmsg;", "st = VAR_0->streams[VAR_8];", "if (!has_codec_parameters(st, &errmsg)) {", "char buf[256];", "avcodec_string(buf, sizeof(buf), st->codec, 0);", "av_log(VAR_0, AV_LOG_WARNING,\n\"Could not find codec parameters for stream %d (%s): %s\\n\"\n\"Consider increasing the value for the 'analyzeduration' and 'probesize' VAR_1\\n\",\nVAR_8, buf, errmsg);", "} else {", "VAR_4 = 0;", "}", "}", "compute_chapters_end(VAR_0);", "find_stream_info_err:\nfor (VAR_8=0; VAR_8 < VAR_0->nb_streams; VAR_8++) {", "st = VAR_0->streams[VAR_8];", "if (VAR_0->streams[VAR_8]->codec && VAR_0->streams[VAR_8]->codec->codec_type != AVMEDIA_TYPE_AUDIO)\nVAR_0->streams[VAR_8]->codec->thread_count = 0;", "if (st->info)\nav_freep(&st->info->duration_error);", "av_freep(&VAR_0->streams[VAR_8]->info);", "}", "if(VAR_0->pb)\nav_log(VAR_0, AV_LOG_DEBUG, \"File position after FUNC_0() is %\"PRId64\"\\n\", avio_tell(VAR_0->pb));", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 91 ], [ 97, 99, 101, 103 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 127 ], [ 129, 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 163 ], [ 165 ], [ 169 ], [ 171, 173 ], [ 181, 183 ], [ 185, 187 ], [ 189, 191 ], [ 195, 197, 199, 201 ], [ 203, 205 ], [ 207, 209, 211, 213 ], [ 215 ], [ 217 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253, 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 271 ], [ 273, 275 ], [ 279 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299, 301 ], [ 303 ], [ 307 ], [ 311 ], [ 313 ], [ 317, 319 ], [ 321, 323, 325, 327 ], [ 329 ], [ 331 ], [ 339, 341, 343, 345 ], [ 347, 349, 351, 353 ], [ 355 ], [ 357 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381, 383 ], [ 385, 387 ], [ 391, 393, 395, 397, 399, 401, 403, 405 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427, 429 ], [ 431 ], [ 435, 437 ], [ 439 ], [ 441 ], [ 445, 447 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 479, 481 ], [ 483 ], [ 485, 487 ], [ 489 ], [ 491, 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503, 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 535 ], [ 539 ], [ 541 ], [ 543 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 557 ], [ 561 ], [ 567 ], [ 569 ], [ 571, 573, 575 ], [ 577 ], [ 581 ], [ 583, 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617, 619 ], [ 621 ], [ 627 ], [ 629 ], [ 631 ], [ 635, 637, 639 ], [ 647 ], [ 649 ], [ 651 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667, 669 ], [ 671 ], [ 673 ], [ 681, 683 ], [ 685, 687 ], [ 689 ], [ 691 ], [ 695 ], [ 697 ], [ 701, 703 ], [ 705, 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727, 729 ], [ 731 ], [ 733 ], [ 737, 739 ], [ 741 ], [ 745 ], [ 747, 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 761 ], [ 763 ], [ 765 ], [ 767, 769 ], [ 773 ], [ 775, 777 ], [ 779, 781 ], [ 783, 785 ], [ 787, 789 ], [ 791, 793 ], [ 795 ], [ 797 ], [ 799 ], [ 803, 805 ], [ 809, 811 ], [ 813 ], [ 815 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825, 827, 829, 831 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 843 ], [ 847, 849 ], [ 851 ], [ 853, 855 ], [ 857, 859 ], [ 861 ], [ 863 ], [ 865, 867 ], [ 869 ], [ 871 ] ]
9,827
static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; old_mask = cpu->interrupt_request; cpu->interrupt_request |= mask; /* * If called from iothread context, wake the target cpu in * case its halted. */ if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); return; } if (use_icount) { cpu->icount_decr.u16.high = 0xffff; if (!cpu->can_do_io && (mask & ~old_mask) != 0) { cpu_abort(cpu, "Raised interrupt while not in I/O function"); } } else { cpu->tcg_exit_req = 1; } }
true
qemu
8d04fb55dec381bc5105cb47f29d918e579e8cbd
static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; old_mask = cpu->interrupt_request; cpu->interrupt_request |= mask; if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); return; } if (use_icount) { cpu->icount_decr.u16.high = 0xffff; if (!cpu->can_do_io && (mask & ~old_mask) != 0) { cpu_abort(cpu, "Raised interrupt while not in I/O function"); } } else { cpu->tcg_exit_req = 1; } }
{ "code": [ " } else {", " if (use_icount) {", " cpu->icount_decr.u16.high = 0xffff;", " if (!cpu->can_do_io", " && (mask & ~old_mask) != 0) {", " cpu_abort(cpu, \"Raised interrupt while not in I/O function\");", " cpu->tcg_exit_req = 1;" ], "line_no": [ 45, 33, 35, 37, 39, 41, 47 ] }
static void FUNC_0(CPUState *VAR_0, int VAR_1) { int VAR_2; VAR_2 = VAR_0->interrupt_request; VAR_0->interrupt_request |= VAR_1; if (!qemu_cpu_is_self(VAR_0)) { qemu_cpu_kick(VAR_0); return; } if (use_icount) { VAR_0->icount_decr.u16.high = 0xffff; if (!VAR_0->can_do_io && (VAR_1 & ~VAR_2) != 0) { cpu_abort(VAR_0, "Raised interrupt while not in I/O function"); } } else { VAR_0->tcg_exit_req = 1; } }
[ "static void FUNC_0(CPUState *VAR_0, int VAR_1)\n{", "int VAR_2;", "VAR_2 = VAR_0->interrupt_request;", "VAR_0->interrupt_request |= VAR_1;", "if (!qemu_cpu_is_self(VAR_0)) {", "qemu_cpu_kick(VAR_0);", "return;", "}", "if (use_icount) {", "VAR_0->icount_decr.u16.high = 0xffff;", "if (!VAR_0->can_do_io\n&& (VAR_1 & ~VAR_2) != 0) {", "cpu_abort(VAR_0, \"Raised interrupt while not in I/O function\");", "}", "} else {", "VAR_0->tcg_exit_req = 1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
9,828
void qemu_cond_broadcast(QemuCond *cond) { BOOLEAN result; /* * As in pthread_cond_signal, access to cond->waiters and * cond->target is locked via the external mutex. */ if (cond->waiters == 0) { return; } cond->target = 0; result = ReleaseSemaphore(cond->sema, cond->waiters, NULL); if (!result) { error_exit(GetLastError(), __func__); } /* * At this point all waiters continue. Each one takes its * slice of the semaphore. Now it's our turn to wait: Since * the external mutex is held, no thread can leave cond_wait, * yet. For this reason, we can be sure that no thread gets * a chance to eat *more* than one slice. OTOH, it means * that the last waiter must send us a wake-up. */ WaitForSingleObject(cond->continue_event, INFINITE); }
true
qemu
12f8def0e02232d7c6416ad9b66640f973c531d1
void qemu_cond_broadcast(QemuCond *cond) { BOOLEAN result; if (cond->waiters == 0) { return; } cond->target = 0; result = ReleaseSemaphore(cond->sema, cond->waiters, NULL); if (!result) { error_exit(GetLastError(), __func__); } WaitForSingleObject(cond->continue_event, INFINITE); }
{ "code": [ " error_exit(GetLastError(), __func__);", " error_exit(GetLastError(), __func__);", " if (!result) {", " error_exit(GetLastError(), __func__);", " if (!result) {", " error_exit(GetLastError(), __func__);", " if (cond->waiters == 0) {", " error_exit(GetLastError(), __func__);", " BOOLEAN result;", " if (cond->waiters == 0) {", " cond->target = 0;", " result = ReleaseSemaphore(cond->sema, cond->waiters, NULL);", " if (!result) {", " error_exit(GetLastError(), __func__);", " WaitForSingleObject(cond->continue_event, INFINITE);" ], "line_no": [ 29, 29, 27, 29, 27, 29, 15, 29, 5, 15, 23, 25, 27, 29, 51 ] }
void FUNC_0(QemuCond *VAR_0) { BOOLEAN result; if (VAR_0->waiters == 0) { return; } VAR_0->target = 0; result = ReleaseSemaphore(VAR_0->sema, VAR_0->waiters, NULL); if (!result) { error_exit(GetLastError(), __func__); } WaitForSingleObject(VAR_0->continue_event, INFINITE); }
[ "void FUNC_0(QemuCond *VAR_0)\n{", "BOOLEAN result;", "if (VAR_0->waiters == 0) {", "return;", "}", "VAR_0->target = 0;", "result = ReleaseSemaphore(VAR_0->sema, VAR_0->waiters, NULL);", "if (!result) {", "error_exit(GetLastError(), __func__);", "}", "WaitForSingleObject(VAR_0->continue_event, INFINITE);", "}" ]
[ 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 51 ], [ 53 ] ]
9,829
static uint16_t qvirtio_pci_config_readw(QVirtioDevice *d, uint64_t off) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint16_t value; value = qpci_io_readw(dev->pdev, CONFIG_BASE(dev) + off); if (qvirtio_is_big_endian(d)) { value = bswap16(value); } return value; }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static uint16_t qvirtio_pci_config_readw(QVirtioDevice *d, uint64_t off) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint16_t value; value = qpci_io_readw(dev->pdev, CONFIG_BASE(dev) + off); if (qvirtio_is_big_endian(d)) { value = bswap16(value); } return value; }
{ "code": [ " value = qpci_io_readw(dev->pdev, CONFIG_BASE(dev) + off);" ], "line_no": [ 11 ] }
static uint16_t FUNC_0(QVirtioDevice *d, uint64_t off) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint16_t value; value = qpci_io_readw(dev->pdev, CONFIG_BASE(dev) + off); if (qvirtio_is_big_endian(d)) { value = bswap16(value); } return value; }
[ "static uint16_t FUNC_0(QVirtioDevice *d, uint64_t off)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;", "uint16_t value;", "value = qpci_io_readw(dev->pdev, CONFIG_BASE(dev) + off);", "if (qvirtio_is_big_endian(d)) {", "value = bswap16(value);", "}", "return value;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
9,830
static int advanced_decode_picture_secondary_header(VC9Context *v) { GetBitContext *gb = &v->s.gb; int index, status = 0; switch(v->s.pict_type) { case P_TYPE: status = decode_p_picture_secondary_header(v); break; case B_TYPE: status = decode_b_picture_secondary_header(v); break; case BI_TYPE: case I_TYPE: status = decode_i_picture_secondary_header(v); break; } if (status<0) return FRAME_SKIPED; /* AC Syntax */ v->ac_table_level = decode012(gb); if (v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE) { v->ac2_table_level = decode012(gb); } /* DC Syntax */ index = decode012(gb); v->luma_dc_vlc = &ff_msmp4_dc_luma_vlc[index]; v->chroma_dc_vlc = &ff_msmp4_dc_chroma_vlc[index]; return 0; }
true
FFmpeg
7cc84d241ba6ef8e27e4d057176a4ad385ad3d59
static int advanced_decode_picture_secondary_header(VC9Context *v) { GetBitContext *gb = &v->s.gb; int index, status = 0; switch(v->s.pict_type) { case P_TYPE: status = decode_p_picture_secondary_header(v); break; case B_TYPE: status = decode_b_picture_secondary_header(v); break; case BI_TYPE: case I_TYPE: status = decode_i_picture_secondary_header(v); break; } if (status<0) return FRAME_SKIPED; v->ac_table_level = decode012(gb); if (v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE) { v->ac2_table_level = decode012(gb); } index = decode012(gb); v->luma_dc_vlc = &ff_msmp4_dc_luma_vlc[index]; v->chroma_dc_vlc = &ff_msmp4_dc_chroma_vlc[index]; return 0; }
{ "code": [ " GetBitContext *gb = &v->s.gb;", " GetBitContext *gb = &v->s.gb;", " index = decode012(gb);", " v->luma_dc_vlc = &ff_msmp4_dc_luma_vlc[index];", " v->chroma_dc_vlc = &ff_msmp4_dc_chroma_vlc[index];", " int index, status = 0;", " index = decode012(gb);", " v->luma_dc_vlc = &ff_msmp4_dc_luma_vlc[index];", " v->chroma_dc_vlc = &ff_msmp4_dc_chroma_vlc[index];" ], "line_no": [ 5, 5, 43, 45, 47, 7, 43, 45, 47 ] }
static int FUNC_0(VC9Context *VAR_0) { GetBitContext *gb = &VAR_0->s.gb; int VAR_1, VAR_2 = 0; switch(VAR_0->s.pict_type) { case P_TYPE: VAR_2 = decode_p_picture_secondary_header(VAR_0); break; case B_TYPE: VAR_2 = decode_b_picture_secondary_header(VAR_0); break; case BI_TYPE: case I_TYPE: VAR_2 = decode_i_picture_secondary_header(VAR_0); break; } if (VAR_2<0) return FRAME_SKIPED; VAR_0->ac_table_level = decode012(gb); if (VAR_0->s.pict_type == I_TYPE || VAR_0->s.pict_type == BI_TYPE) { VAR_0->ac2_table_level = decode012(gb); } VAR_1 = decode012(gb); VAR_0->luma_dc_vlc = &ff_msmp4_dc_luma_vlc[VAR_1]; VAR_0->chroma_dc_vlc = &ff_msmp4_dc_chroma_vlc[VAR_1]; return 0; }
[ "static int FUNC_0(VC9Context *VAR_0)\n{", "GetBitContext *gb = &VAR_0->s.gb;", "int VAR_1, VAR_2 = 0;", "switch(VAR_0->s.pict_type)\n{", "case P_TYPE: VAR_2 = decode_p_picture_secondary_header(VAR_0); break;", "case B_TYPE: VAR_2 = decode_b_picture_secondary_header(VAR_0); break;", "case BI_TYPE:\ncase I_TYPE: VAR_2 = decode_i_picture_secondary_header(VAR_0); break;", "}", "if (VAR_2<0) return FRAME_SKIPED;", "VAR_0->ac_table_level = decode012(gb);", "if (VAR_0->s.pict_type == I_TYPE || VAR_0->s.pict_type == BI_TYPE)\n{", "VAR_0->ac2_table_level = decode012(gb);", "}", "VAR_1 = decode012(gb);", "VAR_0->luma_dc_vlc = &ff_msmp4_dc_luma_vlc[VAR_1];", "VAR_0->chroma_dc_vlc = &ff_msmp4_dc_chroma_vlc[VAR_1];", "return 0;", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
9,831
struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, BlockBackend *blk, qemu_irq irq, qemu_irq dma[], omap_clk fclk, omap_clk iclk) { struct omap_mmc_s *s = (struct omap_mmc_s *) g_malloc0(sizeof(struct omap_mmc_s)); s->irq = irq; s->dma = dma; s->clk = fclk; s->lines = 4; s->rev = 2; omap_mmc_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); /* Instantiate the storage */ s->card = sd_init(blk, false); if (s->card == NULL) { exit(1); } s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0); sd_set_cb(s->card, NULL, s->cdet); return s; }
true
qemu
b45c03f585ea9bb1af76c73e82195418c294919d
struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, BlockBackend *blk, qemu_irq irq, qemu_irq dma[], omap_clk fclk, omap_clk iclk) { struct omap_mmc_s *s = (struct omap_mmc_s *) g_malloc0(sizeof(struct omap_mmc_s)); s->irq = irq; s->dma = dma; s->clk = fclk; s->lines = 4; s->rev = 2; omap_mmc_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); s->card = sd_init(blk, false); if (s->card == NULL) { exit(1); } s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0); sd_set_cb(s->card, NULL, s->cdet); return s; }
{ "code": [ " struct omap_mmc_s *s = (struct omap_mmc_s *)", " g_malloc0(sizeof(struct omap_mmc_s));", " struct omap_mmc_s *s = (struct omap_mmc_s *)", " g_malloc0(sizeof(struct omap_mmc_s));" ], "line_no": [ 9, 11, 9, 11 ] }
struct omap_mmc_s *FUNC_0(struct omap_target_agent_s *VAR_0, BlockBackend *VAR_1, qemu_irq VAR_2, qemu_irq VAR_3[], omap_clk VAR_4, omap_clk VAR_5) { struct omap_mmc_s *VAR_6 = (struct omap_mmc_s *) g_malloc0(sizeof(struct omap_mmc_s)); VAR_6->VAR_2 = VAR_2; VAR_6->VAR_3 = VAR_3; VAR_6->clk = VAR_4; VAR_6->lines = 4; VAR_6->rev = 2; omap_mmc_reset(VAR_6); memory_region_init_io(&VAR_6->iomem, NULL, &omap_mmc_ops, VAR_6, "omap.mmc", omap_l4_region_size(VAR_0, 0)); omap_l4_attach(VAR_0, 0, &VAR_6->iomem); VAR_6->card = sd_init(VAR_1, false); if (VAR_6->card == NULL) { exit(1); } VAR_6->cdet = qemu_allocate_irq(omap_mmc_cover_cb, VAR_6, 0); sd_set_cb(VAR_6->card, NULL, VAR_6->cdet); return VAR_6; }
[ "struct omap_mmc_s *FUNC_0(struct omap_target_agent_s *VAR_0,\nBlockBackend *VAR_1, qemu_irq VAR_2, qemu_irq VAR_3[],\nomap_clk VAR_4, omap_clk VAR_5)\n{", "struct omap_mmc_s *VAR_6 = (struct omap_mmc_s *)\ng_malloc0(sizeof(struct omap_mmc_s));", "VAR_6->VAR_2 = VAR_2;", "VAR_6->VAR_3 = VAR_3;", "VAR_6->clk = VAR_4;", "VAR_6->lines = 4;", "VAR_6->rev = 2;", "omap_mmc_reset(VAR_6);", "memory_region_init_io(&VAR_6->iomem, NULL, &omap_mmc_ops, VAR_6, \"omap.mmc\",\nomap_l4_region_size(VAR_0, 0));", "omap_l4_attach(VAR_0, 0, &VAR_6->iomem);", "VAR_6->card = sd_init(VAR_1, false);", "if (VAR_6->card == NULL) {", "exit(1);", "}", "VAR_6->cdet = qemu_allocate_irq(omap_mmc_cover_cb, VAR_6, 0);", "sd_set_cb(VAR_6->card, NULL, VAR_6->cdet);", "return VAR_6;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
9,832
static void dec_store(DisasContext *dc) { TCGv t, *addr; unsigned int size; size = 1 << (dc->opcode & 3); LOG_DIS("s%d%s\n", size, dc->type_b ? "i" : ""); t_sync_flags(dc); /* If we get a fault on a dslot, the jmpstate better be in sync. */ sync_jmpstate(dc); addr = compute_ldst_addr(dc, &t); /* Verify alignment if needed. */ if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) { gen_helper_memalign(*addr, tcg_const_tl(dc->rd), tcg_const_tl(1), tcg_const_tl(size - 1)); gen_store(dc, *addr, cpu_R[dc->rd], size); if (addr == &t) tcg_temp_free(t);
true
qemu
0187688f3270433269fc7d4909ad36dc5c5db7aa
static void dec_store(DisasContext *dc) { TCGv t, *addr; unsigned int size; size = 1 << (dc->opcode & 3); LOG_DIS("s%d%s\n", size, dc->type_b ? "i" : ""); t_sync_flags(dc); sync_jmpstate(dc); addr = compute_ldst_addr(dc, &t); if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) { gen_helper_memalign(*addr, tcg_const_tl(dc->rd), tcg_const_tl(1), tcg_const_tl(size - 1)); gen_store(dc, *addr, cpu_R[dc->rd], size); if (addr == &t) tcg_temp_free(t);
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { TCGv t, *addr; unsigned int VAR_1; VAR_1 = 1 << (VAR_0->opcode & 3); LOG_DIS("s%d%s\n", VAR_1, VAR_0->type_b ? "i" : ""); t_sync_flags(VAR_0); sync_jmpstate(VAR_0); addr = compute_ldst_addr(VAR_0, &t); if ((VAR_0->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && VAR_1 > 1) { gen_helper_memalign(*addr, tcg_const_tl(VAR_0->rd), tcg_const_tl(1), tcg_const_tl(VAR_1 - 1)); gen_store(VAR_0, *addr, cpu_R[VAR_0->rd], VAR_1); if (addr == &t) tcg_temp_free(t);
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "TCGv t, *addr;", "unsigned int VAR_1;", "VAR_1 = 1 << (VAR_0->opcode & 3);", "LOG_DIS(\"s%d%s\\n\", VAR_1, VAR_0->type_b ? \"i\" : \"\");", "t_sync_flags(VAR_0);", "sync_jmpstate(VAR_0);", "addr = compute_ldst_addr(VAR_0, &t);", "if ((VAR_0->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && VAR_1 > 1) {", "gen_helper_memalign(*addr, tcg_const_tl(VAR_0->rd),\ntcg_const_tl(1), tcg_const_tl(VAR_1 - 1));", "gen_store(VAR_0, *addr, cpu_R[VAR_0->rd], VAR_1);", "if (addr == &t)\ntcg_temp_free(t);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 9 ], [ 10 ], [ 12 ], [ 13, 14 ], [ 15 ], [ 16, 17 ] ]
9,833
static inline void range_dec_normalize(APEContext *ctx) { while (ctx->rc.range <= BOTTOM_VALUE) { ctx->rc.buffer <<= 8; if(ctx->ptr < ctx->data_end) ctx->rc.buffer += *ctx->ptr; ctx->ptr++; ctx->rc.low = (ctx->rc.low << 8) | ((ctx->rc.buffer >> 1) & 0xFF); ctx->rc.range <<= 8; } }
true
FFmpeg
5b8009f4c80d8fd96523c8c163441ad4011ad472
static inline void range_dec_normalize(APEContext *ctx) { while (ctx->rc.range <= BOTTOM_VALUE) { ctx->rc.buffer <<= 8; if(ctx->ptr < ctx->data_end) ctx->rc.buffer += *ctx->ptr; ctx->ptr++; ctx->rc.low = (ctx->rc.low << 8) | ((ctx->rc.buffer >> 1) & 0xFF); ctx->rc.range <<= 8; } }
{ "code": [ " if(ctx->ptr < ctx->data_end)", " ctx->ptr++;" ], "line_no": [ 9, 13 ] }
static inline void FUNC_0(APEContext *VAR_0) { while (VAR_0->rc.range <= BOTTOM_VALUE) { VAR_0->rc.buffer <<= 8; if(VAR_0->ptr < VAR_0->data_end) VAR_0->rc.buffer += *VAR_0->ptr; VAR_0->ptr++; VAR_0->rc.low = (VAR_0->rc.low << 8) | ((VAR_0->rc.buffer >> 1) & 0xFF); VAR_0->rc.range <<= 8; } }
[ "static inline void FUNC_0(APEContext *VAR_0)\n{", "while (VAR_0->rc.range <= BOTTOM_VALUE) {", "VAR_0->rc.buffer <<= 8;", "if(VAR_0->ptr < VAR_0->data_end)\nVAR_0->rc.buffer += *VAR_0->ptr;", "VAR_0->ptr++;", "VAR_0->rc.low = (VAR_0->rc.low << 8) | ((VAR_0->rc.buffer >> 1) & 0xFF);", "VAR_0->rc.range <<= 8;", "}", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
9,834
static int theora_header(AVFormatContext *s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; TheoraParams *thp = os->private; int cds = st->codec->extradata_size + os->psize + 2; int err; uint8_t *cdp; if (!(os->buf[os->pstart] & 0x80)) return 0; if (!thp) { thp = av_mallocz(sizeof(*thp)); if (!thp) return AVERROR(ENOMEM); os->private = thp; } switch (os->buf[os->pstart]) { case 0x80: { GetBitContext gb; AVRational timebase; init_get_bits(&gb, os->buf + os->pstart, os->psize * 8); /* 0x80"theora" */ skip_bits_long(&gb, 7 * 8); thp->version = get_bits_long(&gb, 24); if (thp->version < 0x030100) { av_log(s, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); return AVERROR(ENOSYS); } st->codec->width = get_bits(&gb, 16) << 4; st->codec->height = get_bits(&gb, 16) << 4; if (thp->version >= 0x030400) skip_bits(&gb, 100); if (thp->version >= 0x030200) { int width = get_bits_long(&gb, 24); int height = get_bits_long(&gb, 24); if (width <= st->codec->width && width > st->codec->width - 16 && height <= st->codec->height && height > st->codec->height - 16) { st->codec->width = width; st->codec->height = height; } skip_bits(&gb, 16); } timebase.den = get_bits_long(&gb, 32); timebase.num = get_bits_long(&gb, 32); if (!(timebase.num > 0 && timebase.den > 0)) { av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n"); timebase.num = 1; timebase.den = 25; } avpriv_set_pts_info(st, 64, timebase.num, timebase.den); st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); if (thp->version >= 0x304000) skip_bits(&gb, 2); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_THEORA; st->need_parsing = AVSTREAM_PARSE_HEADERS; } break; case 0x81: ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 7); case 0x82: if (!thp->version) return AVERROR_INVALIDDATA; break; default: av_log(s, AV_LOG_ERROR, "Unknown header type %X\n", os->buf[os->pstart]); return AVERROR_INVALIDDATA; } if ((err = av_reallocp(&st->codec->extradata, cds + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return err; } cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; memcpy(cdp, os->buf + os->pstart, os->psize); st->codec->extradata_size = cds; return 1; }
true
FFmpeg
45115315820a14d0c3f836adafb879475736e750
static int theora_header(AVFormatContext *s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; TheoraParams *thp = os->private; int cds = st->codec->extradata_size + os->psize + 2; int err; uint8_t *cdp; if (!(os->buf[os->pstart] & 0x80)) return 0; if (!thp) { thp = av_mallocz(sizeof(*thp)); if (!thp) return AVERROR(ENOMEM); os->private = thp; } switch (os->buf[os->pstart]) { case 0x80: { GetBitContext gb; AVRational timebase; init_get_bits(&gb, os->buf + os->pstart, os->psize * 8); skip_bits_long(&gb, 7 * 8); thp->version = get_bits_long(&gb, 24); if (thp->version < 0x030100) { av_log(s, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); return AVERROR(ENOSYS); } st->codec->width = get_bits(&gb, 16) << 4; st->codec->height = get_bits(&gb, 16) << 4; if (thp->version >= 0x030400) skip_bits(&gb, 100); if (thp->version >= 0x030200) { int width = get_bits_long(&gb, 24); int height = get_bits_long(&gb, 24); if (width <= st->codec->width && width > st->codec->width - 16 && height <= st->codec->height && height > st->codec->height - 16) { st->codec->width = width; st->codec->height = height; } skip_bits(&gb, 16); } timebase.den = get_bits_long(&gb, 32); timebase.num = get_bits_long(&gb, 32); if (!(timebase.num > 0 && timebase.den > 0)) { av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n"); timebase.num = 1; timebase.den = 25; } avpriv_set_pts_info(st, 64, timebase.num, timebase.den); st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); if (thp->version >= 0x304000) skip_bits(&gb, 2); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_THEORA; st->need_parsing = AVSTREAM_PARSE_HEADERS; } break; case 0x81: ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 7); case 0x82: if (!thp->version) return AVERROR_INVALIDDATA; break; default: av_log(s, AV_LOG_ERROR, "Unknown header type %X\n", os->buf[os->pstart]); return AVERROR_INVALIDDATA; } if ((err = av_reallocp(&st->codec->extradata, cds + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return err; } cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; memcpy(cdp, os->buf + os->pstart, os->psize); st->codec->extradata_size = cds; return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1) { struct VAR_2 *VAR_2 = VAR_0->priv_data; struct ogg_stream *VAR_3 = VAR_2->streams + VAR_1; AVStream *st = VAR_0->streams[VAR_1]; TheoraParams *thp = VAR_3->private; int VAR_4 = st->codec->extradata_size + VAR_3->psize + 2; int VAR_5; uint8_t *cdp; if (!(VAR_3->buf[VAR_3->pstart] & 0x80)) return 0; if (!thp) { thp = av_mallocz(sizeof(*thp)); if (!thp) return AVERROR(ENOMEM); VAR_3->private = thp; } switch (VAR_3->buf[VAR_3->pstart]) { case 0x80: { GetBitContext gb; AVRational timebase; init_get_bits(&gb, VAR_3->buf + VAR_3->pstart, VAR_3->psize * 8); skip_bits_long(&gb, 7 * 8); thp->version = get_bits_long(&gb, 24); if (thp->version < 0x030100) { av_log(VAR_0, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); return AVERROR(ENOSYS); } st->codec->VAR_6 = get_bits(&gb, 16) << 4; st->codec->VAR_7 = get_bits(&gb, 16) << 4; if (thp->version >= 0x030400) skip_bits(&gb, 100); if (thp->version >= 0x030200) { int VAR_6 = get_bits_long(&gb, 24); int VAR_7 = get_bits_long(&gb, 24); if (VAR_6 <= st->codec->VAR_6 && VAR_6 > st->codec->VAR_6 - 16 && VAR_7 <= st->codec->VAR_7 && VAR_7 > st->codec->VAR_7 - 16) { st->codec->VAR_6 = VAR_6; st->codec->VAR_7 = VAR_7; } skip_bits(&gb, 16); } timebase.den = get_bits_long(&gb, 32); timebase.num = get_bits_long(&gb, 32); if (!(timebase.num > 0 && timebase.den > 0)) { av_log(VAR_0, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n"); timebase.num = 1; timebase.den = 25; } avpriv_set_pts_info(st, 64, timebase.num, timebase.den); st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); if (thp->version >= 0x304000) skip_bits(&gb, 2); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_THEORA; st->need_parsing = AVSTREAM_PARSE_HEADERS; } break; case 0x81: ff_vorbis_comment(VAR_0, &st->metadata, VAR_3->buf + VAR_3->pstart + 7, VAR_3->psize - 7); case 0x82: if (!thp->version) return AVERROR_INVALIDDATA; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unknown header type %X\n", VAR_3->buf[VAR_3->pstart]); return AVERROR_INVALIDDATA; } if ((VAR_5 = av_reallocp(&st->codec->extradata, VAR_4 + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return VAR_5; } cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = VAR_3->psize >> 8; *cdp++ = VAR_3->psize & 0xff; memcpy(cdp, VAR_3->buf + VAR_3->pstart, VAR_3->psize); st->codec->extradata_size = VAR_4; return 1; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{", "struct VAR_2 *VAR_2 = VAR_0->priv_data;", "struct ogg_stream *VAR_3 = VAR_2->streams + VAR_1;", "AVStream *st = VAR_0->streams[VAR_1];", "TheoraParams *thp = VAR_3->private;", "int VAR_4 = st->codec->extradata_size + VAR_3->psize + 2;", "int VAR_5;", "uint8_t *cdp;", "if (!(VAR_3->buf[VAR_3->pstart] & 0x80))\nreturn 0;", "if (!thp) {", "thp = av_mallocz(sizeof(*thp));", "if (!thp)\nreturn AVERROR(ENOMEM);", "VAR_3->private = thp;", "}", "switch (VAR_3->buf[VAR_3->pstart]) {", "case 0x80: {", "GetBitContext gb;", "AVRational timebase;", "init_get_bits(&gb, VAR_3->buf + VAR_3->pstart, VAR_3->psize * 8);", "skip_bits_long(&gb, 7 * 8);", "thp->version = get_bits_long(&gb, 24);", "if (thp->version < 0x030100) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Too old or unsupported Theora (%x)\\n\", thp->version);", "return AVERROR(ENOSYS);", "}", "st->codec->VAR_6 = get_bits(&gb, 16) << 4;", "st->codec->VAR_7 = get_bits(&gb, 16) << 4;", "if (thp->version >= 0x030400)\nskip_bits(&gb, 100);", "if (thp->version >= 0x030200) {", "int VAR_6 = get_bits_long(&gb, 24);", "int VAR_7 = get_bits_long(&gb, 24);", "if (VAR_6 <= st->codec->VAR_6 && VAR_6 > st->codec->VAR_6 - 16 &&\nVAR_7 <= st->codec->VAR_7 && VAR_7 > st->codec->VAR_7 - 16) {", "st->codec->VAR_6 = VAR_6;", "st->codec->VAR_7 = VAR_7;", "}", "skip_bits(&gb, 16);", "}", "timebase.den = get_bits_long(&gb, 32);", "timebase.num = get_bits_long(&gb, 32);", "if (!(timebase.num > 0 && timebase.den > 0)) {", "av_log(VAR_0, AV_LOG_WARNING, \"Invalid time base in theora stream, assuming 25 FPS\\n\");", "timebase.num = 1;", "timebase.den = 25;", "}", "avpriv_set_pts_info(st, 64, timebase.num, timebase.den);", "st->sample_aspect_ratio.num = get_bits_long(&gb, 24);", "st->sample_aspect_ratio.den = get_bits_long(&gb, 24);", "if (thp->version >= 0x030200)\nskip_bits_long(&gb, 38);", "if (thp->version >= 0x304000)\nskip_bits(&gb, 2);", "thp->gpshift = get_bits(&gb, 5);", "thp->gpmask = (1 << thp->gpshift) - 1;", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_id = AV_CODEC_ID_THEORA;", "st->need_parsing = AVSTREAM_PARSE_HEADERS;", "}", "break;", "case 0x81:\nff_vorbis_comment(VAR_0, &st->metadata, VAR_3->buf + VAR_3->pstart + 7, VAR_3->psize - 7);", "case 0x82:\nif (!thp->version)\nreturn AVERROR_INVALIDDATA;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown header type %X\\n\", VAR_3->buf[VAR_3->pstart]);", "return AVERROR_INVALIDDATA;", "}", "if ((VAR_5 = av_reallocp(&st->codec->extradata,\nVAR_4 + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) {", "st->codec->extradata_size = 0;", "return VAR_5;", "}", "cdp = st->codec->extradata + st->codec->extradata_size;", "*cdp++ = VAR_3->psize >> 8;", "*cdp++ = VAR_3->psize & 0xff;", "memcpy(cdp, VAR_3->buf + VAR_3->pstart, VAR_3->psize);", "st->codec->extradata_size = VAR_4;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10, 11 ], [ 12 ], [ 13 ], [ 14, 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 24 ], [ 25 ], [ 26 ], [ 27, 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33, 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38, 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55, 56 ], [ 57, 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66, 67 ], [ 68, 69, 70 ], [ 71 ], [ 72, 73 ], [ 74 ], [ 75 ], [ 76, 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83 ], [ 84 ], [ 85 ], [ 86 ], [ 87 ] ]
9,836
static int buffer_needs_copy(PadContext *s, AVFrame *frame, AVBufferRef *buf) { int planes[4] = { -1, -1, -1, -1}, *p = planes; int i, j; /* get all planes in this buffer */ for (i = 0; i < FF_ARRAY_ELEMS(planes) && frame->data[i]; i++) { if (av_frame_get_plane_buffer(frame, i) == buf) *p++ = i; } /* for each plane in this buffer, check that it can be padded without * going over buffer bounds or other planes */ for (i = 0; i < FF_ARRAY_ELEMS(planes) && planes[i] >= 0; i++) { int hsub = (planes[i] == 1 || planes[i] == 2) ? s->hsub : 0; int vsub = (planes[i] == 1 || planes[i] == 2) ? s->vsub : 0; uint8_t *start = frame->data[planes[i]]; uint8_t *end = start + (frame->height >> hsub) * frame->linesize[planes[i]]; /* amount of free space needed before the start and after the end * of the plane */ ptrdiff_t req_start = (s->x >> hsub) * s->line_step[planes[i]] + (s->y >> vsub) * frame->linesize[planes[i]]; ptrdiff_t req_end = ((s->w - s->x - frame->width) >> hsub) * s->line_step[planes[i]] + (s->y >> vsub) * frame->linesize[planes[i]]; if (frame->linesize[planes[i]] < (s->w >> hsub) * s->line_step[planes[i]]) return 1; if (start - buf->data < req_start || (buf->data + buf->size) - end < req_end) return 1; #define SIGN(x) ((x) > 0 ? 1 : -1) for (j = 0; j < FF_ARRAY_ELEMS(planes) & planes[j] >= 0; j++) { int hsub1 = (planes[j] == 1 || planes[j] == 2) ? s->hsub : 0; uint8_t *start1 = frame->data[planes[j]]; uint8_t *end1 = start1 + (frame->height >> hsub1) * frame->linesize[planes[j]]; if (i == j) continue; if (SIGN(start - end1) != SIGN(start - end1 - req_start) || SIGN(end - start1) != SIGN(end - start1 + req_end)) return 1; } } return 0; }
true
FFmpeg
5d639b2b4a6d1f5710cfe247dea4d4c6debdfe0d
static int buffer_needs_copy(PadContext *s, AVFrame *frame, AVBufferRef *buf) { int planes[4] = { -1, -1, -1, -1}, *p = planes; int i, j; for (i = 0; i < FF_ARRAY_ELEMS(planes) && frame->data[i]; i++) { if (av_frame_get_plane_buffer(frame, i) == buf) *p++ = i; } for (i = 0; i < FF_ARRAY_ELEMS(planes) && planes[i] >= 0; i++) { int hsub = (planes[i] == 1 || planes[i] == 2) ? s->hsub : 0; int vsub = (planes[i] == 1 || planes[i] == 2) ? s->vsub : 0; uint8_t *start = frame->data[planes[i]]; uint8_t *end = start + (frame->height >> hsub) * frame->linesize[planes[i]]; ptrdiff_t req_start = (s->x >> hsub) * s->line_step[planes[i]] + (s->y >> vsub) * frame->linesize[planes[i]]; ptrdiff_t req_end = ((s->w - s->x - frame->width) >> hsub) * s->line_step[planes[i]] + (s->y >> vsub) * frame->linesize[planes[i]]; if (frame->linesize[planes[i]] < (s->w >> hsub) * s->line_step[planes[i]]) return 1; if (start - buf->data < req_start || (buf->data + buf->size) - end < req_end) return 1; #define SIGN(x) ((x) > 0 ? 1 : -1) for (j = 0; j < FF_ARRAY_ELEMS(planes) & planes[j] >= 0; j++) { int hsub1 = (planes[j] == 1 || planes[j] == 2) ? s->hsub : 0; uint8_t *start1 = frame->data[planes[j]]; uint8_t *end1 = start1 + (frame->height >> hsub1) * frame->linesize[planes[j]]; if (i == j) continue; if (SIGN(start - end1) != SIGN(start - end1 - req_start) || SIGN(end - start1) != SIGN(end - start1 + req_end)) return 1; } } return 0; }
{ "code": [ " for (j = 0; j < FF_ARRAY_ELEMS(planes) & planes[j] >= 0; j++) {" ], "line_no": [ 73 ] }
static int FUNC_0(PadContext *VAR_0, AVFrame *VAR_1, AVBufferRef *VAR_2) { int VAR_3[4] = { -1, -1, -1, -1}, *VAR_4 = VAR_3; int VAR_5, VAR_6; for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_3) && VAR_1->data[VAR_5]; VAR_5++) { if (av_frame_get_plane_buffer(VAR_1, VAR_5) == VAR_2) *VAR_4++ = VAR_5; } for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_3) && VAR_3[VAR_5] >= 0; VAR_5++) { int VAR_7 = (VAR_3[VAR_5] == 1 || VAR_3[VAR_5] == 2) ? VAR_0->VAR_7 : 0; int VAR_8 = (VAR_3[VAR_5] == 1 || VAR_3[VAR_5] == 2) ? VAR_0->VAR_8 : 0; uint8_t *start = VAR_1->data[VAR_3[VAR_5]]; uint8_t *end = start + (VAR_1->height >> VAR_7) * VAR_1->linesize[VAR_3[VAR_5]]; ptrdiff_t req_start = (VAR_0->x >> VAR_7) * VAR_0->line_step[VAR_3[VAR_5]] + (VAR_0->y >> VAR_8) * VAR_1->linesize[VAR_3[VAR_5]]; ptrdiff_t req_end = ((VAR_0->w - VAR_0->x - VAR_1->width) >> VAR_7) * VAR_0->line_step[VAR_3[VAR_5]] + (VAR_0->y >> VAR_8) * VAR_1->linesize[VAR_3[VAR_5]]; if (VAR_1->linesize[VAR_3[VAR_5]] < (VAR_0->w >> VAR_7) * VAR_0->line_step[VAR_3[VAR_5]]) return 1; if (start - VAR_2->data < req_start || (VAR_2->data + VAR_2->size) - end < req_end) return 1; #define SIGN(x) ((x) > 0 ? 1 : -1) for (VAR_6 = 0; VAR_6 < FF_ARRAY_ELEMS(VAR_3) & VAR_3[VAR_6] >= 0; VAR_6++) { int VAR_9 = (VAR_3[VAR_6] == 1 || VAR_3[VAR_6] == 2) ? VAR_0->VAR_7 : 0; uint8_t *start1 = VAR_1->data[VAR_3[VAR_6]]; uint8_t *end1 = start1 + (VAR_1->height >> VAR_9) * VAR_1->linesize[VAR_3[VAR_6]]; if (VAR_5 == VAR_6) continue; if (SIGN(start - end1) != SIGN(start - end1 - req_start) || SIGN(end - start1) != SIGN(end - start1 + req_end)) return 1; } } return 0; }
[ "static int FUNC_0(PadContext *VAR_0, AVFrame *VAR_1, AVBufferRef *VAR_2)\n{", "int VAR_3[4] = { -1, -1, -1, -1}, *VAR_4 = VAR_3;", "int VAR_5, VAR_6;", "for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_3) && VAR_1->data[VAR_5]; VAR_5++) {", "if (av_frame_get_plane_buffer(VAR_1, VAR_5) == VAR_2)\n*VAR_4++ = VAR_5;", "}", "for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_3) && VAR_3[VAR_5] >= 0; VAR_5++) {", "int VAR_7 = (VAR_3[VAR_5] == 1 || VAR_3[VAR_5] == 2) ? VAR_0->VAR_7 : 0;", "int VAR_8 = (VAR_3[VAR_5] == 1 || VAR_3[VAR_5] == 2) ? VAR_0->VAR_8 : 0;", "uint8_t *start = VAR_1->data[VAR_3[VAR_5]];", "uint8_t *end = start + (VAR_1->height >> VAR_7) *\nVAR_1->linesize[VAR_3[VAR_5]];", "ptrdiff_t req_start = (VAR_0->x >> VAR_7) * VAR_0->line_step[VAR_3[VAR_5]] +\n(VAR_0->y >> VAR_8) * VAR_1->linesize[VAR_3[VAR_5]];", "ptrdiff_t req_end = ((VAR_0->w - VAR_0->x - VAR_1->width) >> VAR_7) *\nVAR_0->line_step[VAR_3[VAR_5]] +\n(VAR_0->y >> VAR_8) * VAR_1->linesize[VAR_3[VAR_5]];", "if (VAR_1->linesize[VAR_3[VAR_5]] < (VAR_0->w >> VAR_7) * VAR_0->line_step[VAR_3[VAR_5]])\nreturn 1;", "if (start - VAR_2->data < req_start ||\n(VAR_2->data + VAR_2->size) - end < req_end)\nreturn 1;", "#define SIGN(x) ((x) > 0 ? 1 : -1)\nfor (VAR_6 = 0; VAR_6 < FF_ARRAY_ELEMS(VAR_3) & VAR_3[VAR_6] >= 0; VAR_6++) {", "int VAR_9 = (VAR_3[VAR_6] == 1 || VAR_3[VAR_6] == 2) ? VAR_0->VAR_7 : 0;", "uint8_t *start1 = VAR_1->data[VAR_3[VAR_6]];", "uint8_t *end1 = start1 + (VAR_1->height >> VAR_9) *\nVAR_1->linesize[VAR_3[VAR_6]];", "if (VAR_5 == VAR_6)\ncontinue;", "if (SIGN(start - end1) != SIGN(start - end1 - req_start) ||\nSIGN(end - start1) != SIGN(end - start1 + req_end))\nreturn 1;", "}", "}", "return 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 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 47, 49 ], [ 51, 53, 55 ], [ 59, 61 ], [ 63, 65, 67 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83, 85 ], [ 89, 91, 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ] ]
9,837
static void adb_kbd_initfn(Object *obj) { ADBDevice *d = ADB_DEVICE(obj); d->devaddr = ADB_DEVID_KEYBOARD; }
true
qemu
77cb0f5aafc8e6d0c6d3c339f381c9b7921648e0
static void adb_kbd_initfn(Object *obj) { ADBDevice *d = ADB_DEVICE(obj); d->devaddr = ADB_DEVID_KEYBOARD; }
{ "code": [ " d->devaddr = ADB_DEVID_KEYBOARD;", "static void adb_kbd_initfn(Object *obj)", " ADBDevice *d = ADB_DEVICE(obj);", " d->devaddr = ADB_DEVID_KEYBOARD;", " ADBDevice *d = ADB_DEVICE(obj);" ], "line_no": [ 9, 1, 5, 9, 5 ] }
static void FUNC_0(Object *VAR_0) { ADBDevice *d = ADB_DEVICE(VAR_0); d->devaddr = ADB_DEVID_KEYBOARD; }
[ "static void FUNC_0(Object *VAR_0)\n{", "ADBDevice *d = ADB_DEVICE(VAR_0);", "d->devaddr = ADB_DEVID_KEYBOARD;", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]