id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
22,359
static void pl011_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { PL011State *s = (PL011State *)opaque; unsigned char ch; switch (offset >> 2) { case 0: /* UARTDR */ /* ??? Check if transmitter is enabled. */ ch = value; if (s->chr) qemu_chr_fe_write(s->chr, &ch, 1); s->int_level |= PL011_INT_TX; pl011_update(s); break; case 1: /* UARTCR */ s->cr = value; break; case 6: /* UARTFR */ /* Writes to Flag register are ignored. */ break; case 8: /* UARTUARTILPR */ s->ilpr = value; break; case 9: /* UARTIBRD */ s->ibrd = value; break; case 10: /* UARTFBRD */ s->fbrd = value; break; case 11: /* UARTLCR_H */ /* Reset the FIFO state on FIFO enable or disable */ if ((s->lcr ^ value) & 0x10) { s->read_count = 0; s->read_pos = 0; } s->lcr = value; pl011_set_read_trigger(s); break; case 12: /* UARTCR */ /* ??? Need to implement the enable and loopback bits. */ s->cr = value; break; case 13: /* UARTIFS */ s->ifl = value; pl011_set_read_trigger(s); break; case 14: /* UARTIMSC */ s->int_enabled = value; pl011_update(s); break; case 17: /* UARTICR */ s->int_level &= ~value; pl011_update(s); break; case 18: /* UARTDMACR */ s->dmacr = value; if (value & 3) { qemu_log_mask(LOG_UNIMP, "pl011: DMA not implemented\n"); } break; default: qemu_log_mask(LOG_GUEST_ERROR, "pl011_write: Bad offset %x\n", (int)offset); } }
true
qemu
ce8f0905a59232982c8a220169e11c14c73e7dea
static void pl011_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { PL011State *s = (PL011State *)opaque; unsigned char ch; switch (offset >> 2) { case 0: ch = value; if (s->chr) qemu_chr_fe_write(s->chr, &ch, 1); s->int_level |= PL011_INT_TX; pl011_update(s); break; case 1: s->cr = value; break; case 6: break; case 8: s->ilpr = value; break; case 9: s->ibrd = value; break; case 10: s->fbrd = value; break; case 11: if ((s->lcr ^ value) & 0x10) { s->read_count = 0; s->read_pos = 0; } s->lcr = value; pl011_set_read_trigger(s); break; case 12: s->cr = value; break; case 13: s->ifl = value; pl011_set_read_trigger(s); break; case 14: s->int_enabled = value; pl011_update(s); break; case 17: s->int_level &= ~value; pl011_update(s); break; case 18: s->dmacr = value; if (value & 3) { qemu_log_mask(LOG_UNIMP, "pl011: DMA not implemented\n"); } break; default: qemu_log_mask(LOG_GUEST_ERROR, "pl011_write: Bad offset %x\n", (int)offset); } }
{ "code": [ " s->cr = value;" ], "line_no": [ 33 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { PL011State *s = (PL011State *)VAR_0; unsigned char VAR_4; switch (VAR_1 >> 2) { case 0: VAR_4 = VAR_2; if (s->chr) qemu_chr_fe_write(s->chr, &VAR_4, 1); s->int_level |= PL011_INT_TX; pl011_update(s); break; case 1: s->cr = VAR_2; break; case 6: break; case 8: s->ilpr = VAR_2; break; case 9: s->ibrd = VAR_2; break; case 10: s->fbrd = VAR_2; break; case 11: if ((s->lcr ^ VAR_2) & 0x10) { s->read_count = 0; s->read_pos = 0; } s->lcr = VAR_2; pl011_set_read_trigger(s); break; case 12: s->cr = VAR_2; break; case 13: s->ifl = VAR_2; pl011_set_read_trigger(s); break; case 14: s->int_enabled = VAR_2; pl011_update(s); break; case 17: s->int_level &= ~VAR_2; pl011_update(s); break; case 18: s->dmacr = VAR_2; if (VAR_2 & 3) { qemu_log_mask(LOG_UNIMP, "pl011: DMA not implemented\n"); } break; default: qemu_log_mask(LOG_GUEST_ERROR, "FUNC_0: Bad VAR_1 %x\n", (int)VAR_1); } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PL011State *s = (PL011State *)VAR_0;", "unsigned char VAR_4;", "switch (VAR_1 >> 2) {", "case 0:\nVAR_4 = VAR_2;", "if (s->chr)\nqemu_chr_fe_write(s->chr, &VAR_4, 1);", "s->int_level |= PL011_INT_TX;", "pl011_update(s);", "break;", "case 1:\ns->cr = VAR_2;", "break;", "case 6:\nbreak;", "case 8:\ns->ilpr = VAR_2;", "break;", "case 9:\ns->ibrd = VAR_2;", "break;", "case 10:\ns->fbrd = VAR_2;", "break;", "case 11:\nif ((s->lcr ^ VAR_2) & 0x10) {", "s->read_count = 0;", "s->read_pos = 0;", "}", "s->lcr = VAR_2;", "pl011_set_read_trigger(s);", "break;", "case 12:\ns->cr = VAR_2;", "break;", "case 13:\ns->ifl = VAR_2;", "pl011_set_read_trigger(s);", "break;", "case 14:\ns->int_enabled = VAR_2;", "pl011_update(s);", "break;", "case 17:\ns->int_level &= ~VAR_2;", "pl011_update(s);", "break;", "case 18:\ns->dmacr = VAR_2;", "if (VAR_2 & 3) {", "qemu_log_mask(LOG_UNIMP, \"pl011: DMA not implemented\\n\");", "}", "break;", "default:\nqemu_log_mask(LOG_GUEST_ERROR,\n\"FUNC_0: Bad VAR_1 %x\\n\", (int)VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 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 ] ]
22,360
static uint64_t openpic_gbl_read(void *opaque, hwaddr addr, unsigned len) { OpenPICState *opp = opaque; uint32_t retval; DPRINTF("%s: addr " TARGET_FMT_plx "\n", __func__, addr); retval = 0xFFFFFFFF; if (addr & 0xF) return retval; switch (addr) { case 0x1000: /* FREP */ retval = opp->frep; break; case 0x1020: /* GLBC */ retval = opp->glbc; break; case 0x1080: /* VENI */ retval = opp->veni; break; case 0x1090: /* PINT */ retval = 0x00000000; break; case 0x00: /* Block Revision Register1 (BRR1) */ retval = opp->brr1; break; case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xA0: case 0xB0: retval = openpic_cpu_read_internal(opp, addr, get_current_cpu()); break; case 0x10A0: /* IPI_IPVP */ case 0x10B0: case 0x10C0: case 0x10D0: { int idx; idx = (addr - 0x10A0) >> 4; retval = read_IRQreg_ipvp(opp, opp->irq_ipi0 + idx); } break; case 0x10E0: /* SPVE */ retval = opp->spve; break; default: break; } DPRINTF("%s: => %08x\n", __func__, retval); return retval; }
true
qemu
af7e9e74c6a62a5bcd911726a9e88d28b61490e0
static uint64_t openpic_gbl_read(void *opaque, hwaddr addr, unsigned len) { OpenPICState *opp = opaque; uint32_t retval; DPRINTF("%s: addr " TARGET_FMT_plx "\n", __func__, addr); retval = 0xFFFFFFFF; if (addr & 0xF) return retval; switch (addr) { case 0x1000: retval = opp->frep; break; case 0x1020: retval = opp->glbc; break; case 0x1080: retval = opp->veni; break; case 0x1090: retval = 0x00000000; break; case 0x00: retval = opp->brr1; break; case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xA0: case 0xB0: retval = openpic_cpu_read_internal(opp, addr, get_current_cpu()); break; case 0x10A0: case 0x10B0: case 0x10C0: case 0x10D0: { int idx; idx = (addr - 0x10A0) >> 4; retval = read_IRQreg_ipvp(opp, opp->irq_ipi0 + idx); } break; case 0x10E0: retval = opp->spve; break; default: break; } DPRINTF("%s: => %08x\n", __func__, retval); return retval; }
{ "code": [ " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15 ] }
static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned len) { OpenPICState *opp = opaque; uint32_t retval; DPRINTF("%s: addr " TARGET_FMT_plx "\n", __func__, addr); retval = 0xFFFFFFFF; if (addr & 0xF) return retval; switch (addr) { case 0x1000: retval = opp->frep; break; case 0x1020: retval = opp->glbc; break; case 0x1080: retval = opp->veni; break; case 0x1090: retval = 0x00000000; break; case 0x00: retval = opp->brr1; break; case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xA0: case 0xB0: retval = openpic_cpu_read_internal(opp, addr, get_current_cpu()); break; case 0x10A0: case 0x10B0: case 0x10C0: case 0x10D0: { int VAR_0; VAR_0 = (addr - 0x10A0) >> 4; retval = read_IRQreg_ipvp(opp, opp->irq_ipi0 + VAR_0); } break; case 0x10E0: retval = opp->spve; break; default: break; } DPRINTF("%s: => %08x\n", __func__, retval); return retval; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned len)\n{", "OpenPICState *opp = opaque;", "uint32_t retval;", "DPRINTF(\"%s: addr \" TARGET_FMT_plx \"\\n\", __func__, addr);", "retval = 0xFFFFFFFF;", "if (addr & 0xF)\nreturn retval;", "switch (addr) {", "case 0x1000:\nretval = opp->frep;", "break;", "case 0x1020:\nretval = opp->glbc;", "break;", "case 0x1080:\nretval = opp->veni;", "break;", "case 0x1090:\nretval = 0x00000000;", "break;", "case 0x00:\nretval = opp->brr1;", "break;", "case 0x40:\ncase 0x50:\ncase 0x60:\ncase 0x70:\ncase 0x80:\ncase 0x90:\ncase 0xA0:\ncase 0xB0:\nretval = openpic_cpu_read_internal(opp, addr, get_current_cpu());", "break;", "case 0x10A0:\ncase 0x10B0:\ncase 0x10C0:\ncase 0x10D0:\n{", "int VAR_0;", "VAR_0 = (addr - 0x10A0) >> 4;", "retval = read_IRQreg_ipvp(opp, opp->irq_ipi0 + VAR_0);", "}", "break;", "case 0x10E0:\nretval = opp->spve;", "break;", "default:\nbreak;", "}", "DPRINTF(\"%s: => %08x\\n\", __func__, retval);", "return retval;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53, 55, 57, 59, 61, 63, 65, 67 ], [ 69 ], [ 71, 73, 75, 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ] ]
22,362
static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_topright, int _stride) { int y; pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); PREDICT_8x8_LOAD_TOP; src[0] = t0; src[1] = t1; src[2] = t2; src[3] = t3; src[4] = t4; src[5] = t5; src[6] = t6; src[7] = t7; for( y = 1; y < 8; y++ ) { ((pixel4*)(src+y*stride))[0] = ((pixel4*)src)[0]; ((pixel4*)(src+y*stride))[1] = ((pixel4*)src)[1]; } }
true
FFmpeg
2caf19e90f270abe1e80a3e85acaf0eb5c9d0aac
static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_topright, int _stride) { int y; pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); PREDICT_8x8_LOAD_TOP; src[0] = t0; src[1] = t1; src[2] = t2; src[3] = t3; src[4] = t4; src[5] = t5; src[6] = t6; src[7] = t7; for( y = 1; y < 8; y++ ) { ((pixel4*)(src+y*stride))[0] = ((pixel4*)src)[0]; ((pixel4*)(src+y*stride))[1] = ((pixel4*)src)[1]; } }
{ "code": [ " ((pixel4*)(src+y*stride))[0] = ((pixel4*)src)[0];", " ((pixel4*)(src+y*stride))[1] = ((pixel4*)src)[1];" ], "line_no": [ 33, 35 ] }
static void FUNC_0(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_topright, int _stride) { int VAR_0; pixel *src = (pixel*)_src; int VAR_1 = _stride/sizeof(pixel); PREDICT_8x8_LOAD_TOP; src[0] = t0; src[1] = t1; src[2] = t2; src[3] = t3; src[4] = t4; src[5] = t5; src[6] = t6; src[7] = t7; for( VAR_0 = 1; VAR_0 < 8; VAR_0++ ) { ((pixel4*)(src+VAR_0*VAR_1))[0] = ((pixel4*)src)[0]; ((pixel4*)(src+VAR_0*VAR_1))[1] = ((pixel4*)src)[1]; } }
[ "static void FUNC_0(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_topright, int _stride)\n{", "int VAR_0;", "pixel *src = (pixel*)_src;", "int VAR_1 = _stride/sizeof(pixel);", "PREDICT_8x8_LOAD_TOP;", "src[0] = t0;", "src[1] = t1;", "src[2] = t2;", "src[3] = t3;", "src[4] = t4;", "src[5] = t5;", "src[6] = t6;", "src[7] = t7;", "for( VAR_0 = 1; VAR_0 < 8; VAR_0++ ) {", "((pixel4*)(src+VAR_0*VAR_1))[0] = ((pixel4*)src)[0];", "((pixel4*)(src+VAR_0*VAR_1))[1] = ((pixel4*)src)[1];", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
22,363
static int check_intra_pred_mode(int mode, int mb_x, int mb_y) { if (mode == DC_PRED8x8) { if (!(mb_x|mb_y)) mode = DC_128_PRED8x8; else if (!mb_y) mode = LEFT_DC_PRED8x8; else if (!mb_x) mode = TOP_DC_PRED8x8; } return mode; }
false
FFmpeg
a71abb714e350b017e1e0c1607e343e1e2f2f8a9
static int check_intra_pred_mode(int mode, int mb_x, int mb_y) { if (mode == DC_PRED8x8) { if (!(mb_x|mb_y)) mode = DC_128_PRED8x8; else if (!mb_y) mode = LEFT_DC_PRED8x8; else if (!mb_x) mode = TOP_DC_PRED8x8; } return mode; }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, int VAR_1, int VAR_2) { if (VAR_0 == DC_PRED8x8) { if (!(VAR_1|VAR_2)) VAR_0 = DC_128_PRED8x8; else if (!VAR_2) VAR_0 = LEFT_DC_PRED8x8; else if (!VAR_1) VAR_0 = TOP_DC_PRED8x8; } return VAR_0; }
[ "static int FUNC_0(int VAR_0, int VAR_1, int VAR_2)\n{", "if (VAR_0 == DC_PRED8x8) {", "if (!(VAR_1|VAR_2))\nVAR_0 = DC_128_PRED8x8;", "else if (!VAR_2)\nVAR_0 = LEFT_DC_PRED8x8;", "else if (!VAR_1)\nVAR_0 = TOP_DC_PRED8x8;", "}", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ] ]
22,366
static void gen_swap_half(TCGv var) { TCGv tmp = new_tmp(); tcg_gen_shri_i32(tmp, var, 16); tcg_gen_shli_i32(var, var, 16); tcg_gen_or_i32(var, var, tmp); dead_tmp(tmp); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static void gen_swap_half(TCGv var) { TCGv tmp = new_tmp(); tcg_gen_shri_i32(tmp, var, 16); tcg_gen_shli_i32(var, var, 16); tcg_gen_or_i32(var, var, tmp); dead_tmp(tmp); }
{ "code": [ " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(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();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);" ], "line_no": [ 5, 5, 5, 13, 5, 13, 5, 13, 5, 13, 5, 13, 13, 13, 13, 5, 13, 13, 5, 5, 5, 5, 5, 5, 5, 13, 5, 13, 5, 13, 5, 13, 5, 13, 13, 5, 13, 13, 5, 13, 13 ] }
static void FUNC_0(TCGv VAR_0) { TCGv tmp = new_tmp(); tcg_gen_shri_i32(tmp, VAR_0, 16); tcg_gen_shli_i32(VAR_0, VAR_0, 16); tcg_gen_or_i32(VAR_0, VAR_0, tmp); dead_tmp(tmp); }
[ "static void FUNC_0(TCGv VAR_0)\n{", "TCGv tmp = new_tmp();", "tcg_gen_shri_i32(tmp, VAR_0, 16);", "tcg_gen_shli_i32(VAR_0, VAR_0, 16);", "tcg_gen_or_i32(VAR_0, VAR_0, tmp);", "dead_tmp(tmp);", "}" ]
[ 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
22,367
void g_free(void *mem) { free(mem); }
true
qemu
9d7a4c6690ef9962a3b20034f65008f1ea15c1d6
void g_free(void *mem) { free(mem); }
{ "code": [ "void g_free(void *mem)", " free(mem);" ], "line_no": [ 1, 5 ] }
void FUNC_0(void *VAR_0) { free(VAR_0); }
[ "void FUNC_0(void *VAR_0)\n{", "free(VAR_0);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
22,370
static int http_open_cnx(URLContext *h) { const char *path, *proxy_path, *lower_proto = "tcp", *local_path; char hostname[1024], hoststr[1024], proto[10]; char auth[1024], proxyauth[1024]; char path1[1024]; char buf[1024], urlbuf[1024]; int port, use_proxy, err, location_changed = 0, redirects = 0; HTTPAuthType cur_auth_type, cur_proxy_auth_type; HTTPContext *s = h->priv_data; URLContext *hd = NULL; proxy_path = getenv("http_proxy"); use_proxy = (proxy_path != NULL) && !getenv("no_proxy") && av_strstart(proxy_path, "http://", NULL); /* fill the dest addr */ redo: /* needed in any case to build the host string */ av_url_split(proto, sizeof(proto), auth, sizeof(auth), hostname, sizeof(hostname), &port, path1, sizeof(path1), s->location); ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); if (!strcmp(proto, "https")) { lower_proto = "tls"; use_proxy = 0; if (port < 0) port = 443; } if (port < 0) port = 80; if (path1[0] == '\0') path = "/"; else path = path1; local_path = path; if (use_proxy) { /* Reassemble the request URL without auth string - we don't * want to leak the auth to the proxy. */ ff_url_join(urlbuf, sizeof(urlbuf), proto, NULL, hostname, port, "%s", path1); path = urlbuf; av_url_split(NULL, 0, proxyauth, sizeof(proxyauth), hostname, sizeof(hostname), &port, NULL, 0, proxy_path); } ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL); err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (err < 0) goto fail; s->hd = hd; cur_auth_type = s->auth_state.auth_type; cur_proxy_auth_type = s->auth_state.auth_type; if (http_connect(h, path, local_path, hoststr, auth, proxyauth, &location_changed) < 0) goto fail; if (s->http_code == 401) { if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(hd); goto redo; } else goto fail; } if (s->http_code == 407) { if (cur_proxy_auth_type == HTTP_AUTH_NONE && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(hd); goto redo; } else goto fail; } if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307) && location_changed == 1) { /* url moved, get next */ ffurl_close(hd); if (redirects++ >= MAX_REDIRECTS) return AVERROR(EIO); location_changed = 0; goto redo; } return 0; fail: if (hd) ffurl_close(hd); s->hd = NULL; return AVERROR(EIO); }
true
FFmpeg
abe20c59b93426958624e16e89b24e0c0b43f370
static int http_open_cnx(URLContext *h) { const char *path, *proxy_path, *lower_proto = "tcp", *local_path; char hostname[1024], hoststr[1024], proto[10]; char auth[1024], proxyauth[1024]; char path1[1024]; char buf[1024], urlbuf[1024]; int port, use_proxy, err, location_changed = 0, redirects = 0; HTTPAuthType cur_auth_type, cur_proxy_auth_type; HTTPContext *s = h->priv_data; URLContext *hd = NULL; proxy_path = getenv("http_proxy"); use_proxy = (proxy_path != NULL) && !getenv("no_proxy") && av_strstart(proxy_path, "http: redo: av_url_split(proto, sizeof(proto), auth, sizeof(auth), hostname, sizeof(hostname), &port, path1, sizeof(path1), s->location); ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); if (!strcmp(proto, "https")) { lower_proto = "tls"; use_proxy = 0; if (port < 0) port = 443; } if (port < 0) port = 80; if (path1[0] == '\0') path = "/"; else path = path1; local_path = path; if (use_proxy) { ff_url_join(urlbuf, sizeof(urlbuf), proto, NULL, hostname, port, "%s", path1); path = urlbuf; av_url_split(NULL, 0, proxyauth, sizeof(proxyauth), hostname, sizeof(hostname), &port, NULL, 0, proxy_path); } ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL); err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (err < 0) goto fail; s->hd = hd; cur_auth_type = s->auth_state.auth_type; cur_proxy_auth_type = s->auth_state.auth_type; if (http_connect(h, path, local_path, hoststr, auth, proxyauth, &location_changed) < 0) goto fail; if (s->http_code == 401) { if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(hd); goto redo; } else goto fail; } if (s->http_code == 407) { if (cur_proxy_auth_type == HTTP_AUTH_NONE && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(hd); goto redo; } else goto fail; } if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307) && location_changed == 1) { ffurl_close(hd); if (redirects++ >= MAX_REDIRECTS) return AVERROR(EIO); location_changed = 0; goto redo; } return 0; fail: if (hd) ffurl_close(hd); s->hd = NULL; return AVERROR(EIO); }
{ "code": [ " char auth[1024], proxyauth[1024];" ], "line_no": [ 9 ] }
static int FUNC_0(URLContext *VAR_0) { const char *VAR_1, *VAR_2, *VAR_3 = "tcp", *VAR_4; char VAR_5[1024], VAR_6[1024], VAR_7[10]; char VAR_8[1024], VAR_9[1024]; char VAR_10[1024]; char VAR_11[1024], VAR_12[1024]; int VAR_13, VAR_14, VAR_15, VAR_16 = 0, VAR_17 = 0; HTTPAuthType cur_auth_type, cur_proxy_auth_type; HTTPContext *s = VAR_0->priv_data; URLContext *hd = NULL; VAR_2 = getenv("http_proxy"); VAR_14 = (VAR_2 != NULL) && !getenv("no_proxy") && av_strstart(VAR_2, "http: redo: av_url_split(VAR_7, sizeof(VAR_7), VAR_8, sizeof(VAR_8), VAR_5, sizeof(VAR_5), &VAR_13, VAR_10, sizeof(VAR_10), s->location); ff_url_join(VAR_6, sizeof(VAR_6), NULL, NULL, VAR_5, VAR_13, NULL); if (!strcmp(VAR_7, "https")) { VAR_3 = "tls"; VAR_14 = 0; if (VAR_13 < 0) VAR_13 = 443; } if (VAR_13 < 0) VAR_13 = 80; if (VAR_10[0] == '\0') VAR_1 = "/"; else VAR_1 = VAR_10; VAR_4 = VAR_1; if (VAR_14) { ff_url_join(VAR_12, sizeof(VAR_12), VAR_7, NULL, VAR_5, VAR_13, "%s", VAR_10); VAR_1 = VAR_12; av_url_split(NULL, 0, VAR_9, sizeof(VAR_9), VAR_5, sizeof(VAR_5), &VAR_13, NULL, 0, VAR_2); } ff_url_join(VAR_11, sizeof(VAR_11), VAR_3, NULL, VAR_5, VAR_13, NULL); VAR_15 = ffurl_open(&hd, VAR_11, AVIO_FLAG_READ_WRITE, &VAR_0->interrupt_callback, NULL); if (VAR_15 < 0) goto fail; s->hd = hd; cur_auth_type = s->auth_state.auth_type; cur_proxy_auth_type = s->auth_state.auth_type; if (http_connect(VAR_0, VAR_1, VAR_4, VAR_6, VAR_8, VAR_9, &VAR_16) < 0) goto fail; if (s->http_code == 401) { if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(hd); goto redo; } else goto fail; } if (s->http_code == 407) { if (cur_proxy_auth_type == HTTP_AUTH_NONE && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(hd); goto redo; } else goto fail; } if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307) && VAR_16 == 1) { ffurl_close(hd); if (VAR_17++ >= MAX_REDIRECTS) return AVERROR(EIO); VAR_16 = 0; goto redo; } return 0; fail: if (hd) ffurl_close(hd); s->hd = NULL; return AVERROR(EIO); }
[ "static int FUNC_0(URLContext *VAR_0)\n{", "const char *VAR_1, *VAR_2, *VAR_3 = \"tcp\", *VAR_4;", "char VAR_5[1024], VAR_6[1024], VAR_7[10];", "char VAR_8[1024], VAR_9[1024];", "char VAR_10[1024];", "char VAR_11[1024], VAR_12[1024];", "int VAR_13, VAR_14, VAR_15, VAR_16 = 0, VAR_17 = 0;", "HTTPAuthType cur_auth_type, cur_proxy_auth_type;", "HTTPContext *s = VAR_0->priv_data;", "URLContext *hd = NULL;", "VAR_2 = getenv(\"http_proxy\");", "VAR_14 = (VAR_2 != NULL) && !getenv(\"no_proxy\") &&\nav_strstart(VAR_2, \"http:\nredo:\nav_url_split(VAR_7, sizeof(VAR_7), VAR_8, sizeof(VAR_8),\nVAR_5, sizeof(VAR_5), &VAR_13,\nVAR_10, sizeof(VAR_10), s->location);", "ff_url_join(VAR_6, sizeof(VAR_6), NULL, NULL, VAR_5, VAR_13, NULL);", "if (!strcmp(VAR_7, \"https\")) {", "VAR_3 = \"tls\";", "VAR_14 = 0;", "if (VAR_13 < 0)\nVAR_13 = 443;", "}", "if (VAR_13 < 0)\nVAR_13 = 80;", "if (VAR_10[0] == '\\0')\nVAR_1 = \"/\";", "else\nVAR_1 = VAR_10;", "VAR_4 = VAR_1;", "if (VAR_14) {", "ff_url_join(VAR_12, sizeof(VAR_12), VAR_7, NULL, VAR_5, VAR_13, \"%s\",\nVAR_10);", "VAR_1 = VAR_12;", "av_url_split(NULL, 0, VAR_9, sizeof(VAR_9),\nVAR_5, sizeof(VAR_5), &VAR_13, NULL, 0, VAR_2);", "}", "ff_url_join(VAR_11, sizeof(VAR_11), VAR_3, NULL, VAR_5, VAR_13, NULL);", "VAR_15 = ffurl_open(&hd, VAR_11, AVIO_FLAG_READ_WRITE,\n&VAR_0->interrupt_callback, NULL);", "if (VAR_15 < 0)\ngoto fail;", "s->hd = hd;", "cur_auth_type = s->auth_state.auth_type;", "cur_proxy_auth_type = s->auth_state.auth_type;", "if (http_connect(VAR_0, VAR_1, VAR_4, VAR_6, VAR_8, VAR_9, &VAR_16) < 0)\ngoto fail;", "if (s->http_code == 401) {", "if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) {", "ffurl_close(hd);", "goto redo;", "} else", "goto fail;", "}", "if (s->http_code == 407) {", "if (cur_proxy_auth_type == HTTP_AUTH_NONE &&\ns->proxy_auth_state.auth_type != HTTP_AUTH_NONE) {", "ffurl_close(hd);", "goto redo;", "} else", "goto fail;", "}", "if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307)\n&& VAR_16 == 1) {", "ffurl_close(hd);", "if (VAR_17++ >= MAX_REDIRECTS)\nreturn AVERROR(EIO);", "VAR_16 = 0;", "goto redo;", "}", "return 0;", "fail:\nif (hd)\nffurl_close(hd);", "s->hd = NULL;", "return AVERROR(EIO);", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 35, 39, 41, 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 67, 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171, 173 ], [ 175 ], [ 177 ], [ 179 ] ]
22,371
static void vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, uint8_t *buf, int silence) { if (s->channels == 2) { if ((s->block_align & 0x01) == 0) { if (silence) memset(data, 0, s->block_align * 2); else vmdaudio_decode_audio(s, data, buf, 1); } else { if (silence) memset(data, 0, s->block_align * 2); // else // vmdaudio_decode_audio(s, data, buf, 1); } } else { } }
true
FFmpeg
23fe14bb20888038b91e62b16d50fe0b75043a10
static void vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, uint8_t *buf, int silence) { if (s->channels == 2) { if ((s->block_align & 0x01) == 0) { if (silence) memset(data, 0, s->block_align * 2); else vmdaudio_decode_audio(s, data, buf, 1); } else { if (silence) memset(data, 0, s->block_align * 2); } } else { } }
{ "code": [ "static void vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data," ], "line_no": [ 1 ] }
static void FUNC_0(VmdAudioContext *VAR_0, unsigned char *VAR_1, uint8_t *VAR_2, int VAR_3) { if (VAR_0->channels == 2) { if ((VAR_0->block_align & 0x01) == 0) { if (VAR_3) memset(VAR_1, 0, VAR_0->block_align * 2); else vmdaudio_decode_audio(VAR_0, VAR_1, VAR_2, 1); } else { if (VAR_3) memset(VAR_1, 0, VAR_0->block_align * 2); } } else { } }
[ "static void FUNC_0(VmdAudioContext *VAR_0, unsigned char *VAR_1,\nuint8_t *VAR_2, int VAR_3)\n{", "if (VAR_0->channels == 2) {", "if ((VAR_0->block_align & 0x01) == 0) {", "if (VAR_3)\nmemset(VAR_1, 0, VAR_0->block_align * 2);", "else\nvmdaudio_decode_audio(VAR_0, VAR_1, VAR_2, 1);", "} else {", "if (VAR_3)\nmemset(VAR_1, 0, VAR_0->block_align * 2);", "}", "} else {", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
22,372
uint64_t helper_mullv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { int64_t res = (int64_t)op1 * (int64_t)op2; if (unlikely((int32_t)res != res)) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return (int64_t)((int32_t)res); }
true
qemu
4d1628e832dfc6ec02b0d196f6cc250aaa7bf3b3
uint64_t helper_mullv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { int64_t res = (int64_t)op1 * (int64_t)op2; if (unlikely((int32_t)res != res)) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return (int64_t)((int32_t)res); }
{ "code": [ " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", "uint64_t helper_mullv(CPUAlphaState *env, uint64_t op1, uint64_t op2)", " int64_t res = (int64_t)op1 * (int64_t)op2;", " if (unlikely((int32_t)res != res)) {", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return (int64_t)((int32_t)res);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);" ], "line_no": [ 11, 11, 11, 1, 5, 9, 11, 15, 11 ] }
uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2) { int64_t res = (int64_t)op1 * (int64_t)op2; if (unlikely((int32_t)res != res)) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return (int64_t)((int32_t)res); }
[ "uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2)\n{", "int64_t res = (int64_t)op1 * (int64_t)op2;", "if (unlikely((int32_t)res != res)) {", "arith_excp(env, GETPC(), EXC_M_IOV, 0);", "}", "return (int64_t)((int32_t)res);", "}" ]
[ 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
22,373
static int xwd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *p = data; const uint8_t *buf = avpkt->data; int i, ret, buf_size = avpkt->size; uint32_t version, header_size, vclass, ncolors; uint32_t xoffset, be, bpp, lsize, rsize; uint32_t pixformat, pixdepth, bunit, bitorder, bpad; uint32_t rgb[3]; uint8_t *ptr; GetByteContext gb; if (buf_size < XWD_HEADER_SIZE) return AVERROR_INVALIDDATA; bytestream2_init(&gb, buf, buf_size); header_size = bytestream2_get_be32u(&gb); version = bytestream2_get_be32u(&gb); if (version != XWD_VERSION) { av_log(avctx, AV_LOG_ERROR, "unsupported version\n"); return AVERROR_INVALIDDATA; } if (buf_size < header_size || header_size < XWD_HEADER_SIZE) { av_log(avctx, AV_LOG_ERROR, "invalid header size\n"); return AVERROR_INVALIDDATA; } pixformat = bytestream2_get_be32u(&gb); pixdepth = bytestream2_get_be32u(&gb); avctx->width = bytestream2_get_be32u(&gb); avctx->height = bytestream2_get_be32u(&gb); xoffset = bytestream2_get_be32u(&gb); be = bytestream2_get_be32u(&gb); bunit = bytestream2_get_be32u(&gb); bitorder = bytestream2_get_be32u(&gb); bpad = bytestream2_get_be32u(&gb); bpp = bytestream2_get_be32u(&gb); lsize = bytestream2_get_be32u(&gb); vclass = bytestream2_get_be32u(&gb); rgb[0] = bytestream2_get_be32u(&gb); rgb[1] = bytestream2_get_be32u(&gb); rgb[2] = bytestream2_get_be32u(&gb); bytestream2_skipu(&gb, 8); ncolors = bytestream2_get_be32u(&gb); bytestream2_skipu(&gb, header_size - (XWD_HEADER_SIZE - 20)); av_log(avctx, AV_LOG_DEBUG, "pixformat %"PRIu32", pixdepth %"PRIu32", bunit %"PRIu32", bitorder %"PRIu32", bpad %"PRIu32"\n", pixformat, pixdepth, bunit, bitorder, bpad); av_log(avctx, AV_LOG_DEBUG, "vclass %"PRIu32", ncolors %"PRIu32", bpp %"PRIu32", be %"PRIu32", lsize %"PRIu32", xoffset %"PRIu32"\n", vclass, ncolors, bpp, be, lsize, xoffset); av_log(avctx, AV_LOG_DEBUG, "red %0"PRIx32", green %0"PRIx32", blue %0"PRIx32"\n", rgb[0], rgb[1], rgb[2]); if (pixformat > XWD_Z_PIXMAP) { av_log(avctx, AV_LOG_ERROR, "invalid pixmap format\n"); return AVERROR_INVALIDDATA; } if (pixdepth == 0 || pixdepth > 32) { av_log(avctx, AV_LOG_ERROR, "invalid pixmap depth\n"); return AVERROR_INVALIDDATA; } if (xoffset) { avpriv_request_sample(avctx, "xoffset %"PRIu32"", xoffset); return AVERROR_PATCHWELCOME; } if (be > 1) { av_log(avctx, AV_LOG_ERROR, "invalid byte order\n"); return AVERROR_INVALIDDATA; } if (bitorder > 1) { av_log(avctx, AV_LOG_ERROR, "invalid bitmap bit order\n"); return AVERROR_INVALIDDATA; } if (bunit != 8 && bunit != 16 && bunit != 32) { av_log(avctx, AV_LOG_ERROR, "invalid bitmap unit\n"); return AVERROR_INVALIDDATA; } if (bpad != 8 && bpad != 16 && bpad != 32) { av_log(avctx, AV_LOG_ERROR, "invalid bitmap scan-line pad\n"); return AVERROR_INVALIDDATA; } if (bpp == 0 || bpp > 32) { av_log(avctx, AV_LOG_ERROR, "invalid bits per pixel\n"); return AVERROR_INVALIDDATA; } if (ncolors > 256) { av_log(avctx, AV_LOG_ERROR, "invalid number of entries in colormap\n"); return AVERROR_INVALIDDATA; } if ((ret = av_image_check_size(avctx->width, avctx->height, 0, NULL)) < 0) return ret; rsize = FFALIGN(avctx->width * bpp, bpad) / 8; if (lsize < rsize) { av_log(avctx, AV_LOG_ERROR, "invalid bytes per scan-line\n"); return AVERROR_INVALIDDATA; } if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + (uint64_t)avctx->height * lsize) { av_log(avctx, AV_LOG_ERROR, "input buffer too small\n"); return AVERROR_INVALIDDATA; } if (pixformat != XWD_Z_PIXMAP) { avpriv_report_missing_feature(avctx, "Pixmap format %"PRIu32, pixformat); return AVERROR_PATCHWELCOME; } avctx->pix_fmt = AV_PIX_FMT_NONE; switch (vclass) { case XWD_STATIC_GRAY: case XWD_GRAY_SCALE: if (bpp != 1 && bpp != 8) return AVERROR_INVALIDDATA; if (pixdepth == 1) { avctx->pix_fmt = AV_PIX_FMT_MONOWHITE; } else if (pixdepth == 8) { avctx->pix_fmt = AV_PIX_FMT_GRAY8; } break; case XWD_STATIC_COLOR: case XWD_PSEUDO_COLOR: if (bpp == 8) avctx->pix_fmt = AV_PIX_FMT_PAL8; break; case XWD_TRUE_COLOR: case XWD_DIRECT_COLOR: if (bpp != 16 && bpp != 24 && bpp != 32) return AVERROR_INVALIDDATA; if (bpp == 16 && pixdepth == 15) { if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F) avctx->pix_fmt = be ? AV_PIX_FMT_RGB555BE : AV_PIX_FMT_RGB555LE; else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00) avctx->pix_fmt = be ? AV_PIX_FMT_BGR555BE : AV_PIX_FMT_BGR555LE; } else if (bpp == 16 && pixdepth == 16) { if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F) avctx->pix_fmt = be ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_RGB565LE; else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800) avctx->pix_fmt = be ? AV_PIX_FMT_BGR565BE : AV_PIX_FMT_BGR565LE; } else if (bpp == 24) { if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF) avctx->pix_fmt = be ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24; else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000) avctx->pix_fmt = be ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_RGB24; } else if (bpp == 32) { if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF) avctx->pix_fmt = be ? AV_PIX_FMT_ARGB : AV_PIX_FMT_BGRA; else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000) avctx->pix_fmt = be ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA; } bytestream2_skipu(&gb, ncolors * XWD_CMAP_SIZE); break; default: av_log(avctx, AV_LOG_ERROR, "invalid visual class\n"); return AVERROR_INVALIDDATA; } if (avctx->pix_fmt == AV_PIX_FMT_NONE) { avpriv_request_sample(avctx, "Unknown file: bpp %"PRIu32", pixdepth %"PRIu32", vclass %"PRIu32"", bpp, pixdepth, vclass); return AVERROR_PATCHWELCOME; } if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->key_frame = 1; p->pict_type = AV_PICTURE_TYPE_I; if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { uint32_t *dst = (uint32_t *)p->data[1]; uint8_t red, green, blue; for (i = 0; i < ncolors; i++) { bytestream2_skipu(&gb, 4); // skip colormap entry number red = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 1); green = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 1); blue = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 3); // skip bitmask flag and padding dst[i] = red << 16 | green << 8 | blue; } } ptr = p->data[0]; for (i = 0; i < avctx->height; i++) { bytestream2_get_bufferu(&gb, ptr, rsize); bytestream2_skipu(&gb, lsize - rsize); ptr += p->linesize[0]; } *got_frame = 1; return buf_size; }
true
FFmpeg
441026fcb13ac23aa10edc312bdacb6445a0ad06
static int xwd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *p = data; const uint8_t *buf = avpkt->data; int i, ret, buf_size = avpkt->size; uint32_t version, header_size, vclass, ncolors; uint32_t xoffset, be, bpp, lsize, rsize; uint32_t pixformat, pixdepth, bunit, bitorder, bpad; uint32_t rgb[3]; uint8_t *ptr; GetByteContext gb; if (buf_size < XWD_HEADER_SIZE) return AVERROR_INVALIDDATA; bytestream2_init(&gb, buf, buf_size); header_size = bytestream2_get_be32u(&gb); version = bytestream2_get_be32u(&gb); if (version != XWD_VERSION) { av_log(avctx, AV_LOG_ERROR, "unsupported version\n"); return AVERROR_INVALIDDATA; } if (buf_size < header_size || header_size < XWD_HEADER_SIZE) { av_log(avctx, AV_LOG_ERROR, "invalid header size\n"); return AVERROR_INVALIDDATA; } pixformat = bytestream2_get_be32u(&gb); pixdepth = bytestream2_get_be32u(&gb); avctx->width = bytestream2_get_be32u(&gb); avctx->height = bytestream2_get_be32u(&gb); xoffset = bytestream2_get_be32u(&gb); be = bytestream2_get_be32u(&gb); bunit = bytestream2_get_be32u(&gb); bitorder = bytestream2_get_be32u(&gb); bpad = bytestream2_get_be32u(&gb); bpp = bytestream2_get_be32u(&gb); lsize = bytestream2_get_be32u(&gb); vclass = bytestream2_get_be32u(&gb); rgb[0] = bytestream2_get_be32u(&gb); rgb[1] = bytestream2_get_be32u(&gb); rgb[2] = bytestream2_get_be32u(&gb); bytestream2_skipu(&gb, 8); ncolors = bytestream2_get_be32u(&gb); bytestream2_skipu(&gb, header_size - (XWD_HEADER_SIZE - 20)); av_log(avctx, AV_LOG_DEBUG, "pixformat %"PRIu32", pixdepth %"PRIu32", bunit %"PRIu32", bitorder %"PRIu32", bpad %"PRIu32"\n", pixformat, pixdepth, bunit, bitorder, bpad); av_log(avctx, AV_LOG_DEBUG, "vclass %"PRIu32", ncolors %"PRIu32", bpp %"PRIu32", be %"PRIu32", lsize %"PRIu32", xoffset %"PRIu32"\n", vclass, ncolors, bpp, be, lsize, xoffset); av_log(avctx, AV_LOG_DEBUG, "red %0"PRIx32", green %0"PRIx32", blue %0"PRIx32"\n", rgb[0], rgb[1], rgb[2]); if (pixformat > XWD_Z_PIXMAP) { av_log(avctx, AV_LOG_ERROR, "invalid pixmap format\n"); return AVERROR_INVALIDDATA; } if (pixdepth == 0 || pixdepth > 32) { av_log(avctx, AV_LOG_ERROR, "invalid pixmap depth\n"); return AVERROR_INVALIDDATA; } if (xoffset) { avpriv_request_sample(avctx, "xoffset %"PRIu32"", xoffset); return AVERROR_PATCHWELCOME; } if (be > 1) { av_log(avctx, AV_LOG_ERROR, "invalid byte order\n"); return AVERROR_INVALIDDATA; } if (bitorder > 1) { av_log(avctx, AV_LOG_ERROR, "invalid bitmap bit order\n"); return AVERROR_INVALIDDATA; } if (bunit != 8 && bunit != 16 && bunit != 32) { av_log(avctx, AV_LOG_ERROR, "invalid bitmap unit\n"); return AVERROR_INVALIDDATA; } if (bpad != 8 && bpad != 16 && bpad != 32) { av_log(avctx, AV_LOG_ERROR, "invalid bitmap scan-line pad\n"); return AVERROR_INVALIDDATA; } if (bpp == 0 || bpp > 32) { av_log(avctx, AV_LOG_ERROR, "invalid bits per pixel\n"); return AVERROR_INVALIDDATA; } if (ncolors > 256) { av_log(avctx, AV_LOG_ERROR, "invalid number of entries in colormap\n"); return AVERROR_INVALIDDATA; } if ((ret = av_image_check_size(avctx->width, avctx->height, 0, NULL)) < 0) return ret; rsize = FFALIGN(avctx->width * bpp, bpad) / 8; if (lsize < rsize) { av_log(avctx, AV_LOG_ERROR, "invalid bytes per scan-line\n"); return AVERROR_INVALIDDATA; } if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + (uint64_t)avctx->height * lsize) { av_log(avctx, AV_LOG_ERROR, "input buffer too small\n"); return AVERROR_INVALIDDATA; } if (pixformat != XWD_Z_PIXMAP) { avpriv_report_missing_feature(avctx, "Pixmap format %"PRIu32, pixformat); return AVERROR_PATCHWELCOME; } avctx->pix_fmt = AV_PIX_FMT_NONE; switch (vclass) { case XWD_STATIC_GRAY: case XWD_GRAY_SCALE: if (bpp != 1 && bpp != 8) return AVERROR_INVALIDDATA; if (pixdepth == 1) { avctx->pix_fmt = AV_PIX_FMT_MONOWHITE; } else if (pixdepth == 8) { avctx->pix_fmt = AV_PIX_FMT_GRAY8; } break; case XWD_STATIC_COLOR: case XWD_PSEUDO_COLOR: if (bpp == 8) avctx->pix_fmt = AV_PIX_FMT_PAL8; break; case XWD_TRUE_COLOR: case XWD_DIRECT_COLOR: if (bpp != 16 && bpp != 24 && bpp != 32) return AVERROR_INVALIDDATA; if (bpp == 16 && pixdepth == 15) { if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F) avctx->pix_fmt = be ? AV_PIX_FMT_RGB555BE : AV_PIX_FMT_RGB555LE; else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00) avctx->pix_fmt = be ? AV_PIX_FMT_BGR555BE : AV_PIX_FMT_BGR555LE; } else if (bpp == 16 && pixdepth == 16) { if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F) avctx->pix_fmt = be ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_RGB565LE; else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800) avctx->pix_fmt = be ? AV_PIX_FMT_BGR565BE : AV_PIX_FMT_BGR565LE; } else if (bpp == 24) { if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF) avctx->pix_fmt = be ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24; else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000) avctx->pix_fmt = be ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_RGB24; } else if (bpp == 32) { if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF) avctx->pix_fmt = be ? AV_PIX_FMT_ARGB : AV_PIX_FMT_BGRA; else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000) avctx->pix_fmt = be ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA; } bytestream2_skipu(&gb, ncolors * XWD_CMAP_SIZE); break; default: av_log(avctx, AV_LOG_ERROR, "invalid visual class\n"); return AVERROR_INVALIDDATA; } if (avctx->pix_fmt == AV_PIX_FMT_NONE) { avpriv_request_sample(avctx, "Unknown file: bpp %"PRIu32", pixdepth %"PRIu32", vclass %"PRIu32"", bpp, pixdepth, vclass); return AVERROR_PATCHWELCOME; } if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->key_frame = 1; p->pict_type = AV_PICTURE_TYPE_I; if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { uint32_t *dst = (uint32_t *)p->data[1]; uint8_t red, green, blue; for (i = 0; i < ncolors; i++) { bytestream2_skipu(&gb, 4); red = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 1); green = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 1); blue = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 3); dst[i] = red << 16 | green << 8 | blue; } } ptr = p->data[0]; for (i = 0; i < avctx->height; i++) { bytestream2_get_bufferu(&gb, ptr, rsize); bytestream2_skipu(&gb, lsize - rsize); ptr += p->linesize[0]; } *got_frame = 1; return buf_size; }
{ "code": [ " if (pixdepth == 1) {", " } else if (pixdepth == 8) {" ], "line_no": [ 259, 263 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { AVFrame *p = VAR_1; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5, VAR_6, VAR_7 = VAR_3->size; uint32_t version, header_size, vclass, ncolors; uint32_t xoffset, be, bpp, lsize, rsize; uint32_t pixformat, pixdepth, bunit, bitorder, bpad; uint32_t rgb[3]; uint8_t *ptr; GetByteContext gb; if (VAR_7 < XWD_HEADER_SIZE) return AVERROR_INVALIDDATA; bytestream2_init(&gb, VAR_4, VAR_7); header_size = bytestream2_get_be32u(&gb); version = bytestream2_get_be32u(&gb); if (version != XWD_VERSION) { av_log(VAR_0, AV_LOG_ERROR, "unsupported version\n"); return AVERROR_INVALIDDATA; } if (VAR_7 < header_size || header_size < XWD_HEADER_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "invalid header size\n"); return AVERROR_INVALIDDATA; } pixformat = bytestream2_get_be32u(&gb); pixdepth = bytestream2_get_be32u(&gb); VAR_0->width = bytestream2_get_be32u(&gb); VAR_0->height = bytestream2_get_be32u(&gb); xoffset = bytestream2_get_be32u(&gb); be = bytestream2_get_be32u(&gb); bunit = bytestream2_get_be32u(&gb); bitorder = bytestream2_get_be32u(&gb); bpad = bytestream2_get_be32u(&gb); bpp = bytestream2_get_be32u(&gb); lsize = bytestream2_get_be32u(&gb); vclass = bytestream2_get_be32u(&gb); rgb[0] = bytestream2_get_be32u(&gb); rgb[1] = bytestream2_get_be32u(&gb); rgb[2] = bytestream2_get_be32u(&gb); bytestream2_skipu(&gb, 8); ncolors = bytestream2_get_be32u(&gb); bytestream2_skipu(&gb, header_size - (XWD_HEADER_SIZE - 20)); av_log(VAR_0, AV_LOG_DEBUG, "pixformat %"PRIu32", pixdepth %"PRIu32", bunit %"PRIu32", bitorder %"PRIu32", bpad %"PRIu32"\n", pixformat, pixdepth, bunit, bitorder, bpad); av_log(VAR_0, AV_LOG_DEBUG, "vclass %"PRIu32", ncolors %"PRIu32", bpp %"PRIu32", be %"PRIu32", lsize %"PRIu32", xoffset %"PRIu32"\n", vclass, ncolors, bpp, be, lsize, xoffset); av_log(VAR_0, AV_LOG_DEBUG, "red %0"PRIx32", green %0"PRIx32", blue %0"PRIx32"\n", rgb[0], rgb[1], rgb[2]); if (pixformat > XWD_Z_PIXMAP) { av_log(VAR_0, AV_LOG_ERROR, "invalid pixmap format\n"); return AVERROR_INVALIDDATA; } if (pixdepth == 0 || pixdepth > 32) { av_log(VAR_0, AV_LOG_ERROR, "invalid pixmap depth\n"); return AVERROR_INVALIDDATA; } if (xoffset) { avpriv_request_sample(VAR_0, "xoffset %"PRIu32"", xoffset); return AVERROR_PATCHWELCOME; } if (be > 1) { av_log(VAR_0, AV_LOG_ERROR, "invalid byte order\n"); return AVERROR_INVALIDDATA; } if (bitorder > 1) { av_log(VAR_0, AV_LOG_ERROR, "invalid bitmap bit order\n"); return AVERROR_INVALIDDATA; } if (bunit != 8 && bunit != 16 && bunit != 32) { av_log(VAR_0, AV_LOG_ERROR, "invalid bitmap unit\n"); return AVERROR_INVALIDDATA; } if (bpad != 8 && bpad != 16 && bpad != 32) { av_log(VAR_0, AV_LOG_ERROR, "invalid bitmap scan-line pad\n"); return AVERROR_INVALIDDATA; } if (bpp == 0 || bpp > 32) { av_log(VAR_0, AV_LOG_ERROR, "invalid bits per pixel\n"); return AVERROR_INVALIDDATA; } if (ncolors > 256) { av_log(VAR_0, AV_LOG_ERROR, "invalid number of entries in colormap\n"); return AVERROR_INVALIDDATA; } if ((VAR_6 = av_image_check_size(VAR_0->width, VAR_0->height, 0, NULL)) < 0) return VAR_6; rsize = FFALIGN(VAR_0->width * bpp, bpad) / 8; if (lsize < rsize) { av_log(VAR_0, AV_LOG_ERROR, "invalid bytes per scan-line\n"); return AVERROR_INVALIDDATA; } if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + (uint64_t)VAR_0->height * lsize) { av_log(VAR_0, AV_LOG_ERROR, "input buffer too small\n"); return AVERROR_INVALIDDATA; } if (pixformat != XWD_Z_PIXMAP) { avpriv_report_missing_feature(VAR_0, "Pixmap format %"PRIu32, pixformat); return AVERROR_PATCHWELCOME; } VAR_0->pix_fmt = AV_PIX_FMT_NONE; switch (vclass) { case XWD_STATIC_GRAY: case XWD_GRAY_SCALE: if (bpp != 1 && bpp != 8) return AVERROR_INVALIDDATA; if (pixdepth == 1) { VAR_0->pix_fmt = AV_PIX_FMT_MONOWHITE; } else if (pixdepth == 8) { VAR_0->pix_fmt = AV_PIX_FMT_GRAY8; } break; case XWD_STATIC_COLOR: case XWD_PSEUDO_COLOR: if (bpp == 8) VAR_0->pix_fmt = AV_PIX_FMT_PAL8; break; case XWD_TRUE_COLOR: case XWD_DIRECT_COLOR: if (bpp != 16 && bpp != 24 && bpp != 32) return AVERROR_INVALIDDATA; if (bpp == 16 && pixdepth == 15) { if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F) VAR_0->pix_fmt = be ? AV_PIX_FMT_RGB555BE : AV_PIX_FMT_RGB555LE; else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00) VAR_0->pix_fmt = be ? AV_PIX_FMT_BGR555BE : AV_PIX_FMT_BGR555LE; } else if (bpp == 16 && pixdepth == 16) { if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F) VAR_0->pix_fmt = be ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_RGB565LE; else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800) VAR_0->pix_fmt = be ? AV_PIX_FMT_BGR565BE : AV_PIX_FMT_BGR565LE; } else if (bpp == 24) { if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF) VAR_0->pix_fmt = be ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24; else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000) VAR_0->pix_fmt = be ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_RGB24; } else if (bpp == 32) { if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF) VAR_0->pix_fmt = be ? AV_PIX_FMT_ARGB : AV_PIX_FMT_BGRA; else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000) VAR_0->pix_fmt = be ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA; } bytestream2_skipu(&gb, ncolors * XWD_CMAP_SIZE); break; default: av_log(VAR_0, AV_LOG_ERROR, "invalid visual class\n"); return AVERROR_INVALIDDATA; } if (VAR_0->pix_fmt == AV_PIX_FMT_NONE) { avpriv_request_sample(VAR_0, "Unknown file: bpp %"PRIu32", pixdepth %"PRIu32", vclass %"PRIu32"", bpp, pixdepth, vclass); return AVERROR_PATCHWELCOME; } if ((VAR_6 = ff_get_buffer(VAR_0, p, 0)) < 0) return VAR_6; p->key_frame = 1; p->pict_type = AV_PICTURE_TYPE_I; if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) { uint32_t *dst = (uint32_t *)p->VAR_1[1]; uint8_t red, green, blue; for (VAR_5 = 0; VAR_5 < ncolors; VAR_5++) { bytestream2_skipu(&gb, 4); red = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 1); green = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 1); blue = bytestream2_get_byteu(&gb); bytestream2_skipu(&gb, 3); dst[VAR_5] = red << 16 | green << 8 | blue; } } ptr = p->VAR_1[0]; for (VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) { bytestream2_get_bufferu(&gb, ptr, rsize); bytestream2_skipu(&gb, lsize - rsize); ptr += p->linesize[0]; } *VAR_2 = 1; return VAR_7; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "AVFrame *p = VAR_1;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5, VAR_6, VAR_7 = VAR_3->size;", "uint32_t version, header_size, vclass, ncolors;", "uint32_t xoffset, be, bpp, lsize, rsize;", "uint32_t pixformat, pixdepth, bunit, bitorder, bpad;", "uint32_t rgb[3];", "uint8_t *ptr;", "GetByteContext gb;", "if (VAR_7 < XWD_HEADER_SIZE)\nreturn AVERROR_INVALIDDATA;", "bytestream2_init(&gb, VAR_4, VAR_7);", "header_size = bytestream2_get_be32u(&gb);", "version = bytestream2_get_be32u(&gb);", "if (version != XWD_VERSION) {", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported version\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_7 < header_size || header_size < XWD_HEADER_SIZE) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid header size\\n\");", "return AVERROR_INVALIDDATA;", "}", "pixformat = bytestream2_get_be32u(&gb);", "pixdepth = bytestream2_get_be32u(&gb);", "VAR_0->width = bytestream2_get_be32u(&gb);", "VAR_0->height = bytestream2_get_be32u(&gb);", "xoffset = bytestream2_get_be32u(&gb);", "be = bytestream2_get_be32u(&gb);", "bunit = bytestream2_get_be32u(&gb);", "bitorder = bytestream2_get_be32u(&gb);", "bpad = bytestream2_get_be32u(&gb);", "bpp = bytestream2_get_be32u(&gb);", "lsize = bytestream2_get_be32u(&gb);", "vclass = bytestream2_get_be32u(&gb);", "rgb[0] = bytestream2_get_be32u(&gb);", "rgb[1] = bytestream2_get_be32u(&gb);", "rgb[2] = bytestream2_get_be32u(&gb);", "bytestream2_skipu(&gb, 8);", "ncolors = bytestream2_get_be32u(&gb);", "bytestream2_skipu(&gb, header_size - (XWD_HEADER_SIZE - 20));", "av_log(VAR_0, AV_LOG_DEBUG,\n\"pixformat %\"PRIu32\", pixdepth %\"PRIu32\", bunit %\"PRIu32\", bitorder %\"PRIu32\", bpad %\"PRIu32\"\\n\",\npixformat, pixdepth, bunit, bitorder, bpad);", "av_log(VAR_0, AV_LOG_DEBUG,\n\"vclass %\"PRIu32\", ncolors %\"PRIu32\", bpp %\"PRIu32\", be %\"PRIu32\", lsize %\"PRIu32\", xoffset %\"PRIu32\"\\n\",\nvclass, ncolors, bpp, be, lsize, xoffset);", "av_log(VAR_0, AV_LOG_DEBUG,\n\"red %0\"PRIx32\", green %0\"PRIx32\", blue %0\"PRIx32\"\\n\",\nrgb[0], rgb[1], rgb[2]);", "if (pixformat > XWD_Z_PIXMAP) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid pixmap format\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (pixdepth == 0 || pixdepth > 32) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid pixmap depth\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (xoffset) {", "avpriv_request_sample(VAR_0, \"xoffset %\"PRIu32\"\", xoffset);", "return AVERROR_PATCHWELCOME;", "}", "if (be > 1) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid byte order\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (bitorder > 1) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid bitmap bit order\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (bunit != 8 && bunit != 16 && bunit != 32) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid bitmap unit\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (bpad != 8 && bpad != 16 && bpad != 32) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid bitmap scan-line pad\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (bpp == 0 || bpp > 32) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid bits per pixel\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (ncolors > 256) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid number of entries in colormap\\n\");", "return AVERROR_INVALIDDATA;", "}", "if ((VAR_6 = av_image_check_size(VAR_0->width, VAR_0->height, 0, NULL)) < 0)\nreturn VAR_6;", "rsize = FFALIGN(VAR_0->width * bpp, bpad) / 8;", "if (lsize < rsize) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid bytes per scan-line\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + (uint64_t)VAR_0->height * lsize) {", "av_log(VAR_0, AV_LOG_ERROR, \"input buffer too small\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (pixformat != XWD_Z_PIXMAP) {", "avpriv_report_missing_feature(VAR_0, \"Pixmap format %\"PRIu32, pixformat);", "return AVERROR_PATCHWELCOME;", "}", "VAR_0->pix_fmt = AV_PIX_FMT_NONE;", "switch (vclass) {", "case XWD_STATIC_GRAY:\ncase XWD_GRAY_SCALE:\nif (bpp != 1 && bpp != 8)\nreturn AVERROR_INVALIDDATA;", "if (pixdepth == 1) {", "VAR_0->pix_fmt = AV_PIX_FMT_MONOWHITE;", "} else if (pixdepth == 8) {", "VAR_0->pix_fmt = AV_PIX_FMT_GRAY8;", "}", "break;", "case XWD_STATIC_COLOR:\ncase XWD_PSEUDO_COLOR:\nif (bpp == 8)\nVAR_0->pix_fmt = AV_PIX_FMT_PAL8;", "break;", "case XWD_TRUE_COLOR:\ncase XWD_DIRECT_COLOR:\nif (bpp != 16 && bpp != 24 && bpp != 32)\nreturn AVERROR_INVALIDDATA;", "if (bpp == 16 && pixdepth == 15) {", "if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_RGB555BE : AV_PIX_FMT_RGB555LE;", "else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_BGR555BE : AV_PIX_FMT_BGR555LE;", "} else if (bpp == 16 && pixdepth == 16) {", "if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_RGB565LE;", "else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_BGR565BE : AV_PIX_FMT_BGR565LE;", "} else if (bpp == 24) {", "if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24;", "else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_RGB24;", "} else if (bpp == 32) {", "if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_ARGB : AV_PIX_FMT_BGRA;", "else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)\nVAR_0->pix_fmt = be ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA;", "}", "bytestream2_skipu(&gb, ncolors * XWD_CMAP_SIZE);", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"invalid visual class\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_0->pix_fmt == AV_PIX_FMT_NONE) {", "avpriv_request_sample(VAR_0,\n\"Unknown file: bpp %\"PRIu32\", pixdepth %\"PRIu32\", vclass %\"PRIu32\"\",\nbpp, pixdepth, vclass);", "return AVERROR_PATCHWELCOME;", "}", "if ((VAR_6 = ff_get_buffer(VAR_0, p, 0)) < 0)\nreturn VAR_6;", "p->key_frame = 1;", "p->pict_type = AV_PICTURE_TYPE_I;", "if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) {", "uint32_t *dst = (uint32_t *)p->VAR_1[1];", "uint8_t red, green, blue;", "for (VAR_5 = 0; VAR_5 < ncolors; VAR_5++) {", "bytestream2_skipu(&gb, 4);", "red = bytestream2_get_byteu(&gb);", "bytestream2_skipu(&gb, 1);", "green = bytestream2_get_byteu(&gb);", "bytestream2_skipu(&gb, 1);", "blue = bytestream2_get_byteu(&gb);", "bytestream2_skipu(&gb, 3);", "dst[VAR_5] = red << 16 | green << 8 | blue;", "}", "}", "ptr = p->VAR_1[0];", "for (VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) {", "bytestream2_get_bufferu(&gb, ptr, rsize);", "bytestream2_skipu(&gb, lsize - rsize);", "ptr += p->linesize[0];", "}", "*VAR_2 = 1;", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101, 103 ], [ 105, 107, 109 ], [ 111, 113, 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209, 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251, 253, 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273, 275, 277 ], [ 279 ], [ 281, 283, 285, 287 ], [ 289 ], [ 291, 293 ], [ 295, 297 ], [ 299 ], [ 301, 303 ], [ 305, 307 ], [ 309 ], [ 311, 313 ], [ 315, 317 ], [ 319 ], [ 321, 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347, 349, 351 ], [ 353 ], [ 355 ], [ 359, 361 ], [ 365 ], [ 367 ], [ 371 ], [ 373 ], [ 375 ], [ 379 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 399 ], [ 401 ], [ 403 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 421 ], [ 425 ], [ 427 ] ]
22,374
vmxnet3_init_msi(VMXNET3State *s) { PCIDevice *d = PCI_DEVICE(s); int res; res = msi_init(d, VMXNET3_MSI_OFFSET, VMXNET3_MSI_NUM_VECTORS, VMXNET3_USE_64BIT, VMXNET3_PER_VECTOR_MASK); if (0 > res) { VMW_WRPRN("Failed to initialize MSI, error %d", res); s->msi_used = false; } else { s->msi_used = true; } return s->msi_used; }
true
qemu
8c6c0478996e8f77374e69b6df68655b0b4ba689
vmxnet3_init_msi(VMXNET3State *s) { PCIDevice *d = PCI_DEVICE(s); int res; res = msi_init(d, VMXNET3_MSI_OFFSET, VMXNET3_MSI_NUM_VECTORS, VMXNET3_USE_64BIT, VMXNET3_PER_VECTOR_MASK); if (0 > res) { VMW_WRPRN("Failed to initialize MSI, error %d", res); s->msi_used = false; } else { s->msi_used = true; } return s->msi_used; }
{ "code": [ " res = msi_init(d, VMXNET3_MSI_OFFSET, VMXNET3_MSI_NUM_VECTORS," ], "line_no": [ 11 ] }
FUNC_0(VMXNET3State *VAR_0) { PCIDevice *d = PCI_DEVICE(VAR_0); int VAR_1; VAR_1 = msi_init(d, VMXNET3_MSI_OFFSET, VMXNET3_MSI_NUM_VECTORS, VMXNET3_USE_64BIT, VMXNET3_PER_VECTOR_MASK); if (0 > VAR_1) { VMW_WRPRN("Failed to initialize MSI, error %d", VAR_1); VAR_0->msi_used = false; } else { VAR_0->msi_used = true; } return VAR_0->msi_used; }
[ "FUNC_0(VMXNET3State *VAR_0)\n{", "PCIDevice *d = PCI_DEVICE(VAR_0);", "int VAR_1;", "VAR_1 = msi_init(d, VMXNET3_MSI_OFFSET, VMXNET3_MSI_NUM_VECTORS,\nVMXNET3_USE_64BIT, VMXNET3_PER_VECTOR_MASK);", "if (0 > VAR_1) {", "VMW_WRPRN(\"Failed to initialize MSI, error %d\", VAR_1);", "VAR_0->msi_used = false;", "} else {", "VAR_0->msi_used = true;", "}", "return VAR_0->msi_used;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
22,375
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { PicContext *s = avctx->priv_data; AVFrame *frame = data; uint32_t *palette; int bits_per_plane, bpp, etype, esize, npal, pos_after_pal; int i, x, y, plane, tmp, ret, val; bytestream2_init(&s->g, avpkt->data, avpkt->size); if (bytestream2_get_bytes_left(&s->g) < 11) return AVERROR_INVALIDDATA; if (bytestream2_get_le16u(&s->g) != 0x1234) return AVERROR_INVALIDDATA; s->width = bytestream2_get_le16u(&s->g); s->height = bytestream2_get_le16u(&s->g); bytestream2_skip(&s->g, 4); tmp = bytestream2_get_byteu(&s->g); bits_per_plane = tmp & 0xF; s->nb_planes = (tmp >> 4) + 1; bpp = bits_per_plane * s->nb_planes; if (bits_per_plane > 8 || bpp < 1 || bpp > 32) { avpriv_request_sample(avctx, "Unsupported bit depth"); return AVERROR_PATCHWELCOME; } if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) { bytestream2_skip(&s->g, 2); etype = bytestream2_get_le16(&s->g); esize = bytestream2_get_le16(&s->g); if (bytestream2_get_bytes_left(&s->g) < esize) return AVERROR_INVALIDDATA; } else { etype = -1; esize = 0; } avctx->pix_fmt = AV_PIX_FMT_PAL8; if (s->width != avctx->width && s->height != avctx->height) { if (av_image_check_size(s->width, s->height, 0, avctx) < 0) return -1; avcodec_set_dimensions(avctx, s->width, s->height); } if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; memset(frame->data[0], 0, s->height * frame->linesize[0]); frame->pict_type = AV_PICTURE_TYPE_I; frame->palette_has_changed = 1; pos_after_pal = bytestream2_tell(&s->g) + esize; palette = (uint32_t*)frame->data[1]; if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) { int idx = bytestream2_get_byte(&s->g); npal = 4; for (i = 0; i < npal; i++) palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ]; } else if (etype == 2) { npal = FFMIN(esize, 16); for (i = 0; i < npal; i++) { int pal_idx = bytestream2_get_byte(&s->g); palette[i] = ff_cga_palette[FFMIN(pal_idx, 15)]; } } else if (etype == 3) { npal = FFMIN(esize, 16); for (i = 0; i < npal; i++) { int pal_idx = bytestream2_get_byte(&s->g); palette[i] = ff_ega_palette[FFMIN(pal_idx, 63)]; } } else if (etype == 4 || etype == 5) { npal = FFMIN(esize / 3, 256); for (i = 0; i < npal; i++) { palette[i] = bytestream2_get_be24(&s->g) << 2; palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303; } } else { if (bpp == 1) { npal = 2; palette[0] = 0xFF000000; palette[1] = 0xFFFFFFFF; } else if (bpp == 2) { npal = 4; for (i = 0; i < npal; i++) palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ]; } else { npal = 16; memcpy(palette, ff_cga_palette, npal * 4); } } // fill remaining palette entries memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4); // skip remaining palette bytes bytestream2_seek(&s->g, pos_after_pal, SEEK_SET); val = 0; y = s->height - 1; if (bytestream2_get_le16(&s->g)) { x = 0; plane = 0; while (y >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) { int stop_size, marker, t1, t2; t1 = bytestream2_get_bytes_left(&s->g); t2 = bytestream2_get_le16(&s->g); stop_size = t1 - FFMIN(t1, t2); // ignore uncompressed block size bytestream2_skip(&s->g, 2); marker = bytestream2_get_byte(&s->g); while (plane < s->nb_planes && y >= 0 && bytestream2_get_bytes_left(&s->g) > stop_size) { int run = 1; val = bytestream2_get_byte(&s->g); if (val == marker) { run = bytestream2_get_byte(&s->g); if (run == 0) run = bytestream2_get_le16(&s->g); val = bytestream2_get_byte(&s->g); } if (!bytestream2_get_bytes_left(&s->g)) break; if (bits_per_plane == 8) { picmemset_8bpp(s, frame, val, run, &x, &y); if (y < 0) goto finish; } else { picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane); } } } if (x < avctx->width && y >= 0) { int run = (y + 1) * avctx->width - x; if (bits_per_plane == 8) picmemset_8bpp(s, frame, val, run, &x, &y); else picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane); } } else { while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) { memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g))); bytestream2_skip(&s->g, avctx->width); y--; } } finish: *got_frame = 1; return avpkt->size; }
true
FFmpeg
8088d6f5f11b9f9188555f4642c940ddc92271a6
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { PicContext *s = avctx->priv_data; AVFrame *frame = data; uint32_t *palette; int bits_per_plane, bpp, etype, esize, npal, pos_after_pal; int i, x, y, plane, tmp, ret, val; bytestream2_init(&s->g, avpkt->data, avpkt->size); if (bytestream2_get_bytes_left(&s->g) < 11) return AVERROR_INVALIDDATA; if (bytestream2_get_le16u(&s->g) != 0x1234) return AVERROR_INVALIDDATA; s->width = bytestream2_get_le16u(&s->g); s->height = bytestream2_get_le16u(&s->g); bytestream2_skip(&s->g, 4); tmp = bytestream2_get_byteu(&s->g); bits_per_plane = tmp & 0xF; s->nb_planes = (tmp >> 4) + 1; bpp = bits_per_plane * s->nb_planes; if (bits_per_plane > 8 || bpp < 1 || bpp > 32) { avpriv_request_sample(avctx, "Unsupported bit depth"); return AVERROR_PATCHWELCOME; } if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) { bytestream2_skip(&s->g, 2); etype = bytestream2_get_le16(&s->g); esize = bytestream2_get_le16(&s->g); if (bytestream2_get_bytes_left(&s->g) < esize) return AVERROR_INVALIDDATA; } else { etype = -1; esize = 0; } avctx->pix_fmt = AV_PIX_FMT_PAL8; if (s->width != avctx->width && s->height != avctx->height) { if (av_image_check_size(s->width, s->height, 0, avctx) < 0) return -1; avcodec_set_dimensions(avctx, s->width, s->height); } if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; memset(frame->data[0], 0, s->height * frame->linesize[0]); frame->pict_type = AV_PICTURE_TYPE_I; frame->palette_has_changed = 1; pos_after_pal = bytestream2_tell(&s->g) + esize; palette = (uint32_t*)frame->data[1]; if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) { int idx = bytestream2_get_byte(&s->g); npal = 4; for (i = 0; i < npal; i++) palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ]; } else if (etype == 2) { npal = FFMIN(esize, 16); for (i = 0; i < npal; i++) { int pal_idx = bytestream2_get_byte(&s->g); palette[i] = ff_cga_palette[FFMIN(pal_idx, 15)]; } } else if (etype == 3) { npal = FFMIN(esize, 16); for (i = 0; i < npal; i++) { int pal_idx = bytestream2_get_byte(&s->g); palette[i] = ff_ega_palette[FFMIN(pal_idx, 63)]; } } else if (etype == 4 || etype == 5) { npal = FFMIN(esize / 3, 256); for (i = 0; i < npal; i++) { palette[i] = bytestream2_get_be24(&s->g) << 2; palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303; } } else { if (bpp == 1) { npal = 2; palette[0] = 0xFF000000; palette[1] = 0xFFFFFFFF; } else if (bpp == 2) { npal = 4; for (i = 0; i < npal; i++) palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ]; } else { npal = 16; memcpy(palette, ff_cga_palette, npal * 4); } } memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4); bytestream2_seek(&s->g, pos_after_pal, SEEK_SET); val = 0; y = s->height - 1; if (bytestream2_get_le16(&s->g)) { x = 0; plane = 0; while (y >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) { int stop_size, marker, t1, t2; t1 = bytestream2_get_bytes_left(&s->g); t2 = bytestream2_get_le16(&s->g); stop_size = t1 - FFMIN(t1, t2); bytestream2_skip(&s->g, 2); marker = bytestream2_get_byte(&s->g); while (plane < s->nb_planes && y >= 0 && bytestream2_get_bytes_left(&s->g) > stop_size) { int run = 1; val = bytestream2_get_byte(&s->g); if (val == marker) { run = bytestream2_get_byte(&s->g); if (run == 0) run = bytestream2_get_le16(&s->g); val = bytestream2_get_byte(&s->g); } if (!bytestream2_get_bytes_left(&s->g)) break; if (bits_per_plane == 8) { picmemset_8bpp(s, frame, val, run, &x, &y); if (y < 0) goto finish; } else { picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane); } } } if (x < avctx->width && y >= 0) { int run = (y + 1) * avctx->width - x; if (bits_per_plane == 8) picmemset_8bpp(s, frame, val, run, &x, &y); else picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane); } } else { while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) { memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g))); bytestream2_skip(&s->g, avctx->width); y--; } } finish: *got_frame = 1; return avpkt->size; }
{ "code": [ " if (av_image_check_size(s->width, s->height, 0, avctx) < 0)", " return -1;" ], "line_no": [ 89, 91 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { PicContext *s = VAR_0->priv_data; AVFrame *frame = VAR_1; uint32_t *palette; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16; bytestream2_init(&s->g, VAR_3->VAR_1, VAR_3->size); if (bytestream2_get_bytes_left(&s->g) < 11) return AVERROR_INVALIDDATA; if (bytestream2_get_le16u(&s->g) != 0x1234) return AVERROR_INVALIDDATA; s->width = bytestream2_get_le16u(&s->g); s->height = bytestream2_get_le16u(&s->g); bytestream2_skip(&s->g, 4); VAR_14 = bytestream2_get_byteu(&s->g); VAR_4 = VAR_14 & 0xF; s->nb_planes = (VAR_14 >> 4) + 1; VAR_5 = VAR_4 * s->nb_planes; if (VAR_4 > 8 || VAR_5 < 1 || VAR_5 > 32) { avpriv_request_sample(VAR_0, "Unsupported bit depth"); return AVERROR_PATCHWELCOME; } if (bytestream2_peek_byte(&s->g) == 0xFF || VAR_5 == 1 || VAR_5 == 4 || VAR_5 == 8) { bytestream2_skip(&s->g, 2); VAR_6 = bytestream2_get_le16(&s->g); VAR_7 = bytestream2_get_le16(&s->g); if (bytestream2_get_bytes_left(&s->g) < VAR_7) return AVERROR_INVALIDDATA; } else { VAR_6 = -1; VAR_7 = 0; } VAR_0->pix_fmt = AV_PIX_FMT_PAL8; if (s->width != VAR_0->width && s->height != VAR_0->height) { if (av_image_check_size(s->width, s->height, 0, VAR_0) < 0) return -1; avcodec_set_dimensions(VAR_0, s->width, s->height); } if ((VAR_15 = ff_get_buffer(VAR_0, frame, 0)) < 0) return VAR_15; memset(frame->VAR_1[0], 0, s->height * frame->linesize[0]); frame->pict_type = AV_PICTURE_TYPE_I; frame->palette_has_changed = 1; VAR_9 = bytestream2_tell(&s->g) + VAR_7; palette = (uint32_t*)frame->VAR_1[1]; if (VAR_6 == 1 && VAR_7 > 1 && bytestream2_peek_byte(&s->g) < 6) { int VAR_17 = bytestream2_get_byte(&s->g); VAR_8 = 4; for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) palette[VAR_10] = ff_cga_palette[ cga_mode45_index[VAR_17][VAR_10] ]; } else if (VAR_6 == 2) { VAR_8 = FFMIN(VAR_7, 16); for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) { int VAR_19 = bytestream2_get_byte(&s->g); palette[VAR_10] = ff_cga_palette[FFMIN(VAR_19, 15)]; } } else if (VAR_6 == 3) { VAR_8 = FFMIN(VAR_7, 16); for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) { int VAR_19 = bytestream2_get_byte(&s->g); palette[VAR_10] = ff_ega_palette[FFMIN(VAR_19, 63)]; } } else if (VAR_6 == 4 || VAR_6 == 5) { VAR_8 = FFMIN(VAR_7 / 3, 256); for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) { palette[VAR_10] = bytestream2_get_be24(&s->g) << 2; palette[VAR_10] |= 0xFFU << 24 | palette[VAR_10] >> 6 & 0x30303; } } else { if (VAR_5 == 1) { VAR_8 = 2; palette[0] = 0xFF000000; palette[1] = 0xFFFFFFFF; } else if (VAR_5 == 2) { VAR_8 = 4; for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) palette[VAR_10] = ff_cga_palette[ cga_mode45_index[0][VAR_10] ]; } else { VAR_8 = 16; memcpy(palette, ff_cga_palette, VAR_8 * 4); } } memset(palette + VAR_8, 0, AVPALETTE_SIZE - VAR_8 * 4); bytestream2_seek(&s->g, VAR_9, SEEK_SET); VAR_16 = 0; VAR_12 = s->height - 1; if (bytestream2_get_le16(&s->g)) { VAR_11 = 0; VAR_13 = 0; while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) { int VAR_19, VAR_20, VAR_21, VAR_22; VAR_21 = bytestream2_get_bytes_left(&s->g); VAR_22 = bytestream2_get_le16(&s->g); VAR_19 = VAR_21 - FFMIN(VAR_21, VAR_22); bytestream2_skip(&s->g, 2); VAR_20 = bytestream2_get_byte(&s->g); while (VAR_13 < s->nb_planes && VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) > VAR_19) { int VAR_24 = 1; VAR_16 = bytestream2_get_byte(&s->g); if (VAR_16 == VAR_20) { VAR_24 = bytestream2_get_byte(&s->g); if (VAR_24 == 0) VAR_24 = bytestream2_get_le16(&s->g); VAR_16 = bytestream2_get_byte(&s->g); } if (!bytestream2_get_bytes_left(&s->g)) break; if (VAR_4 == 8) { picmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12); if (VAR_12 < 0) goto finish; } else { picmemset(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12, &VAR_13, VAR_4); } } } if (VAR_11 < VAR_0->width && VAR_12 >= 0) { int VAR_24 = (VAR_12 + 1) * VAR_0->width - VAR_11; if (VAR_4 == 8) picmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12); else picmemset(s, frame, VAR_16, VAR_24 / (8 / VAR_4), &VAR_11, &VAR_12, &VAR_13, VAR_4); } } else { while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) > 0) { memcpy(frame->VAR_1[0] + VAR_12 * frame->linesize[0], s->g.buffer, FFMIN(VAR_0->width, bytestream2_get_bytes_left(&s->g))); bytestream2_skip(&s->g, VAR_0->width); VAR_12--; } } finish: *VAR_2 = 1; return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "PicContext *s = VAR_0->priv_data;", "AVFrame *frame = VAR_1;", "uint32_t *palette;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16;", "bytestream2_init(&s->g, VAR_3->VAR_1, VAR_3->size);", "if (bytestream2_get_bytes_left(&s->g) < 11)\nreturn AVERROR_INVALIDDATA;", "if (bytestream2_get_le16u(&s->g) != 0x1234)\nreturn AVERROR_INVALIDDATA;", "s->width = bytestream2_get_le16u(&s->g);", "s->height = bytestream2_get_le16u(&s->g);", "bytestream2_skip(&s->g, 4);", "VAR_14 = bytestream2_get_byteu(&s->g);", "VAR_4 = VAR_14 & 0xF;", "s->nb_planes = (VAR_14 >> 4) + 1;", "VAR_5 = VAR_4 * s->nb_planes;", "if (VAR_4 > 8 || VAR_5 < 1 || VAR_5 > 32) {", "avpriv_request_sample(VAR_0, \"Unsupported bit depth\");", "return AVERROR_PATCHWELCOME;", "}", "if (bytestream2_peek_byte(&s->g) == 0xFF || VAR_5 == 1 || VAR_5 == 4 || VAR_5 == 8) {", "bytestream2_skip(&s->g, 2);", "VAR_6 = bytestream2_get_le16(&s->g);", "VAR_7 = bytestream2_get_le16(&s->g);", "if (bytestream2_get_bytes_left(&s->g) < VAR_7)\nreturn AVERROR_INVALIDDATA;", "} else {", "VAR_6 = -1;", "VAR_7 = 0;", "}", "VAR_0->pix_fmt = AV_PIX_FMT_PAL8;", "if (s->width != VAR_0->width && s->height != VAR_0->height) {", "if (av_image_check_size(s->width, s->height, 0, VAR_0) < 0)\nreturn -1;", "avcodec_set_dimensions(VAR_0, s->width, s->height);", "}", "if ((VAR_15 = ff_get_buffer(VAR_0, frame, 0)) < 0)\nreturn VAR_15;", "memset(frame->VAR_1[0], 0, s->height * frame->linesize[0]);", "frame->pict_type = AV_PICTURE_TYPE_I;", "frame->palette_has_changed = 1;", "VAR_9 = bytestream2_tell(&s->g) + VAR_7;", "palette = (uint32_t*)frame->VAR_1[1];", "if (VAR_6 == 1 && VAR_7 > 1 && bytestream2_peek_byte(&s->g) < 6) {", "int VAR_17 = bytestream2_get_byte(&s->g);", "VAR_8 = 4;", "for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++)", "palette[VAR_10] = ff_cga_palette[ cga_mode45_index[VAR_17][VAR_10] ];", "} else if (VAR_6 == 2) {", "VAR_8 = FFMIN(VAR_7, 16);", "for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) {", "int VAR_19 = bytestream2_get_byte(&s->g);", "palette[VAR_10] = ff_cga_palette[FFMIN(VAR_19, 15)];", "}", "} else if (VAR_6 == 3) {", "VAR_8 = FFMIN(VAR_7, 16);", "for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) {", "int VAR_19 = bytestream2_get_byte(&s->g);", "palette[VAR_10] = ff_ega_palette[FFMIN(VAR_19, 63)];", "}", "} else if (VAR_6 == 4 || VAR_6 == 5) {", "VAR_8 = FFMIN(VAR_7 / 3, 256);", "for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) {", "palette[VAR_10] = bytestream2_get_be24(&s->g) << 2;", "palette[VAR_10] |= 0xFFU << 24 | palette[VAR_10] >> 6 & 0x30303;", "}", "} else {", "if (VAR_5 == 1) {", "VAR_8 = 2;", "palette[0] = 0xFF000000;", "palette[1] = 0xFFFFFFFF;", "} else if (VAR_5 == 2) {", "VAR_8 = 4;", "for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++)", "palette[VAR_10] = ff_cga_palette[ cga_mode45_index[0][VAR_10] ];", "} else {", "VAR_8 = 16;", "memcpy(palette, ff_cga_palette, VAR_8 * 4);", "}", "}", "memset(palette + VAR_8, 0, AVPALETTE_SIZE - VAR_8 * 4);", "bytestream2_seek(&s->g, VAR_9, SEEK_SET);", "VAR_16 = 0;", "VAR_12 = s->height - 1;", "if (bytestream2_get_le16(&s->g)) {", "VAR_11 = 0;", "VAR_13 = 0;", "while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) {", "int VAR_19, VAR_20, VAR_21, VAR_22;", "VAR_21 = bytestream2_get_bytes_left(&s->g);", "VAR_22 = bytestream2_get_le16(&s->g);", "VAR_19 = VAR_21 - FFMIN(VAR_21, VAR_22);", "bytestream2_skip(&s->g, 2);", "VAR_20 = bytestream2_get_byte(&s->g);", "while (VAR_13 < s->nb_planes && VAR_12 >= 0 &&\nbytestream2_get_bytes_left(&s->g) > VAR_19) {", "int VAR_24 = 1;", "VAR_16 = bytestream2_get_byte(&s->g);", "if (VAR_16 == VAR_20) {", "VAR_24 = bytestream2_get_byte(&s->g);", "if (VAR_24 == 0)\nVAR_24 = bytestream2_get_le16(&s->g);", "VAR_16 = bytestream2_get_byte(&s->g);", "}", "if (!bytestream2_get_bytes_left(&s->g))\nbreak;", "if (VAR_4 == 8) {", "picmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12);", "if (VAR_12 < 0)\ngoto finish;", "} else {", "picmemset(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12, &VAR_13, VAR_4);", "}", "}", "}", "if (VAR_11 < VAR_0->width && VAR_12 >= 0) {", "int VAR_24 = (VAR_12 + 1) * VAR_0->width - VAR_11;", "if (VAR_4 == 8)\npicmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12);", "else\npicmemset(s, frame, VAR_16, VAR_24 / (8 / VAR_4), &VAR_11, &VAR_12, &VAR_13, VAR_4);", "}", "} else {", "while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {", "memcpy(frame->VAR_1[0] + VAR_12 * frame->linesize[0], s->g.buffer, FFMIN(VAR_0->width, bytestream2_get_bytes_left(&s->g)));", "bytestream2_skip(&s->g, VAR_0->width);", "VAR_12--;", "}", "}", "finish:\n*VAR_2 = 1;", "return VAR_3->size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 307 ], [ 309 ], [ 311 ] ]
22,376
static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss, bool last_stage) { int pages = -1; uint64_t bytes_xmit = 0; uint8_t *p; int ret, blen; RAMBlock *block = pss->block; ram_addr_t offset = pss->page << TARGET_PAGE_BITS; p = block->host + offset; ret = ram_control_save_page(rs->f, block->offset, offset, TARGET_PAGE_SIZE, &bytes_xmit); if (bytes_xmit) { rs->bytes_transferred += bytes_xmit; pages = 1; } if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { if (ret != RAM_SAVE_CONTROL_DELAYED) { if (bytes_xmit > 0) { rs->norm_pages++; } else if (bytes_xmit == 0) { rs->zero_pages++; } } } else { /* When starting the process of a new block, the first page of * the block should be sent out before other pages in the same * block, and all the pages in last block should have been sent * out, keeping this order is important, because the 'cont' flag * is used to avoid resending the block name. */ if (block != rs->last_sent_block) { flush_compressed_data(rs); pages = save_zero_page(rs, block, offset, p); if (pages == -1) { /* Make sure the first page is sent out before other pages */ bytes_xmit = save_page_header(rs, block, offset | RAM_SAVE_FLAG_COMPRESS_PAGE); blen = qemu_put_compression_data(rs->f, p, TARGET_PAGE_SIZE, migrate_compress_level()); if (blen > 0) { rs->bytes_transferred += bytes_xmit + blen; rs->norm_pages++; pages = 1; } else { qemu_file_set_error(rs->f, blen); error_report("compressed data failed!"); } } if (pages > 0) { ram_release_pages(block->idstr, offset, pages); } } else { pages = save_zero_page(rs, block, offset, p); if (pages == -1) { pages = compress_page_with_multi_thread(rs, block, offset); } else { ram_release_pages(block->idstr, offset, pages); } } } return pages; }
true
qemu
2bf3aa85f08186b8162b76e7e8efe5b5a44306a6
static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss, bool last_stage) { int pages = -1; uint64_t bytes_xmit = 0; uint8_t *p; int ret, blen; RAMBlock *block = pss->block; ram_addr_t offset = pss->page << TARGET_PAGE_BITS; p = block->host + offset; ret = ram_control_save_page(rs->f, block->offset, offset, TARGET_PAGE_SIZE, &bytes_xmit); if (bytes_xmit) { rs->bytes_transferred += bytes_xmit; pages = 1; } if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { if (ret != RAM_SAVE_CONTROL_DELAYED) { if (bytes_xmit > 0) { rs->norm_pages++; } else if (bytes_xmit == 0) { rs->zero_pages++; } } } else { if (block != rs->last_sent_block) { flush_compressed_data(rs); pages = save_zero_page(rs, block, offset, p); if (pages == -1) { bytes_xmit = save_page_header(rs, block, offset | RAM_SAVE_FLAG_COMPRESS_PAGE); blen = qemu_put_compression_data(rs->f, p, TARGET_PAGE_SIZE, migrate_compress_level()); if (blen > 0) { rs->bytes_transferred += bytes_xmit + blen; rs->norm_pages++; pages = 1; } else { qemu_file_set_error(rs->f, blen); error_report("compressed data failed!"); } } if (pages > 0) { ram_release_pages(block->idstr, offset, pages); } } else { pages = save_zero_page(rs, block, offset, p); if (pages == -1) { pages = compress_page_with_multi_thread(rs, block, offset); } else { ram_release_pages(block->idstr, offset, pages); } } } return pages; }
{ "code": [ " bytes_xmit = save_page_header(rs, block, offset |" ], "line_no": [ 77 ] }
static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1, bool VAR_2) { int VAR_3 = -1; uint64_t bytes_xmit = 0; uint8_t *p; int VAR_4, VAR_5; RAMBlock *block = VAR_1->block; ram_addr_t offset = VAR_1->page << TARGET_PAGE_BITS; p = block->host + offset; VAR_4 = ram_control_save_page(VAR_0->f, block->offset, offset, TARGET_PAGE_SIZE, &bytes_xmit); if (bytes_xmit) { VAR_0->bytes_transferred += bytes_xmit; VAR_3 = 1; } if (VAR_4 != RAM_SAVE_CONTROL_NOT_SUPP) { if (VAR_4 != RAM_SAVE_CONTROL_DELAYED) { if (bytes_xmit > 0) { VAR_0->norm_pages++; } else if (bytes_xmit == 0) { VAR_0->zero_pages++; } } } else { if (block != VAR_0->last_sent_block) { flush_compressed_data(VAR_0); VAR_3 = save_zero_page(VAR_0, block, offset, p); if (VAR_3 == -1) { bytes_xmit = save_page_header(VAR_0, block, offset | RAM_SAVE_FLAG_COMPRESS_PAGE); VAR_5 = qemu_put_compression_data(VAR_0->f, p, TARGET_PAGE_SIZE, migrate_compress_level()); if (VAR_5 > 0) { VAR_0->bytes_transferred += bytes_xmit + VAR_5; VAR_0->norm_pages++; VAR_3 = 1; } else { qemu_file_set_error(VAR_0->f, VAR_5); error_report("compressed data failed!"); } } if (VAR_3 > 0) { ram_release_pages(block->idstr, offset, VAR_3); } } else { VAR_3 = save_zero_page(VAR_0, block, offset, p); if (VAR_3 == -1) { VAR_3 = compress_page_with_multi_thread(VAR_0, block, offset); } else { ram_release_pages(block->idstr, offset, VAR_3); } } } return VAR_3; }
[ "static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1,\nbool VAR_2)\n{", "int VAR_3 = -1;", "uint64_t bytes_xmit = 0;", "uint8_t *p;", "int VAR_4, VAR_5;", "RAMBlock *block = VAR_1->block;", "ram_addr_t offset = VAR_1->page << TARGET_PAGE_BITS;", "p = block->host + offset;", "VAR_4 = ram_control_save_page(VAR_0->f, block->offset,\noffset, TARGET_PAGE_SIZE, &bytes_xmit);", "if (bytes_xmit) {", "VAR_0->bytes_transferred += bytes_xmit;", "VAR_3 = 1;", "}", "if (VAR_4 != RAM_SAVE_CONTROL_NOT_SUPP) {", "if (VAR_4 != RAM_SAVE_CONTROL_DELAYED) {", "if (bytes_xmit > 0) {", "VAR_0->norm_pages++;", "} else if (bytes_xmit == 0) {", "VAR_0->zero_pages++;", "}", "}", "} else {", "if (block != VAR_0->last_sent_block) {", "flush_compressed_data(VAR_0);", "VAR_3 = save_zero_page(VAR_0, block, offset, p);", "if (VAR_3 == -1) {", "bytes_xmit = save_page_header(VAR_0, block, offset |\nRAM_SAVE_FLAG_COMPRESS_PAGE);", "VAR_5 = qemu_put_compression_data(VAR_0->f, p, TARGET_PAGE_SIZE,\nmigrate_compress_level());", "if (VAR_5 > 0) {", "VAR_0->bytes_transferred += bytes_xmit + VAR_5;", "VAR_0->norm_pages++;", "VAR_3 = 1;", "} else {", "qemu_file_set_error(VAR_0->f, VAR_5);", "error_report(\"compressed data failed!\");", "}", "}", "if (VAR_3 > 0) {", "ram_release_pages(block->idstr, offset, VAR_3);", "}", "} else {", "VAR_3 = save_zero_page(VAR_0, block, offset, p);", "if (VAR_3 == -1) {", "VAR_3 = compress_page_with_multi_thread(VAR_0, block, offset);", "} else {", "ram_release_pages(block->idstr, offset, VAR_3);", "}", "}", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
22,377
static int open_self_cmdline(void *cpu_env, int fd) { int fd_orig = -1; bool word_skipped = false; fd_orig = open("/proc/self/cmdline", O_RDONLY); if (fd_orig < 0) { return fd_orig; } while (true) { ssize_t nb_read; char buf[128]; char *cp_buf = buf; nb_read = read(fd_orig, buf, sizeof(buf)); if (nb_read < 0) { fd_orig = close(fd_orig); return -1; } else if (nb_read == 0) { break; } if (!word_skipped) { /* Skip the first string, which is the path to qemu-*-static instead of the actual command. */ cp_buf = memchr(buf, 0, sizeof(buf)); if (cp_buf) { /* Null byte found, skip one string */ cp_buf++; nb_read -= cp_buf - buf; word_skipped = true; } } if (word_skipped) { if (write(fd, cp_buf, nb_read) != nb_read) { return -1; } } } return close(fd_orig); }
true
qemu
680dfde91981516942ec557ef1c27753db24cbe8
static int open_self_cmdline(void *cpu_env, int fd) { int fd_orig = -1; bool word_skipped = false; fd_orig = open("/proc/self/cmdline", O_RDONLY); if (fd_orig < 0) { return fd_orig; } while (true) { ssize_t nb_read; char buf[128]; char *cp_buf = buf; nb_read = read(fd_orig, buf, sizeof(buf)); if (nb_read < 0) { fd_orig = close(fd_orig); return -1; } else if (nb_read == 0) { break; } if (!word_skipped) { cp_buf = memchr(buf, 0, sizeof(buf)); if (cp_buf) { cp_buf++; nb_read -= cp_buf - buf; word_skipped = true; } } if (word_skipped) { if (write(fd, cp_buf, nb_read) != nb_read) { return -1; } } } return close(fd_orig); }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, int VAR_1) { int VAR_2 = -1; bool word_skipped = false; VAR_2 = open("/proc/self/cmdline", O_RDONLY); if (VAR_2 < 0) { return VAR_2; } while (true) { ssize_t nb_read; char VAR_3[128]; char *VAR_4 = VAR_3; nb_read = read(VAR_2, VAR_3, sizeof(VAR_3)); if (nb_read < 0) { VAR_2 = close(VAR_2); return -1; } else if (nb_read == 0) { break; } if (!word_skipped) { VAR_4 = memchr(VAR_3, 0, sizeof(VAR_3)); if (VAR_4) { VAR_4++; nb_read -= VAR_4 - VAR_3; word_skipped = true; } } if (word_skipped) { if (write(VAR_1, VAR_4, nb_read) != nb_read) { return -1; } } } return close(VAR_2); }
[ "static int FUNC_0(void *VAR_0, int VAR_1)\n{", "int VAR_2 = -1;", "bool word_skipped = false;", "VAR_2 = open(\"/proc/self/cmdline\", O_RDONLY);", "if (VAR_2 < 0) {", "return VAR_2;", "}", "while (true) {", "ssize_t nb_read;", "char VAR_3[128];", "char *VAR_4 = VAR_3;", "nb_read = read(VAR_2, VAR_3, sizeof(VAR_3));", "if (nb_read < 0) {", "VAR_2 = close(VAR_2);", "return -1;", "} else if (nb_read == 0) {", "break;", "}", "if (!word_skipped) {", "VAR_4 = memchr(VAR_3, 0, sizeof(VAR_3));", "if (VAR_4) {", "VAR_4++;", "nb_read -= VAR_4 - VAR_3;", "word_skipped = true;", "}", "}", "if (word_skipped) {", "if (write(VAR_1, VAR_4, nb_read) != nb_read) {", "return -1;", "}", "}", "}", "return close(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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ], [ 86 ], [ 88 ] ]
22,378
int bdrv_create(BlockDriver *drv, const char* filename, QEMUOptionParameter *options) { int ret; Coroutine *co; CreateCo cco = { .drv = drv, .filename = g_strdup(filename), .options = options, .ret = NOT_DONE, }; if (!drv->bdrv_create) { return -ENOTSUP; } if (qemu_in_coroutine()) { /* Fast-path if already in coroutine context */ bdrv_create_co_entry(&cco); } else { co = qemu_coroutine_create(bdrv_create_co_entry); qemu_coroutine_enter(co, &cco); while (cco.ret == NOT_DONE) { qemu_aio_wait(); } } ret = cco.ret; g_free(cco.filename); return ret; }
true
qemu
80168bff43760bde98388480dc7c93f94693421c
int bdrv_create(BlockDriver *drv, const char* filename, QEMUOptionParameter *options) { int ret; Coroutine *co; CreateCo cco = { .drv = drv, .filename = g_strdup(filename), .options = options, .ret = NOT_DONE, }; if (!drv->bdrv_create) { return -ENOTSUP; } if (qemu_in_coroutine()) { bdrv_create_co_entry(&cco); } else { co = qemu_coroutine_create(bdrv_create_co_entry); qemu_coroutine_enter(co, &cco); while (cco.ret == NOT_DONE) { qemu_aio_wait(); } } ret = cco.ret; g_free(cco.filename); return ret; }
{ "code": [ " return -ENOTSUP;", " g_free(cco.filename);" ], "line_no": [ 29, 59 ] }
int FUNC_0(BlockDriver *VAR_0, const char* VAR_1, QEMUOptionParameter *VAR_2) { int VAR_3; Coroutine *co; CreateCo cco = { .VAR_0 = VAR_0, .VAR_1 = g_strdup(VAR_1), .VAR_2 = VAR_2, .VAR_3 = NOT_DONE, }; if (!VAR_0->FUNC_0) { return -ENOTSUP; } if (qemu_in_coroutine()) { bdrv_create_co_entry(&cco); } else { co = qemu_coroutine_create(bdrv_create_co_entry); qemu_coroutine_enter(co, &cco); while (cco.VAR_3 == NOT_DONE) { qemu_aio_wait(); } } VAR_3 = cco.VAR_3; g_free(cco.VAR_1); return VAR_3; }
[ "int FUNC_0(BlockDriver *VAR_0, const char* VAR_1,\nQEMUOptionParameter *VAR_2)\n{", "int VAR_3;", "Coroutine *co;", "CreateCo cco = {", ".VAR_0 = VAR_0,\n.VAR_1 = g_strdup(VAR_1),\n.VAR_2 = VAR_2,\n.VAR_3 = NOT_DONE,\n};", "if (!VAR_0->FUNC_0) {", "return -ENOTSUP;", "}", "if (qemu_in_coroutine()) {", "bdrv_create_co_entry(&cco);", "} else {", "co = qemu_coroutine_create(bdrv_create_co_entry);", "qemu_coroutine_enter(co, &cco);", "while (cco.VAR_3 == NOT_DONE) {", "qemu_aio_wait();", "}", "}", "VAR_3 = cco.VAR_3;", "g_free(cco.VAR_1);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17, 19, 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
22,380
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *cur_buf) { AlphaExtractContext *extract = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterBufferRef *out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); int ret; if (!out_buf) { ret = AVERROR(ENOMEM); goto end; } avfilter_copy_buffer_ref_props(out_buf, cur_buf); if (extract->is_packed_rgb) { int x, y; uint8_t *pin, *pout; for (y = 0; y < out_buf->video->h; y++) { pin = cur_buf->data[0] + y * cur_buf->linesize[0] + extract->rgba_map[A]; pout = out_buf->data[0] + y * out_buf->linesize[0]; for (x = 0; x < out_buf->video->w; x++) { *pout = *pin; pout += 1; pin += 4; } } } else { const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]); int y; for (y = 0; y < out_buf->video->h; y++) { memcpy(out_buf->data[Y] + y * out_buf->linesize[Y], cur_buf->data[A] + y * cur_buf->linesize[A], linesize); } } ret = ff_filter_frame(outlink, out_buf); end: avfilter_unref_buffer(cur_buf); return ret; }
true
FFmpeg
130c6497d2e511d1363cb51ddf68dc9cc2c2f987
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *cur_buf) { AlphaExtractContext *extract = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterBufferRef *out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); int ret; if (!out_buf) { ret = AVERROR(ENOMEM); goto end; } avfilter_copy_buffer_ref_props(out_buf, cur_buf); if (extract->is_packed_rgb) { int x, y; uint8_t *pin, *pout; for (y = 0; y < out_buf->video->h; y++) { pin = cur_buf->data[0] + y * cur_buf->linesize[0] + extract->rgba_map[A]; pout = out_buf->data[0] + y * out_buf->linesize[0]; for (x = 0; x < out_buf->video->w; x++) { *pout = *pin; pout += 1; pin += 4; } } } else { const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]); int y; for (y = 0; y < out_buf->video->h; y++) { memcpy(out_buf->data[Y] + y * out_buf->linesize[Y], cur_buf->data[A] + y * cur_buf->linesize[A], linesize); } } ret = ff_filter_frame(outlink, out_buf); end: avfilter_unref_buffer(cur_buf); return ret; }
{ "code": [ " const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]);" ], "line_no": [ 55 ] }
static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1) { AlphaExtractContext *extract = VAR_0->dst->priv; AVFilterLink *outlink = VAR_0->dst->outputs[0]; AVFilterBufferRef *out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); int VAR_2; if (!out_buf) { VAR_2 = AVERROR(ENOMEM); goto end; } avfilter_copy_buffer_ref_props(out_buf, VAR_1); if (extract->is_packed_rgb) { int VAR_3, VAR_6; uint8_t *pin, *pout; for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) { pin = VAR_1->data[0] + VAR_6 * VAR_1->VAR_5[0] + extract->rgba_map[A]; pout = out_buf->data[0] + VAR_6 * out_buf->VAR_5[0]; for (VAR_3 = 0; VAR_3 < out_buf->video->w; VAR_3++) { *pout = *pin; pout += 1; pin += 4; } } } else { const int VAR_5 = FFMIN(out_buf->VAR_5[Y], VAR_1->VAR_5[A]); int VAR_6; for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) { memcpy(out_buf->data[Y] + VAR_6 * out_buf->VAR_5[Y], VAR_1->data[A] + VAR_6 * VAR_1->VAR_5[A], VAR_5); } } VAR_2 = ff_filter_frame(outlink, out_buf); end: avfilter_unref_buffer(VAR_1); return VAR_2; }
[ "static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)\n{", "AlphaExtractContext *extract = VAR_0->dst->priv;", "AVFilterLink *outlink = VAR_0->dst->outputs[0];", "AVFilterBufferRef *out_buf =\nff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);", "int VAR_2;", "if (!out_buf) {", "VAR_2 = AVERROR(ENOMEM);", "goto end;", "}", "avfilter_copy_buffer_ref_props(out_buf, VAR_1);", "if (extract->is_packed_rgb) {", "int VAR_3, VAR_6;", "uint8_t *pin, *pout;", "for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) {", "pin = VAR_1->data[0] + VAR_6 * VAR_1->VAR_5[0] + extract->rgba_map[A];", "pout = out_buf->data[0] + VAR_6 * out_buf->VAR_5[0];", "for (VAR_3 = 0; VAR_3 < out_buf->video->w; VAR_3++) {", "*pout = *pin;", "pout += 1;", "pin += 4;", "}", "}", "} else {", "const int VAR_5 = FFMIN(out_buf->VAR_5[Y], VAR_1->VAR_5[A]);", "int VAR_6;", "for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) {", "memcpy(out_buf->data[Y] + VAR_6 * out_buf->VAR_5[Y],\nVAR_1->data[A] + VAR_6 * VAR_1->VAR_5[A],\nVAR_5);", "}", "}", "VAR_2 = ff_filter_frame(outlink, out_buf);", "end:\navfilter_unref_buffer(VAR_1);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ] ]
22,382
static av_cold int alac_decode_init(AVCodecContext * avctx) { ALACContext *alac = avctx->priv_data; alac->avctx = avctx; alac->context_initialized = 0; alac->numchannels = alac->avctx->channels; return 0; }
true
FFmpeg
313b52fbfff47ed934cdeccaebda9b3406466575
static av_cold int alac_decode_init(AVCodecContext * avctx) { ALACContext *alac = avctx->priv_data; alac->avctx = avctx; alac->context_initialized = 0; alac->numchannels = alac->avctx->channels; return 0; }
{ "code": [ " alac->context_initialized = 0;" ], "line_no": [ 9 ] }
static av_cold int FUNC_0(AVCodecContext * avctx) { ALACContext *alac = avctx->priv_data; alac->avctx = avctx; alac->context_initialized = 0; alac->numchannels = alac->avctx->channels; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext * avctx)\n{", "ALACContext *alac = avctx->priv_data;", "alac->avctx = avctx;", "alac->context_initialized = 0;", "alac->numchannels = alac->avctx->channels;", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ] ]
22,383
static always_inline void gen_405_mulladd_insn (DisasContext *ctx, int opc2, int opc3, int ra, int rb, int rt, int Rc) { gen_op_load_gpr_T0(ra); gen_op_load_gpr_T1(rb); switch (opc3 & 0x0D) { case 0x05: /* macchw - macchw. - macchwo - macchwo. */ /* macchws - macchws. - macchwso - macchwso. */ /* nmacchw - nmacchw. - nmacchwo - nmacchwo. */ /* nmacchws - nmacchws. - nmacchwso - nmacchwso. */ /* mulchw - mulchw. */ gen_op_405_mulchw(); break; case 0x04: /* macchwu - macchwu. - macchwuo - macchwuo. */ /* macchwsu - macchwsu. - macchwsuo - macchwsuo. */ /* mulchwu - mulchwu. */ gen_op_405_mulchwu(); break; case 0x01: /* machhw - machhw. - machhwo - machhwo. */ /* machhws - machhws. - machhwso - machhwso. */ /* nmachhw - nmachhw. - nmachhwo - nmachhwo. */ /* nmachhws - nmachhws. - nmachhwso - nmachhwso. */ /* mulhhw - mulhhw. */ gen_op_405_mulhhw(); break; case 0x00: /* machhwu - machhwu. - machhwuo - machhwuo. */ /* machhwsu - machhwsu. - machhwsuo - machhwsuo. */ /* mulhhwu - mulhhwu. */ gen_op_405_mulhhwu(); break; case 0x0D: /* maclhw - maclhw. - maclhwo - maclhwo. */ /* maclhws - maclhws. - maclhwso - maclhwso. */ /* nmaclhw - nmaclhw. - nmaclhwo - nmaclhwo. */ /* nmaclhws - nmaclhws. - nmaclhwso - nmaclhwso. */ /* mullhw - mullhw. */ gen_op_405_mullhw(); break; case 0x0C: /* maclhwu - maclhwu. - maclhwuo - maclhwuo. */ /* maclhwsu - maclhwsu. - maclhwsuo - maclhwsuo. */ /* mullhwu - mullhwu. */ gen_op_405_mullhwu(); break; } if (opc2 & 0x02) { /* nmultiply-and-accumulate (0x0E) */ gen_op_neg(); } if (opc2 & 0x04) { /* (n)multiply-and-accumulate (0x0C - 0x0E) */ gen_op_load_gpr_T2(rt); gen_op_move_T1_T0(); gen_op_405_add_T0_T2(); } if (opc3 & 0x10) { /* Check overflow */ if (opc3 & 0x01) gen_op_405_check_ov(); else gen_op_405_check_ovu(); } if (opc3 & 0x02) { /* Saturate */ if (opc3 & 0x01) gen_op_405_check_sat(); else gen_op_405_check_satu(); } gen_op_store_T0_gpr(rt); if (unlikely(Rc) != 0) { /* Update Rc0 */ gen_set_Rc0(ctx); } }
true
qemu
c3e10c7b4377c1cbc0a4fbc12312c2cf41c0cda7
static always_inline void gen_405_mulladd_insn (DisasContext *ctx, int opc2, int opc3, int ra, int rb, int rt, int Rc) { gen_op_load_gpr_T0(ra); gen_op_load_gpr_T1(rb); switch (opc3 & 0x0D) { case 0x05: gen_op_405_mulchw(); break; case 0x04: gen_op_405_mulchwu(); break; case 0x01: gen_op_405_mulhhw(); break; case 0x00: gen_op_405_mulhhwu(); break; case 0x0D: gen_op_405_mullhw(); break; case 0x0C: gen_op_405_mullhwu(); break; } if (opc2 & 0x02) { gen_op_neg(); } if (opc2 & 0x04) { gen_op_load_gpr_T2(rt); gen_op_move_T1_T0(); gen_op_405_add_T0_T2(); } if (opc3 & 0x10) { if (opc3 & 0x01) gen_op_405_check_ov(); else gen_op_405_check_ovu(); } if (opc3 & 0x02) { if (opc3 & 0x01) gen_op_405_check_sat(); else gen_op_405_check_satu(); } gen_op_store_T0_gpr(rt); if (unlikely(Rc) != 0) { gen_set_Rc0(ctx); } }
{ "code": [ " gen_op_405_check_ov();" ], "line_no": [ 127 ] }
static always_inline void FUNC_0 (DisasContext *ctx, int opc2, int opc3, int ra, int rb, int rt, int Rc) { gen_op_load_gpr_T0(ra); gen_op_load_gpr_T1(rb); switch (opc3 & 0x0D) { case 0x05: gen_op_405_mulchw(); break; case 0x04: gen_op_405_mulchwu(); break; case 0x01: gen_op_405_mulhhw(); break; case 0x00: gen_op_405_mulhhwu(); break; case 0x0D: gen_op_405_mullhw(); break; case 0x0C: gen_op_405_mullhwu(); break; } if (opc2 & 0x02) { gen_op_neg(); } if (opc2 & 0x04) { gen_op_load_gpr_T2(rt); gen_op_move_T1_T0(); gen_op_405_add_T0_T2(); } if (opc3 & 0x10) { if (opc3 & 0x01) gen_op_405_check_ov(); else gen_op_405_check_ovu(); } if (opc3 & 0x02) { if (opc3 & 0x01) gen_op_405_check_sat(); else gen_op_405_check_satu(); } gen_op_store_T0_gpr(rt); if (unlikely(Rc) != 0) { gen_set_Rc0(ctx); } }
[ "static always_inline void FUNC_0 (DisasContext *ctx,\nint opc2, int opc3,\nint ra, int rb, int rt, int Rc)\n{", "gen_op_load_gpr_T0(ra);", "gen_op_load_gpr_T1(rb);", "switch (opc3 & 0x0D) {", "case 0x05:\ngen_op_405_mulchw();", "break;", "case 0x04:\ngen_op_405_mulchwu();", "break;", "case 0x01:\ngen_op_405_mulhhw();", "break;", "case 0x00:\ngen_op_405_mulhhwu();", "break;", "case 0x0D:\ngen_op_405_mullhw();", "break;", "case 0x0C:\ngen_op_405_mullhwu();", "break;", "}", "if (opc2 & 0x02) {", "gen_op_neg();", "}", "if (opc2 & 0x04) {", "gen_op_load_gpr_T2(rt);", "gen_op_move_T1_T0();", "gen_op_405_add_T0_T2();", "}", "if (opc3 & 0x10) {", "if (opc3 & 0x01)\ngen_op_405_check_ov();", "else\ngen_op_405_check_ovu();", "}", "if (opc3 & 0x02) {", "if (opc3 & 0x01)\ngen_op_405_check_sat();", "else\ngen_op_405_check_satu();", "}", "gen_op_store_T0_gpr(rt);", "if (unlikely(Rc) != 0) {", "gen_set_Rc0(ctx);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 27 ], [ 29 ], [ 31, 39 ], [ 41 ], [ 43, 55 ], [ 57 ], [ 59, 67 ], [ 69 ], [ 71, 83 ], [ 85 ], [ 87, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ] ]
22,384
uint64_t helper_subqv (uint64_t op1, uint64_t op2) { uint64_t res; res = op1 - op2; if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return res; }
true
qemu
2958620f67dcfd11476e62b4ca704dae0b978ea3
uint64_t helper_subqv (uint64_t op1, uint64_t op2) { uint64_t res; res = op1 - op2; if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return res; }
{ "code": [ " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", "uint64_t helper_subqv (uint64_t op1, uint64_t op2)", " uint64_t res;", " res = op1 - op2;", " if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) {", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return res;", " res = op1 - op2;", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return res;", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);" ], "line_no": [ 11, 11, 1, 5, 7, 9, 11, 15, 7, 11, 15, 11, 11 ] }
uint64_t FUNC_0 (uint64_t op1, uint64_t op2) { uint64_t res; res = op1 - op2; if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return res; }
[ "uint64_t FUNC_0 (uint64_t op1, uint64_t op2)\n{", "uint64_t res;", "res = op1 - op2;", "if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) {", "arith_excp(env, GETPC(), EXC_M_IOV, 0);", "}", "return res;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
22,385
static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip, int chunk_id, int size, const uint8_t *data) { const uint8_t *eod = (data + size); uint32_t flag, mask; uint8_t *cb0, *cb1, *cb2, *cb3; unsigned int x, y; char *ip0, *ip1, *ip2, *ip3; flag = 0; mask = 0; for (y=strip->y1; y < strip->y2; y+=4) { /* take care of y dimension not being multiple of 4, such streams exist */ ip0 = ip1 = ip2 = ip3 = s->frame->data[0] + (s->palette_video?strip->x1:strip->x1*3) + (y * s->frame->linesize[0]); if(s->avctx->height - y > 1) { ip1 = ip0 + s->frame->linesize[0]; if(s->avctx->height - y > 2) { ip2 = ip1 + s->frame->linesize[0]; if(s->avctx->height - y > 3) { ip3 = ip2 + s->frame->linesize[0]; } } } /* to get the correct picture for not-multiple-of-4 cases let us fill * each block from the bottom up, thus possibly overwriting the top line * more than once but ending with the correct data in place * (instead of in-loop checking) */ for (x=strip->x1; x < strip->x2; x+=4) { if ((chunk_id & 0x01) && !(mask >>= 1)) { if ((data + 4) > eod) return AVERROR_INVALIDDATA; flag = AV_RB32 (data); data += 4; mask = 0x80000000; } if (!(chunk_id & 0x01) || (flag & mask)) { if (!(chunk_id & 0x02) && !(mask >>= 1)) { if ((data + 4) > eod) return AVERROR_INVALIDDATA; flag = AV_RB32 (data); data += 4; mask = 0x80000000; } if ((chunk_id & 0x02) || (~flag & mask)) { uint8_t *p; if (data >= eod) return AVERROR_INVALIDDATA; p = strip->v1_codebook[*data++]; if (s->palette_video) { ip3[0] = ip3[1] = ip2[0] = ip2[1] = p[6]; ip3[2] = ip3[3] = ip2[2] = ip2[3] = p[9]; ip1[0] = ip1[1] = ip0[0] = ip0[1] = p[0]; ip1[2] = ip1[3] = ip0[2] = ip0[3] = p[3]; } else { p += 6; memcpy(ip3 + 0, p, 3); memcpy(ip3 + 3, p, 3); memcpy(ip2 + 0, p, 3); memcpy(ip2 + 3, p, 3); p += 3; /* ... + 9 */ memcpy(ip3 + 6, p, 3); memcpy(ip3 + 9, p, 3); memcpy(ip2 + 6, p, 3); memcpy(ip2 + 9, p, 3); p -= 9; /* ... + 0 */ memcpy(ip1 + 0, p, 3); memcpy(ip1 + 3, p, 3); memcpy(ip0 + 0, p, 3); memcpy(ip0 + 3, p, 3); p += 3; /* ... + 3 */ memcpy(ip1 + 6, p, 3); memcpy(ip1 + 9, p, 3); memcpy(ip0 + 6, p, 3); memcpy(ip0 + 9, p, 3); } } else if (flag & mask) { if ((data + 4) > eod) return AVERROR_INVALIDDATA; cb0 = strip->v4_codebook[*data++]; cb1 = strip->v4_codebook[*data++]; cb2 = strip->v4_codebook[*data++]; cb3 = strip->v4_codebook[*data++]; if (s->palette_video) { uint8_t *p; p = ip3; *p++ = cb2[6]; *p++ = cb2[9]; *p++ = cb3[6]; *p = cb3[9]; p = ip2; *p++ = cb2[0]; *p++ = cb2[3]; *p++ = cb3[0]; *p = cb3[3]; p = ip1; *p++ = cb0[6]; *p++ = cb0[9]; *p++ = cb1[6]; *p = cb1[9]; p = ip0; *p++ = cb0[0]; *p++ = cb0[3]; *p++ = cb1[0]; *p = cb1[3]; } else { memcpy(ip3 + 0, cb2 + 6, 6); memcpy(ip3 + 6, cb3 + 6, 6); memcpy(ip2 + 0, cb2 + 0, 6); memcpy(ip2 + 6, cb3 + 0, 6); memcpy(ip1 + 0, cb0 + 6, 6); memcpy(ip1 + 6, cb1 + 6, 6); memcpy(ip0 + 0, cb0 + 0, 6); memcpy(ip0 + 6, cb1 + 0, 6); } } } if (s->palette_video) { ip0 += 4; ip1 += 4; ip2 += 4; ip3 += 4; } else { ip0 += 12; ip1 += 12; ip2 += 12; ip3 += 12; } } } return 0; }
true
FFmpeg
e7e5114c506957f40aafd794e06de1a7e341e9d5
static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip, int chunk_id, int size, const uint8_t *data) { const uint8_t *eod = (data + size); uint32_t flag, mask; uint8_t *cb0, *cb1, *cb2, *cb3; unsigned int x, y; char *ip0, *ip1, *ip2, *ip3; flag = 0; mask = 0; for (y=strip->y1; y < strip->y2; y+=4) { ip0 = ip1 = ip2 = ip3 = s->frame->data[0] + (s->palette_video?strip->x1:strip->x1*3) + (y * s->frame->linesize[0]); if(s->avctx->height - y > 1) { ip1 = ip0 + s->frame->linesize[0]; if(s->avctx->height - y > 2) { ip2 = ip1 + s->frame->linesize[0]; if(s->avctx->height - y > 3) { ip3 = ip2 + s->frame->linesize[0]; } } } for (x=strip->x1; x < strip->x2; x+=4) { if ((chunk_id & 0x01) && !(mask >>= 1)) { if ((data + 4) > eod) return AVERROR_INVALIDDATA; flag = AV_RB32 (data); data += 4; mask = 0x80000000; } if (!(chunk_id & 0x01) || (flag & mask)) { if (!(chunk_id & 0x02) && !(mask >>= 1)) { if ((data + 4) > eod) return AVERROR_INVALIDDATA; flag = AV_RB32 (data); data += 4; mask = 0x80000000; } if ((chunk_id & 0x02) || (~flag & mask)) { uint8_t *p; if (data >= eod) return AVERROR_INVALIDDATA; p = strip->v1_codebook[*data++]; if (s->palette_video) { ip3[0] = ip3[1] = ip2[0] = ip2[1] = p[6]; ip3[2] = ip3[3] = ip2[2] = ip2[3] = p[9]; ip1[0] = ip1[1] = ip0[0] = ip0[1] = p[0]; ip1[2] = ip1[3] = ip0[2] = ip0[3] = p[3]; } else { p += 6; memcpy(ip3 + 0, p, 3); memcpy(ip3 + 3, p, 3); memcpy(ip2 + 0, p, 3); memcpy(ip2 + 3, p, 3); p += 3; memcpy(ip3 + 6, p, 3); memcpy(ip3 + 9, p, 3); memcpy(ip2 + 6, p, 3); memcpy(ip2 + 9, p, 3); p -= 9; memcpy(ip1 + 0, p, 3); memcpy(ip1 + 3, p, 3); memcpy(ip0 + 0, p, 3); memcpy(ip0 + 3, p, 3); p += 3; memcpy(ip1 + 6, p, 3); memcpy(ip1 + 9, p, 3); memcpy(ip0 + 6, p, 3); memcpy(ip0 + 9, p, 3); } } else if (flag & mask) { if ((data + 4) > eod) return AVERROR_INVALIDDATA; cb0 = strip->v4_codebook[*data++]; cb1 = strip->v4_codebook[*data++]; cb2 = strip->v4_codebook[*data++]; cb3 = strip->v4_codebook[*data++]; if (s->palette_video) { uint8_t *p; p = ip3; *p++ = cb2[6]; *p++ = cb2[9]; *p++ = cb3[6]; *p = cb3[9]; p = ip2; *p++ = cb2[0]; *p++ = cb2[3]; *p++ = cb3[0]; *p = cb3[3]; p = ip1; *p++ = cb0[6]; *p++ = cb0[9]; *p++ = cb1[6]; *p = cb1[9]; p = ip0; *p++ = cb0[0]; *p++ = cb0[3]; *p++ = cb1[0]; *p = cb1[3]; } else { memcpy(ip3 + 0, cb2 + 6, 6); memcpy(ip3 + 6, cb3 + 6, 6); memcpy(ip2 + 0, cb2 + 0, 6); memcpy(ip2 + 6, cb3 + 0, 6); memcpy(ip1 + 0, cb0 + 6, 6); memcpy(ip1 + 6, cb1 + 6, 6); memcpy(ip0 + 0, cb0 + 0, 6); memcpy(ip0 + 6, cb1 + 0, 6); } } } if (s->palette_video) { ip0 += 4; ip1 += 4; ip2 += 4; ip3 += 4; } else { ip0 += 12; ip1 += 12; ip2 += 12; ip3 += 12; } } } return 0; }
{ "code": [ " unsigned int x, y;" ], "line_no": [ 13 ] }
static int FUNC_0 (CinepakContext *VAR_0, cvid_strip *VAR_1, int VAR_2, int VAR_3, const uint8_t *VAR_4) { const uint8_t *VAR_5 = (VAR_4 + VAR_3); uint32_t flag, mask; uint8_t *cb0, *cb1, *cb2, *cb3; unsigned int VAR_6, VAR_7; char *VAR_8, *VAR_9, *VAR_10, *VAR_11; flag = 0; mask = 0; for (VAR_7=VAR_1->y1; VAR_7 < VAR_1->y2; VAR_7+=4) { VAR_8 = VAR_9 = VAR_10 = VAR_11 = VAR_0->frame->VAR_4[0] + (VAR_0->palette_video?VAR_1->x1:VAR_1->x1*3) + (VAR_7 * VAR_0->frame->linesize[0]); if(VAR_0->avctx->height - VAR_7 > 1) { VAR_9 = VAR_8 + VAR_0->frame->linesize[0]; if(VAR_0->avctx->height - VAR_7 > 2) { VAR_10 = VAR_9 + VAR_0->frame->linesize[0]; if(VAR_0->avctx->height - VAR_7 > 3) { VAR_11 = VAR_10 + VAR_0->frame->linesize[0]; } } } for (VAR_6=VAR_1->x1; VAR_6 < VAR_1->x2; VAR_6+=4) { if ((VAR_2 & 0x01) && !(mask >>= 1)) { if ((VAR_4 + 4) > VAR_5) return AVERROR_INVALIDDATA; flag = AV_RB32 (VAR_4); VAR_4 += 4; mask = 0x80000000; } if (!(VAR_2 & 0x01) || (flag & mask)) { if (!(VAR_2 & 0x02) && !(mask >>= 1)) { if ((VAR_4 + 4) > VAR_5) return AVERROR_INVALIDDATA; flag = AV_RB32 (VAR_4); VAR_4 += 4; mask = 0x80000000; } if ((VAR_2 & 0x02) || (~flag & mask)) { uint8_t *p; if (VAR_4 >= VAR_5) return AVERROR_INVALIDDATA; p = VAR_1->v1_codebook[*VAR_4++]; if (VAR_0->palette_video) { VAR_11[0] = VAR_11[1] = VAR_10[0] = VAR_10[1] = p[6]; VAR_11[2] = VAR_11[3] = VAR_10[2] = VAR_10[3] = p[9]; VAR_9[0] = VAR_9[1] = VAR_8[0] = VAR_8[1] = p[0]; VAR_9[2] = VAR_9[3] = VAR_8[2] = VAR_8[3] = p[3]; } else { p += 6; memcpy(VAR_11 + 0, p, 3); memcpy(VAR_11 + 3, p, 3); memcpy(VAR_10 + 0, p, 3); memcpy(VAR_10 + 3, p, 3); p += 3; memcpy(VAR_11 + 6, p, 3); memcpy(VAR_11 + 9, p, 3); memcpy(VAR_10 + 6, p, 3); memcpy(VAR_10 + 9, p, 3); p -= 9; memcpy(VAR_9 + 0, p, 3); memcpy(VAR_9 + 3, p, 3); memcpy(VAR_8 + 0, p, 3); memcpy(VAR_8 + 3, p, 3); p += 3; memcpy(VAR_9 + 6, p, 3); memcpy(VAR_9 + 9, p, 3); memcpy(VAR_8 + 6, p, 3); memcpy(VAR_8 + 9, p, 3); } } else if (flag & mask) { if ((VAR_4 + 4) > VAR_5) return AVERROR_INVALIDDATA; cb0 = VAR_1->v4_codebook[*VAR_4++]; cb1 = VAR_1->v4_codebook[*VAR_4++]; cb2 = VAR_1->v4_codebook[*VAR_4++]; cb3 = VAR_1->v4_codebook[*VAR_4++]; if (VAR_0->palette_video) { uint8_t *p; p = VAR_11; *p++ = cb2[6]; *p++ = cb2[9]; *p++ = cb3[6]; *p = cb3[9]; p = VAR_10; *p++ = cb2[0]; *p++ = cb2[3]; *p++ = cb3[0]; *p = cb3[3]; p = VAR_9; *p++ = cb0[6]; *p++ = cb0[9]; *p++ = cb1[6]; *p = cb1[9]; p = VAR_8; *p++ = cb0[0]; *p++ = cb0[3]; *p++ = cb1[0]; *p = cb1[3]; } else { memcpy(VAR_11 + 0, cb2 + 6, 6); memcpy(VAR_11 + 6, cb3 + 6, 6); memcpy(VAR_10 + 0, cb2 + 0, 6); memcpy(VAR_10 + 6, cb3 + 0, 6); memcpy(VAR_9 + 0, cb0 + 6, 6); memcpy(VAR_9 + 6, cb1 + 6, 6); memcpy(VAR_8 + 0, cb0 + 0, 6); memcpy(VAR_8 + 6, cb1 + 0, 6); } } } if (VAR_0->palette_video) { VAR_8 += 4; VAR_9 += 4; VAR_10 += 4; VAR_11 += 4; } else { VAR_8 += 12; VAR_9 += 12; VAR_10 += 12; VAR_11 += 12; } } } return 0; }
[ "static int FUNC_0 (CinepakContext *VAR_0, cvid_strip *VAR_1,\nint VAR_2, int VAR_3, const uint8_t *VAR_4)\n{", "const uint8_t *VAR_5 = (VAR_4 + VAR_3);", "uint32_t flag, mask;", "uint8_t *cb0, *cb1, *cb2, *cb3;", "unsigned int VAR_6, VAR_7;", "char *VAR_8, *VAR_9, *VAR_10, *VAR_11;", "flag = 0;", "mask = 0;", "for (VAR_7=VAR_1->y1; VAR_7 < VAR_1->y2; VAR_7+=4) {", "VAR_8 = VAR_9 = VAR_10 = VAR_11 = VAR_0->frame->VAR_4[0] +\n(VAR_0->palette_video?VAR_1->x1:VAR_1->x1*3) + (VAR_7 * VAR_0->frame->linesize[0]);", "if(VAR_0->avctx->height - VAR_7 > 1) {", "VAR_9 = VAR_8 + VAR_0->frame->linesize[0];", "if(VAR_0->avctx->height - VAR_7 > 2) {", "VAR_10 = VAR_9 + VAR_0->frame->linesize[0];", "if(VAR_0->avctx->height - VAR_7 > 3) {", "VAR_11 = VAR_10 + VAR_0->frame->linesize[0];", "}", "}", "}", "for (VAR_6=VAR_1->x1; VAR_6 < VAR_1->x2; VAR_6+=4) {", "if ((VAR_2 & 0x01) && !(mask >>= 1)) {", "if ((VAR_4 + 4) > VAR_5)\nreturn AVERROR_INVALIDDATA;", "flag = AV_RB32 (VAR_4);", "VAR_4 += 4;", "mask = 0x80000000;", "}", "if (!(VAR_2 & 0x01) || (flag & mask)) {", "if (!(VAR_2 & 0x02) && !(mask >>= 1)) {", "if ((VAR_4 + 4) > VAR_5)\nreturn AVERROR_INVALIDDATA;", "flag = AV_RB32 (VAR_4);", "VAR_4 += 4;", "mask = 0x80000000;", "}", "if ((VAR_2 & 0x02) || (~flag & mask)) {", "uint8_t *p;", "if (VAR_4 >= VAR_5)\nreturn AVERROR_INVALIDDATA;", "p = VAR_1->v1_codebook[*VAR_4++];", "if (VAR_0->palette_video) {", "VAR_11[0] = VAR_11[1] = VAR_10[0] = VAR_10[1] = p[6];", "VAR_11[2] = VAR_11[3] = VAR_10[2] = VAR_10[3] = p[9];", "VAR_9[0] = VAR_9[1] = VAR_8[0] = VAR_8[1] = p[0];", "VAR_9[2] = VAR_9[3] = VAR_8[2] = VAR_8[3] = p[3];", "} else {", "p += 6;", "memcpy(VAR_11 + 0, p, 3); memcpy(VAR_11 + 3, p, 3);", "memcpy(VAR_10 + 0, p, 3); memcpy(VAR_10 + 3, p, 3);", "p += 3;", "memcpy(VAR_11 + 6, p, 3); memcpy(VAR_11 + 9, p, 3);", "memcpy(VAR_10 + 6, p, 3); memcpy(VAR_10 + 9, p, 3);", "p -= 9;", "memcpy(VAR_9 + 0, p, 3); memcpy(VAR_9 + 3, p, 3);", "memcpy(VAR_8 + 0, p, 3); memcpy(VAR_8 + 3, p, 3);", "p += 3;", "memcpy(VAR_9 + 6, p, 3); memcpy(VAR_9 + 9, p, 3);", "memcpy(VAR_8 + 6, p, 3); memcpy(VAR_8 + 9, p, 3);", "}", "} else if (flag & mask) {", "if ((VAR_4 + 4) > VAR_5)\nreturn AVERROR_INVALIDDATA;", "cb0 = VAR_1->v4_codebook[*VAR_4++];", "cb1 = VAR_1->v4_codebook[*VAR_4++];", "cb2 = VAR_1->v4_codebook[*VAR_4++];", "cb3 = VAR_1->v4_codebook[*VAR_4++];", "if (VAR_0->palette_video) {", "uint8_t *p;", "p = VAR_11;", "*p++ = cb2[6];", "*p++ = cb2[9];", "*p++ = cb3[6];", "*p = cb3[9];", "p = VAR_10;", "*p++ = cb2[0];", "*p++ = cb2[3];", "*p++ = cb3[0];", "*p = cb3[3];", "p = VAR_9;", "*p++ = cb0[6];", "*p++ = cb0[9];", "*p++ = cb1[6];", "*p = cb1[9];", "p = VAR_8;", "*p++ = cb0[0];", "*p++ = cb0[3];", "*p++ = cb1[0];", "*p = cb1[3];", "} else {", "memcpy(VAR_11 + 0, cb2 + 6, 6);", "memcpy(VAR_11 + 6, cb3 + 6, 6);", "memcpy(VAR_10 + 0, cb2 + 0, 6);", "memcpy(VAR_10 + 6, cb3 + 0, 6);", "memcpy(VAR_9 + 0, cb0 + 6, 6);", "memcpy(VAR_9 + 6, cb1 + 6, 6);", "memcpy(VAR_8 + 0, cb0 + 0, 6);", "memcpy(VAR_8 + 6, cb1 + 0, 6);", "}", "}", "}", "if (VAR_0->palette_video) {", "VAR_8 += 4; VAR_9 += 4;", "VAR_10 += 4; VAR_11 += 4;", "} else {", "VAR_8 += 12; VAR_9 += 12;", "VAR_10 += 12; VAR_11 += 12;", "}", "}", "}", "return 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ] ]
22,386
AVRational av_d2q(double d, int max) { AVRational a; #define LOG2 0.69314718055994530941723212145817656807550013436025 int exponent; int64_t den; if (isnan(d)) return (AVRational) { 0,0 }; if (isinf(d)) return (AVRational) { d < 0 ? -1 : 1, 0 }; exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); den = 1LL << (61 - exponent); av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max); return a; }
true
FFmpeg
de7d29063133b240a9fe2c26049b35a6a028c8a1
AVRational av_d2q(double d, int max) { AVRational a; #define LOG2 0.69314718055994530941723212145817656807550013436025 int exponent; int64_t den; if (isnan(d)) return (AVRational) { 0,0 }; if (isinf(d)) return (AVRational) { d < 0 ? -1 : 1, 0 }; exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); den = 1LL << (61 - exponent); av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max); return a; }
{ "code": [ " if (isinf(d))" ], "line_no": [ 17 ] }
AVRational FUNC_0(double d, int max) { AVRational a; #define LOG2 0.69314718055994530941723212145817656807550013436025 int VAR_0; int64_t den; if (isnan(d)) return (AVRational) { 0,0 }; if (isinf(d)) return (AVRational) { d < 0 ? -1 : 1, 0 }; VAR_0 = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); den = 1LL << (61 - VAR_0); av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max); return a; }
[ "AVRational FUNC_0(double d, int max)\n{", "AVRational a;", "#define LOG2 0.69314718055994530941723212145817656807550013436025\nint VAR_0;", "int64_t den;", "if (isnan(d))\nreturn (AVRational) { 0,0 };", "if (isinf(d))\nreturn (AVRational) { d < 0 ? -1 : 1, 0 };", "VAR_0 = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);", "den = 1LL << (61 - VAR_0);", "av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);", "return a;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
22,388
static void selfTest(uint8_t *src[3], int stride[3], int w, int h){ enum PixelFormat srcFormat, dstFormat; int srcW, srcH, dstW, dstH; int flags; for(srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { for(dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { printf("%s -> %s\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); srcW= w; srcH= h; for(dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){ for(dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){ for(flags=1; flags<33; flags*=2) { int res; res = doTest(src, stride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags); if (res < 0) { dstW = 4 * w / 3; dstH = 4 * h / 3; flags = 33; } } } } } } }
true
FFmpeg
221b804f3491638ecf2eec1302c669ad2d9ec799
static void selfTest(uint8_t *src[3], int stride[3], int w, int h){ enum PixelFormat srcFormat, dstFormat; int srcW, srcH, dstW, dstH; int flags; for(srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { for(dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { printf("%s -> %s\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); srcW= w; srcH= h; for(dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){ for(dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){ for(flags=1; flags<33; flags*=2) { int res; res = doTest(src, stride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags); if (res < 0) { dstW = 4 * w / 3; dstH = 4 * h / 3; flags = 33; } } } } } } }
{ "code": [ "\tenum PixelFormat srcFormat, dstFormat;", "\tint srcW, srcH, dstW, dstH;", "\tint flags;", "\tfor(srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) {", "\t\tfor(dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) {", "\t\t\tprintf(\"%s -> %s\\n\",", "\t\t\t\t\tsws_format_name(srcFormat),", "\t\t\t\t\tsws_format_name(dstFormat));", "\t\t\tsrcW= w;", "\t\t\tsrcH= h;", "\t\t\tfor(dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){", "\t\t\t\tfor(dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){", "\t\t\t\t\tfor(flags=1; flags<33; flags*=2) {", "\t\t\t\t\t\tint res;", "\t\t\t\t\t\tres = doTest(src, stride, w, h, srcFormat, dstFormat,", "\t\t\t\t\t\t\tsrcW, srcH, dstW, dstH, flags);", "\t\t\t\t\t\tif (res < 0) {", "\t\t\t\t\t\t\tdstW = 4 * w / 3;", "\t\t\t\t\t\t\tdstH = 4 * h / 3;", "\t\t\t\t\t\t\tflags = 33;", "\tint flags;" ], "line_no": [ 3, 5, 7, 11, 13, 15, 17, 19, 23, 25, 27, 29, 31, 33, 37, 39, 41, 43, 45, 47, 7 ] }
static void FUNC_0(uint8_t *VAR_0[3], int VAR_1[3], int VAR_2, int VAR_3){ enum PixelFormat VAR_4, VAR_5; int VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10; for(VAR_4 = 0; VAR_4 < PIX_FMT_NB; VAR_4++) { for(VAR_5 = 0; VAR_5 < PIX_FMT_NB; VAR_5++) { printf("%s -> %s\n", sws_format_name(VAR_4), sws_format_name(VAR_5)); VAR_6= VAR_2; VAR_7= VAR_3; for(VAR_8=VAR_2 - VAR_2/3; VAR_8<= 4*VAR_2/3; VAR_8+= VAR_2/3){ for(VAR_9=VAR_3 - VAR_3/3; VAR_9<= 4*VAR_3/3; VAR_9+= VAR_3/3){ for(VAR_10=1; VAR_10<33; VAR_10*=2) { int res; res = doTest(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10); if (res < 0) { VAR_8 = 4 * VAR_2 / 3; VAR_9 = 4 * VAR_3 / 3; VAR_10 = 33; } } } } } } }
[ "static void FUNC_0(uint8_t *VAR_0[3], int VAR_1[3], int VAR_2, int VAR_3){", "enum PixelFormat VAR_4, VAR_5;", "int VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10;", "for(VAR_4 = 0; VAR_4 < PIX_FMT_NB; VAR_4++) {", "for(VAR_5 = 0; VAR_5 < PIX_FMT_NB; VAR_5++) {", "printf(\"%s -> %s\\n\",\nsws_format_name(VAR_4),\nsws_format_name(VAR_5));", "VAR_6= VAR_2;", "VAR_7= VAR_3;", "for(VAR_8=VAR_2 - VAR_2/3; VAR_8<= 4*VAR_2/3; VAR_8+= VAR_2/3){", "for(VAR_9=VAR_3 - VAR_3/3; VAR_9<= 4*VAR_3/3; VAR_9+= VAR_3/3){", "for(VAR_10=1; VAR_10<33; VAR_10*=2) {", "int res;", "res = doTest(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5,\nVAR_6, VAR_7, VAR_8, VAR_9, VAR_10);", "if (res < 0) {", "VAR_8 = 4 * VAR_2 / 3;", "VAR_9 = 4 * VAR_3 / 3;", "VAR_10 = 33;", "}", "}", "}", "}", "}", "}", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
22,390
static int dct_max8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, ptrdiff_t stride, int h) { LOCAL_ALIGNED_16(int16_t, temp, [64]); int sum = 0, i; av_assert2(h == 8); s->pdsp.diff_pixels(temp, src1, src2, stride); s->fdsp.fdct(temp); for (i = 0; i < 64; i++) sum = FFMAX(sum, FFABS(temp[i])); return sum; }
true
FFmpeg
bc488ec28aec4bc91ba47283c49c9f7f25696eaa
static int dct_max8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, ptrdiff_t stride, int h) { LOCAL_ALIGNED_16(int16_t, temp, [64]); int sum = 0, i; av_assert2(h == 8); s->pdsp.diff_pixels(temp, src1, src2, stride); s->fdsp.fdct(temp); for (i = 0; i < 64; i++) sum = FFMAX(sum, FFABS(temp[i])); return sum; }
{ "code": [ " s->pdsp.diff_pixels(temp, src1, src2, stride);", " s->pdsp.diff_pixels(temp, src1, src2, stride);", " s->pdsp.diff_pixels(temp, src1, src2, stride);", " s->pdsp.diff_pixels(temp, src1, src2, stride);" ], "line_no": [ 17, 17, 17, 17 ] }
static int FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, ptrdiff_t VAR_3, int VAR_4) { LOCAL_ALIGNED_16(int16_t, temp, [64]); int VAR_5 = 0, VAR_6; av_assert2(VAR_4 == 8); VAR_0->pdsp.diff_pixels(temp, VAR_1, VAR_2, VAR_3); VAR_0->fdsp.fdct(temp); for (VAR_6 = 0; VAR_6 < 64; VAR_6++) VAR_5 = FFMAX(VAR_5, FFABS(temp[VAR_6])); return VAR_5; }
[ "static int FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1,\nuint8_t *VAR_2, ptrdiff_t VAR_3, int VAR_4)\n{", "LOCAL_ALIGNED_16(int16_t, temp, [64]);", "int VAR_5 = 0, VAR_6;", "av_assert2(VAR_4 == 8);", "VAR_0->pdsp.diff_pixels(temp, VAR_1, VAR_2, VAR_3);", "VAR_0->fdsp.fdct(temp);", "for (VAR_6 = 0; VAR_6 < 64; VAR_6++)", "VAR_5 = FFMAX(VAR_5, FFABS(temp[VAR_6]));", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
22,391
static void intra_predict_mad_cow_dc_l00_8x8_msa(uint8_t *src, int32_t stride) { uint8_t lp_cnt; uint32_t src0 = 0; uint64_t out0, out1; for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) { src0 += src[lp_cnt * stride - 1]; } src0 = (src0 + 2) >> 2; out0 = src0 * 0x0101010101010101; out1 = 0x8080808080808080; for (lp_cnt = 4; lp_cnt--;) { SD(out0, src); SD(out1, src + stride * 4); src += stride; } }
false
FFmpeg
d6737539e77e78fca9a04914d51996cfd1ccc55c
static void intra_predict_mad_cow_dc_l00_8x8_msa(uint8_t *src, int32_t stride) { uint8_t lp_cnt; uint32_t src0 = 0; uint64_t out0, out1; for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) { src0 += src[lp_cnt * stride - 1]; } src0 = (src0 + 2) >> 2; out0 = src0 * 0x0101010101010101; out1 = 0x8080808080808080; for (lp_cnt = 4; lp_cnt--;) { SD(out0, src); SD(out1, src + stride * 4); src += stride; } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int32_t VAR_1) { uint8_t lp_cnt; uint32_t src0 = 0; uint64_t out0, out1; for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) { src0 += VAR_0[lp_cnt * VAR_1 - 1]; } src0 = (src0 + 2) >> 2; out0 = src0 * 0x0101010101010101; out1 = 0x8080808080808080; for (lp_cnt = 4; lp_cnt--;) { SD(out0, VAR_0); SD(out1, VAR_0 + VAR_1 * 4); VAR_0 += VAR_1; } }
[ "static void FUNC_0(uint8_t *VAR_0, int32_t VAR_1)\n{", "uint8_t lp_cnt;", "uint32_t src0 = 0;", "uint64_t out0, out1;", "for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {", "src0 += VAR_0[lp_cnt * VAR_1 - 1];", "}", "src0 = (src0 + 2) >> 2;", "out0 = src0 * 0x0101010101010101;", "out1 = 0x8080808080808080;", "for (lp_cnt = 4; lp_cnt--;) {", "SD(out0, VAR_0);", "SD(out1, VAR_0 + VAR_1 * 4);", "VAR_0 += VAR_1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
22,393
static void copy_parameter_set(void **to, void **from, int count, int size) { int i; for (i = 0; i < count; i++) { if (to[i] && !from[i]) av_freep(&to[i]); else if (from[i] && !to[i]) to[i] = av_malloc(size); if (from[i]) memcpy(to[i], from[i], size); } }
false
FFmpeg
a483aae7d8bcd37b50bb86345606bbcd2301110b
static void copy_parameter_set(void **to, void **from, int count, int size) { int i; for (i = 0; i < count; i++) { if (to[i] && !from[i]) av_freep(&to[i]); else if (from[i] && !to[i]) to[i] = av_malloc(size); if (from[i]) memcpy(to[i], from[i], size); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void **VAR_0, void **VAR_1, int VAR_2, int VAR_3) { int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { if (VAR_0[VAR_4] && !VAR_1[VAR_4]) av_freep(&VAR_0[VAR_4]); else if (VAR_1[VAR_4] && !VAR_0[VAR_4]) VAR_0[VAR_4] = av_malloc(VAR_3); if (VAR_1[VAR_4]) memcpy(VAR_0[VAR_4], VAR_1[VAR_4], VAR_3); } }
[ "static void FUNC_0(void **VAR_0, void **VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "if (VAR_0[VAR_4] && !VAR_1[VAR_4])\nav_freep(&VAR_0[VAR_4]);", "else if (VAR_1[VAR_4] && !VAR_0[VAR_4])\nVAR_0[VAR_4] = av_malloc(VAR_3);", "if (VAR_1[VAR_4])\nmemcpy(VAR_0[VAR_4], VAR_1[VAR_4], VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 21, 23 ], [ 25 ], [ 27 ] ]
22,394
av_cold void swri_resample_dsp_x86_init(ResampleContext *c) { int av_unused mm_flags = av_get_cpu_flags(); switch(c->format){ case AV_SAMPLE_FMT_S16P: if (ARCH_X86_32 && EXTERNAL_MMXEXT(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_mmxext : ff_resample_common_int16_mmxext; } if (EXTERNAL_SSE2(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_sse2 : ff_resample_common_int16_sse2; } if (EXTERNAL_XOP(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_xop : ff_resample_common_int16_xop; } break; case AV_SAMPLE_FMT_FLTP: if (EXTERNAL_SSE(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_sse : ff_resample_common_float_sse; } if (EXTERNAL_AVX(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_avx : ff_resample_common_float_avx; } if (EXTERNAL_FMA3(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_fma3 : ff_resample_common_float_fma3; } if (EXTERNAL_FMA4(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_fma4 : ff_resample_common_float_fma4; } break; case AV_SAMPLE_FMT_DBLP: if (EXTERNAL_SSE2(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_double_sse2 : ff_resample_common_double_sse2; } break; } }
false
FFmpeg
c16e99e3b3c02edcf33245468731d414eab97dac
av_cold void swri_resample_dsp_x86_init(ResampleContext *c) { int av_unused mm_flags = av_get_cpu_flags(); switch(c->format){ case AV_SAMPLE_FMT_S16P: if (ARCH_X86_32 && EXTERNAL_MMXEXT(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_mmxext : ff_resample_common_int16_mmxext; } if (EXTERNAL_SSE2(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_sse2 : ff_resample_common_int16_sse2; } if (EXTERNAL_XOP(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_xop : ff_resample_common_int16_xop; } break; case AV_SAMPLE_FMT_FLTP: if (EXTERNAL_SSE(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_sse : ff_resample_common_float_sse; } if (EXTERNAL_AVX(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_avx : ff_resample_common_float_avx; } if (EXTERNAL_FMA3(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_fma3 : ff_resample_common_float_fma3; } if (EXTERNAL_FMA4(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_fma4 : ff_resample_common_float_fma4; } break; case AV_SAMPLE_FMT_DBLP: if (EXTERNAL_SSE2(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_double_sse2 : ff_resample_common_double_sse2; } break; } }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(ResampleContext *c) { int VAR_0 mm_flags = av_get_cpu_flags(); switch(c->format){ case AV_SAMPLE_FMT_S16P: if (ARCH_X86_32 && EXTERNAL_MMXEXT(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_mmxext : ff_resample_common_int16_mmxext; } if (EXTERNAL_SSE2(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_sse2 : ff_resample_common_int16_sse2; } if (EXTERNAL_XOP(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_int16_xop : ff_resample_common_int16_xop; } break; case AV_SAMPLE_FMT_FLTP: if (EXTERNAL_SSE(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_sse : ff_resample_common_float_sse; } if (EXTERNAL_AVX(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_avx : ff_resample_common_float_avx; } if (EXTERNAL_FMA3(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_fma3 : ff_resample_common_float_fma3; } if (EXTERNAL_FMA4(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_float_fma4 : ff_resample_common_float_fma4; } break; case AV_SAMPLE_FMT_DBLP: if (EXTERNAL_SSE2(mm_flags)) { c->dsp.resample = c->linear ? ff_resample_linear_double_sse2 : ff_resample_common_double_sse2; } break; } }
[ "av_cold void FUNC_0(ResampleContext *c)\n{", "int VAR_0 mm_flags = av_get_cpu_flags();", "switch(c->format){", "case AV_SAMPLE_FMT_S16P:\nif (ARCH_X86_32 && EXTERNAL_MMXEXT(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_int16_mmxext\n: ff_resample_common_int16_mmxext;", "}", "if (EXTERNAL_SSE2(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_int16_sse2\n: ff_resample_common_int16_sse2;", "}", "if (EXTERNAL_XOP(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_int16_xop\n: ff_resample_common_int16_xop;", "}", "break;", "case AV_SAMPLE_FMT_FLTP:\nif (EXTERNAL_SSE(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_float_sse\n: ff_resample_common_float_sse;", "}", "if (EXTERNAL_AVX(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_float_avx\n: ff_resample_common_float_avx;", "}", "if (EXTERNAL_FMA3(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_float_fma3\n: ff_resample_common_float_fma3;", "}", "if (EXTERNAL_FMA4(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_float_fma4\n: ff_resample_common_float_fma4;", "}", "break;", "case AV_SAMPLE_FMT_DBLP:\nif (EXTERNAL_SSE2(mm_flags)) {", "c->dsp.resample = c->linear ? ff_resample_linear_double_sse2\n: ff_resample_common_double_sse2;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
22,395
alloc_parameter_set(H264Context *h, void **vec, const unsigned int id, const unsigned int max, const size_t size, const char *name) { if(id>=max) { av_log(h->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", name, id); return NULL; } if(!vec[id]) { vec[id] = av_mallocz(size); if(vec[id] == NULL) av_log(h->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", name); } return vec[id]; }
false
FFmpeg
255d4e717faa98ab783401acd68a278af32f6360
alloc_parameter_set(H264Context *h, void **vec, const unsigned int id, const unsigned int max, const size_t size, const char *name) { if(id>=max) { av_log(h->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", name, id); return NULL; } if(!vec[id]) { vec[id] = av_mallocz(size); if(vec[id] == NULL) av_log(h->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", name); } return vec[id]; }
{ "code": [], "line_no": [] }
FUNC_0(H264Context *VAR_0, void **VAR_1, const unsigned int VAR_2, const unsigned int VAR_3, const size_t VAR_4, const char *VAR_5) { if(VAR_2>=VAR_3) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", VAR_5, VAR_2); return NULL; } if(!VAR_1[VAR_2]) { VAR_1[VAR_2] = av_mallocz(VAR_4); if(VAR_1[VAR_2] == NULL) av_log(VAR_0->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", VAR_5); } return VAR_1[VAR_2]; }
[ "FUNC_0(H264Context *VAR_0, void **VAR_1, const unsigned int VAR_2, const unsigned int VAR_3,\nconst size_t VAR_4, const char *VAR_5)\n{", "if(VAR_2>=VAR_3) {", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"%s_id (%d) out of range\\n\", VAR_5, VAR_2);", "return NULL;", "}", "if(!VAR_1[VAR_2]) {", "VAR_1[VAR_2] = av_mallocz(VAR_4);", "if(VAR_1[VAR_2] == NULL)\nav_log(VAR_0->s.avctx, AV_LOG_ERROR, \"cannot allocate memory for %s\\n\", VAR_5);", "}", "return VAR_1[VAR_2];", "}" ]
[ 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 ] ]
22,396
static int filter_frame(AVFilterLink *inlink, AVFrame *ref) { FrameStepContext *framestep = inlink->dst->priv; if (!(framestep->frame_count++ % framestep->frame_step)) { framestep->frame_selected = 1; return ff_filter_frame(inlink->dst->outputs[0], ref); } else { framestep->frame_selected = 0; av_frame_free(&ref); return 0; } }
false
FFmpeg
7c79ec66b6cc25a150d33d7397c8f4310b77e70f
static int filter_frame(AVFilterLink *inlink, AVFrame *ref) { FrameStepContext *framestep = inlink->dst->priv; if (!(framestep->frame_count++ % framestep->frame_step)) { framestep->frame_selected = 1; return ff_filter_frame(inlink->dst->outputs[0], ref); } else { framestep->frame_selected = 0; av_frame_free(&ref); return 0; } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1) { FrameStepContext *framestep = VAR_0->dst->priv; if (!(framestep->frame_count++ % framestep->frame_step)) { framestep->frame_selected = 1; return ff_filter_frame(VAR_0->dst->outputs[0], VAR_1); } else { framestep->frame_selected = 0; av_frame_free(&VAR_1); return 0; } }
[ "static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)\n{", "FrameStepContext *framestep = VAR_0->dst->priv;", "if (!(framestep->frame_count++ % framestep->frame_step)) {", "framestep->frame_selected = 1;", "return ff_filter_frame(VAR_0->dst->outputs[0], VAR_1);", "} else {", "framestep->frame_selected = 0;", "av_frame_free(&VAR_1);", "return 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
22,397
static int cris_mmu_translate_page(struct cris_mmu_result_t *res, CPUState *env, uint32_t vaddr, int rw, int usermode) { unsigned int vpage; unsigned int idx; uint32_t lo, hi; uint32_t tlb_vpn, tlb_pfn = 0; int tlb_pid, tlb_g, tlb_v, tlb_k, tlb_w, tlb_x; int cfg_v, cfg_k, cfg_w, cfg_x; int set, match = 0; uint32_t r_cause; uint32_t r_cfg; int rwcause; int mmu = 1; /* Data mmu is default. */ int vect_base; r_cause = env->sregs[SFR_R_MM_CAUSE]; r_cfg = env->sregs[SFR_RW_MM_CFG]; switch (rw) { case 2: rwcause = CRIS_MMU_ERR_EXEC; mmu = 0; break; case 1: rwcause = CRIS_MMU_ERR_WRITE; break; default: case 0: rwcause = CRIS_MMU_ERR_READ; break; } /* I exception vectors 4 - 7, D 8 - 11. */ vect_base = (mmu + 1) * 4; vpage = vaddr >> 13; /* We know the index which to check on each set. Scan both I and D. */ #if 0 for (set = 0; set < 4; set++) { for (idx = 0; idx < 16; idx++) { lo = env->tlbsets[mmu][set][idx].lo; hi = env->tlbsets[mmu][set][idx].hi; tlb_vpn = EXTRACT_FIELD(hi, 13, 31); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); printf ("TLB: [%d][%d] hi=%x lo=%x v=%x p=%x\n", set, idx, hi, lo, tlb_vpn, tlb_pfn); } } #endif idx = vpage & 15; for (set = 0; set < 4; set++) { lo = env->tlbsets[mmu][set][idx].lo; hi = env->tlbsets[mmu][set][idx].hi; tlb_vpn = EXTRACT_FIELD(hi, 13, 31); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); D(printf("TLB[%d][%d] v=%x vpage=%x -> pfn=%x lo=%x hi=%x\n", i, idx, tlb_vpn, vpage, tlb_pfn, lo, hi)); if (tlb_vpn == vpage) { match = 1; break; } } res->bf_vec = vect_base; if (match) { cfg_w = EXTRACT_FIELD(r_cfg, 19, 19); cfg_k = EXTRACT_FIELD(r_cfg, 18, 18); cfg_x = EXTRACT_FIELD(r_cfg, 17, 17); cfg_v = EXTRACT_FIELD(r_cfg, 16, 16); tlb_pid = EXTRACT_FIELD(hi, 0, 7); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); tlb_g = EXTRACT_FIELD(lo, 4, 4); tlb_v = EXTRACT_FIELD(lo, 3, 3); tlb_k = EXTRACT_FIELD(lo, 2, 2); tlb_w = EXTRACT_FIELD(lo, 1, 1); tlb_x = EXTRACT_FIELD(lo, 0, 0); /* set_exception_vector(0x04, i_mmu_refill); set_exception_vector(0x05, i_mmu_invalid); set_exception_vector(0x06, i_mmu_access); set_exception_vector(0x07, i_mmu_execute); set_exception_vector(0x08, d_mmu_refill); set_exception_vector(0x09, d_mmu_invalid); set_exception_vector(0x0a, d_mmu_access); set_exception_vector(0x0b, d_mmu_write); */ if (!tlb_g && tlb_pid != (env->pregs[PR_PID] & 0xff)) { D(printf ("tlb: wrong pid %x %x pc=%x\n", tlb_pid, env->pregs[PR_PID], env->pc)); match = 0; res->bf_vec = vect_base; } else if (rw == 1 && cfg_w && !tlb_w) { D(printf ("tlb: write protected %x lo=%x\n", vaddr, lo)); match = 0; res->bf_vec = vect_base + 3; } else if (cfg_v && !tlb_v) { D(printf ("tlb: invalid %x\n", vaddr)); set_field(&r_cause, rwcause, 8, 9); match = 0; res->bf_vec = vect_base + 1; } res->prot = 0; if (match) { res->prot |= PAGE_READ; if (tlb_w) res->prot |= PAGE_WRITE; if (tlb_x) res->prot |= PAGE_EXEC; } else D(dump_tlb(env, mmu)); env->sregs[SFR_RW_MM_TLB_HI] = hi; env->sregs[SFR_RW_MM_TLB_LO] = lo; } if (!match) { /* miss. */ idx = vpage & 15; set = 0; /* Update RW_MM_TLB_SEL. */ env->sregs[SFR_RW_MM_TLB_SEL] = 0; set_field(&env->sregs[SFR_RW_MM_TLB_SEL], idx, 0, 4); set_field(&env->sregs[SFR_RW_MM_TLB_SEL], set, 4, 5); /* Update RW_MM_CAUSE. */ set_field(&r_cause, rwcause, 8, 2); set_field(&r_cause, vpage, 13, 19); set_field(&r_cause, env->pregs[PR_PID], 0, 8); env->sregs[SFR_R_MM_CAUSE] = r_cause; D(printf("refill vaddr=%x pc=%x\n", vaddr, env->pc)); } D(printf ("%s rw=%d mtch=%d pc=%x va=%x vpn=%x tlbvpn=%x pfn=%x pid=%x" " %x cause=%x sel=%x sp=%x %x %x\n", __func__, rw, match, env->pc, vaddr, vpage, tlb_vpn, tlb_pfn, tlb_pid, env->pregs[PR_PID], r_cause, env->sregs[SFR_RW_MM_TLB_SEL], env->regs[R_SP], env->pregs[PR_USP], env->ksp)); res->pfn = tlb_pfn; return !match; }
false
qemu
ef29a70d18c2d551cf4bb74b8aa9638caac3391b
static int cris_mmu_translate_page(struct cris_mmu_result_t *res, CPUState *env, uint32_t vaddr, int rw, int usermode) { unsigned int vpage; unsigned int idx; uint32_t lo, hi; uint32_t tlb_vpn, tlb_pfn = 0; int tlb_pid, tlb_g, tlb_v, tlb_k, tlb_w, tlb_x; int cfg_v, cfg_k, cfg_w, cfg_x; int set, match = 0; uint32_t r_cause; uint32_t r_cfg; int rwcause; int mmu = 1; int vect_base; r_cause = env->sregs[SFR_R_MM_CAUSE]; r_cfg = env->sregs[SFR_RW_MM_CFG]; switch (rw) { case 2: rwcause = CRIS_MMU_ERR_EXEC; mmu = 0; break; case 1: rwcause = CRIS_MMU_ERR_WRITE; break; default: case 0: rwcause = CRIS_MMU_ERR_READ; break; } vect_base = (mmu + 1) * 4; vpage = vaddr >> 13; #if 0 for (set = 0; set < 4; set++) { for (idx = 0; idx < 16; idx++) { lo = env->tlbsets[mmu][set][idx].lo; hi = env->tlbsets[mmu][set][idx].hi; tlb_vpn = EXTRACT_FIELD(hi, 13, 31); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); printf ("TLB: [%d][%d] hi=%x lo=%x v=%x p=%x\n", set, idx, hi, lo, tlb_vpn, tlb_pfn); } } #endif idx = vpage & 15; for (set = 0; set < 4; set++) { lo = env->tlbsets[mmu][set][idx].lo; hi = env->tlbsets[mmu][set][idx].hi; tlb_vpn = EXTRACT_FIELD(hi, 13, 31); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); D(printf("TLB[%d][%d] v=%x vpage=%x -> pfn=%x lo=%x hi=%x\n", i, idx, tlb_vpn, vpage, tlb_pfn, lo, hi)); if (tlb_vpn == vpage) { match = 1; break; } } res->bf_vec = vect_base; if (match) { cfg_w = EXTRACT_FIELD(r_cfg, 19, 19); cfg_k = EXTRACT_FIELD(r_cfg, 18, 18); cfg_x = EXTRACT_FIELD(r_cfg, 17, 17); cfg_v = EXTRACT_FIELD(r_cfg, 16, 16); tlb_pid = EXTRACT_FIELD(hi, 0, 7); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); tlb_g = EXTRACT_FIELD(lo, 4, 4); tlb_v = EXTRACT_FIELD(lo, 3, 3); tlb_k = EXTRACT_FIELD(lo, 2, 2); tlb_w = EXTRACT_FIELD(lo, 1, 1); tlb_x = EXTRACT_FIELD(lo, 0, 0); if (!tlb_g && tlb_pid != (env->pregs[PR_PID] & 0xff)) { D(printf ("tlb: wrong pid %x %x pc=%x\n", tlb_pid, env->pregs[PR_PID], env->pc)); match = 0; res->bf_vec = vect_base; } else if (rw == 1 && cfg_w && !tlb_w) { D(printf ("tlb: write protected %x lo=%x\n", vaddr, lo)); match = 0; res->bf_vec = vect_base + 3; } else if (cfg_v && !tlb_v) { D(printf ("tlb: invalid %x\n", vaddr)); set_field(&r_cause, rwcause, 8, 9); match = 0; res->bf_vec = vect_base + 1; } res->prot = 0; if (match) { res->prot |= PAGE_READ; if (tlb_w) res->prot |= PAGE_WRITE; if (tlb_x) res->prot |= PAGE_EXEC; } else D(dump_tlb(env, mmu)); env->sregs[SFR_RW_MM_TLB_HI] = hi; env->sregs[SFR_RW_MM_TLB_LO] = lo; } if (!match) { idx = vpage & 15; set = 0; env->sregs[SFR_RW_MM_TLB_SEL] = 0; set_field(&env->sregs[SFR_RW_MM_TLB_SEL], idx, 0, 4); set_field(&env->sregs[SFR_RW_MM_TLB_SEL], set, 4, 5); set_field(&r_cause, rwcause, 8, 2); set_field(&r_cause, vpage, 13, 19); set_field(&r_cause, env->pregs[PR_PID], 0, 8); env->sregs[SFR_R_MM_CAUSE] = r_cause; D(printf("refill vaddr=%x pc=%x\n", vaddr, env->pc)); } D(printf ("%s rw=%d mtch=%d pc=%x va=%x vpn=%x tlbvpn=%x pfn=%x pid=%x" " %x cause=%x sel=%x sp=%x %x %x\n", __func__, rw, match, env->pc, vaddr, vpage, tlb_vpn, tlb_pfn, tlb_pid, env->pregs[PR_PID], r_cause, env->sregs[SFR_RW_MM_TLB_SEL], env->regs[R_SP], env->pregs[PR_USP], env->ksp)); res->pfn = tlb_pfn; return !match; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct cris_mmu_result_t *VAR_0, CPUState *VAR_1, uint32_t VAR_2, int VAR_3, int VAR_4) { unsigned int VAR_5; unsigned int VAR_6; uint32_t lo, hi; uint32_t tlb_vpn, tlb_pfn = 0; int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; int VAR_13, VAR_14, VAR_15, VAR_16; int VAR_17, VAR_18 = 0; uint32_t r_cause; uint32_t r_cfg; int VAR_19; int VAR_20 = 1; int VAR_21; r_cause = VAR_1->sregs[SFR_R_MM_CAUSE]; r_cfg = VAR_1->sregs[SFR_RW_MM_CFG]; switch (VAR_3) { case 2: VAR_19 = CRIS_MMU_ERR_EXEC; VAR_20 = 0; break; case 1: VAR_19 = CRIS_MMU_ERR_WRITE; break; default: case 0: VAR_19 = CRIS_MMU_ERR_READ; break; } VAR_21 = (VAR_20 + 1) * 4; VAR_5 = VAR_2 >> 13; #if 0 for (VAR_17 = 0; VAR_17 < 4; VAR_17++) { for (VAR_6 = 0; VAR_6 < 16; VAR_6++) { lo = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].lo; hi = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].hi; tlb_vpn = EXTRACT_FIELD(hi, 13, 31); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); printf ("TLB: [%d][%d] hi=%x lo=%x v=%x p=%x\n", VAR_17, VAR_6, hi, lo, tlb_vpn, tlb_pfn); } } #endif VAR_6 = VAR_5 & 15; for (VAR_17 = 0; VAR_17 < 4; VAR_17++) { lo = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].lo; hi = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].hi; tlb_vpn = EXTRACT_FIELD(hi, 13, 31); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); D(printf("TLB[%d][%d] v=%x VAR_5=%x -> pfn=%x lo=%x hi=%x\n", i, VAR_6, tlb_vpn, VAR_5, tlb_pfn, lo, hi)); if (tlb_vpn == VAR_5) { VAR_18 = 1; break; } } VAR_0->bf_vec = VAR_21; if (VAR_18) { VAR_15 = EXTRACT_FIELD(r_cfg, 19, 19); VAR_14 = EXTRACT_FIELD(r_cfg, 18, 18); VAR_16 = EXTRACT_FIELD(r_cfg, 17, 17); VAR_13 = EXTRACT_FIELD(r_cfg, 16, 16); VAR_7 = EXTRACT_FIELD(hi, 0, 7); tlb_pfn = EXTRACT_FIELD(lo, 13, 31); VAR_8 = EXTRACT_FIELD(lo, 4, 4); VAR_9 = EXTRACT_FIELD(lo, 3, 3); VAR_10 = EXTRACT_FIELD(lo, 2, 2); VAR_11 = EXTRACT_FIELD(lo, 1, 1); VAR_12 = EXTRACT_FIELD(lo, 0, 0); if (!VAR_8 && VAR_7 != (VAR_1->pregs[PR_PID] & 0xff)) { D(printf ("tlb: wrong pid %x %x pc=%x\n", VAR_7, VAR_1->pregs[PR_PID], VAR_1->pc)); VAR_18 = 0; VAR_0->bf_vec = VAR_21; } else if (VAR_3 == 1 && VAR_15 && !VAR_11) { D(printf ("tlb: write protected %x lo=%x\n", VAR_2, lo)); VAR_18 = 0; VAR_0->bf_vec = VAR_21 + 3; } else if (VAR_13 && !VAR_9) { D(printf ("tlb: invalid %x\n", VAR_2)); set_field(&r_cause, VAR_19, 8, 9); VAR_18 = 0; VAR_0->bf_vec = VAR_21 + 1; } VAR_0->prot = 0; if (VAR_18) { VAR_0->prot |= PAGE_READ; if (VAR_11) VAR_0->prot |= PAGE_WRITE; if (VAR_12) VAR_0->prot |= PAGE_EXEC; } else D(dump_tlb(VAR_1, VAR_20)); VAR_1->sregs[SFR_RW_MM_TLB_HI] = hi; VAR_1->sregs[SFR_RW_MM_TLB_LO] = lo; } if (!VAR_18) { VAR_6 = VAR_5 & 15; VAR_17 = 0; VAR_1->sregs[SFR_RW_MM_TLB_SEL] = 0; set_field(&VAR_1->sregs[SFR_RW_MM_TLB_SEL], VAR_6, 0, 4); set_field(&VAR_1->sregs[SFR_RW_MM_TLB_SEL], VAR_17, 4, 5); set_field(&r_cause, VAR_19, 8, 2); set_field(&r_cause, VAR_5, 13, 19); set_field(&r_cause, VAR_1->pregs[PR_PID], 0, 8); VAR_1->sregs[SFR_R_MM_CAUSE] = r_cause; D(printf("refill VAR_2=%x pc=%x\n", VAR_2, VAR_1->pc)); } D(printf ("%s VAR_3=%d mtch=%d pc=%x va=%x vpn=%x tlbvpn=%x pfn=%x pid=%x" " %x cause=%x sel=%x sp=%x %x %x\n", __func__, VAR_3, VAR_18, VAR_1->pc, VAR_2, VAR_5, tlb_vpn, tlb_pfn, VAR_7, VAR_1->pregs[PR_PID], r_cause, VAR_1->sregs[SFR_RW_MM_TLB_SEL], VAR_1->regs[R_SP], VAR_1->pregs[PR_USP], VAR_1->ksp)); VAR_0->pfn = tlb_pfn; return !VAR_18; }
[ "static int FUNC_0(struct cris_mmu_result_t *VAR_0,\nCPUState *VAR_1, uint32_t VAR_2,\nint VAR_3, int VAR_4)\n{", "unsigned int VAR_5;", "unsigned int VAR_6;", "uint32_t lo, hi;", "uint32_t tlb_vpn, tlb_pfn = 0;", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;", "int VAR_13, VAR_14, VAR_15, VAR_16;", "int VAR_17, VAR_18 = 0;", "uint32_t r_cause;", "uint32_t r_cfg;", "int VAR_19;", "int VAR_20 = 1;", "int VAR_21;", "r_cause = VAR_1->sregs[SFR_R_MM_CAUSE];", "r_cfg = VAR_1->sregs[SFR_RW_MM_CFG];", "switch (VAR_3) {", "case 2: VAR_19 = CRIS_MMU_ERR_EXEC; VAR_20 = 0; break;", "case 1: VAR_19 = CRIS_MMU_ERR_WRITE; break;", "default:\ncase 0: VAR_19 = CRIS_MMU_ERR_READ; break;", "}", "VAR_21 = (VAR_20 + 1) * 4;", "VAR_5 = VAR_2 >> 13;", "#if 0\nfor (VAR_17 = 0; VAR_17 < 4; VAR_17++) {", "for (VAR_6 = 0; VAR_6 < 16; VAR_6++) {", "lo = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].lo;", "hi = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].hi;", "tlb_vpn = EXTRACT_FIELD(hi, 13, 31);", "tlb_pfn = EXTRACT_FIELD(lo, 13, 31);", "printf (\"TLB: [%d][%d] hi=%x lo=%x v=%x p=%x\\n\",\nVAR_17, VAR_6, hi, lo, tlb_vpn, tlb_pfn);", "}", "}", "#endif\nVAR_6 = VAR_5 & 15;", "for (VAR_17 = 0; VAR_17 < 4; VAR_17++)", "{", "lo = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].lo;", "hi = VAR_1->tlbsets[VAR_20][VAR_17][VAR_6].hi;", "tlb_vpn = EXTRACT_FIELD(hi, 13, 31);", "tlb_pfn = EXTRACT_FIELD(lo, 13, 31);", "D(printf(\"TLB[%d][%d] v=%x VAR_5=%x -> pfn=%x lo=%x hi=%x\\n\",\ni, VAR_6, tlb_vpn, VAR_5, tlb_pfn, lo, hi));", "if (tlb_vpn == VAR_5) {", "VAR_18 = 1;", "break;", "}", "}", "VAR_0->bf_vec = VAR_21;", "if (VAR_18) {", "VAR_15 = EXTRACT_FIELD(r_cfg, 19, 19);", "VAR_14 = EXTRACT_FIELD(r_cfg, 18, 18);", "VAR_16 = EXTRACT_FIELD(r_cfg, 17, 17);", "VAR_13 = EXTRACT_FIELD(r_cfg, 16, 16);", "VAR_7 = EXTRACT_FIELD(hi, 0, 7);", "tlb_pfn = EXTRACT_FIELD(lo, 13, 31);", "VAR_8 = EXTRACT_FIELD(lo, 4, 4);", "VAR_9 = EXTRACT_FIELD(lo, 3, 3);", "VAR_10 = EXTRACT_FIELD(lo, 2, 2);", "VAR_11 = EXTRACT_FIELD(lo, 1, 1);", "VAR_12 = EXTRACT_FIELD(lo, 0, 0);", "if (!VAR_8\n&& VAR_7 != (VAR_1->pregs[PR_PID] & 0xff)) {", "D(printf (\"tlb: wrong pid %x %x pc=%x\\n\",\nVAR_7, VAR_1->pregs[PR_PID], VAR_1->pc));", "VAR_18 = 0;", "VAR_0->bf_vec = VAR_21;", "} else if (VAR_3 == 1 && VAR_15 && !VAR_11) {", "D(printf (\"tlb: write protected %x lo=%x\\n\",\nVAR_2, lo));", "VAR_18 = 0;", "VAR_0->bf_vec = VAR_21 + 3;", "} else if (VAR_13 && !VAR_9) {", "D(printf (\"tlb: invalid %x\\n\", VAR_2));", "set_field(&r_cause, VAR_19, 8, 9);", "VAR_18 = 0;", "VAR_0->bf_vec = VAR_21 + 1;", "}", "VAR_0->prot = 0;", "if (VAR_18) {", "VAR_0->prot |= PAGE_READ;", "if (VAR_11)\nVAR_0->prot |= PAGE_WRITE;", "if (VAR_12)\nVAR_0->prot |= PAGE_EXEC;", "}", "else\nD(dump_tlb(VAR_1, VAR_20));", "VAR_1->sregs[SFR_RW_MM_TLB_HI] = hi;", "VAR_1->sregs[SFR_RW_MM_TLB_LO] = lo;", "}", "if (!VAR_18) {", "VAR_6 = VAR_5 & 15;", "VAR_17 = 0;", "VAR_1->sregs[SFR_RW_MM_TLB_SEL] = 0;", "set_field(&VAR_1->sregs[SFR_RW_MM_TLB_SEL], VAR_6, 0, 4);", "set_field(&VAR_1->sregs[SFR_RW_MM_TLB_SEL], VAR_17, 4, 5);", "set_field(&r_cause, VAR_19, 8, 2);", "set_field(&r_cause, VAR_5, 13, 19);", "set_field(&r_cause, VAR_1->pregs[PR_PID], 0, 8);", "VAR_1->sregs[SFR_R_MM_CAUSE] = r_cause;", "D(printf(\"refill VAR_2=%x pc=%x\\n\", VAR_2, VAR_1->pc));", "}", "D(printf (\"%s VAR_3=%d mtch=%d pc=%x va=%x vpn=%x tlbvpn=%x pfn=%x pid=%x\"\n\" %x cause=%x sel=%x sp=%x %x %x\\n\",\n__func__, VAR_3, VAR_18, VAR_1->pc,\nVAR_2, VAR_5,\ntlb_vpn, tlb_pfn, VAR_7,\nVAR_1->pregs[PR_PID],\nr_cause,\nVAR_1->sregs[SFR_RW_MM_TLB_SEL],\nVAR_1->regs[R_SP], VAR_1->pregs[PR_USP], VAR_1->ksp));", "VAR_0->pfn = tlb_pfn;", "return !VAR_18;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 57 ], [ 61 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 181, 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227, 229 ], [ 231 ], [ 233, 235 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 251 ], [ 253 ], [ 259 ], [ 261 ], [ 263 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 285, 287, 289, 291, 293, 295, 297, 299, 301 ], [ 305 ], [ 307 ], [ 309 ] ]
22,398
static int proxy_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) { int retval; retval = v9fs_request(fs_ctx->private, T_CHMOD, NULL, "sd", fs_path, credp->fc_mode); if (retval < 0) { errno = -retval; } return retval; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) { int retval; retval = v9fs_request(fs_ctx->private, T_CHMOD, NULL, "sd", fs_path, credp->fc_mode); if (retval < 0) { errno = -retval; } return retval; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, FsCred *VAR_2) { int VAR_3; VAR_3 = v9fs_request(VAR_0->private, T_CHMOD, NULL, "sd", VAR_1, VAR_2->fc_mode); if (VAR_3 < 0) { errno = -VAR_3; } return VAR_3; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, FsCred *VAR_2)\n{", "int VAR_3;", "VAR_3 = v9fs_request(VAR_0->private, T_CHMOD, NULL, \"sd\",\nVAR_1, VAR_2->fc_mode);", "if (VAR_3 < 0) {", "errno = -VAR_3;", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
22,400
void qmp_blockdev_mirror(const char *device, const char *target, bool has_replaces, const char *replaces, MirrorSyncMode sync, bool has_speed, int64_t speed, bool has_granularity, uint32_t granularity, bool has_buf_size, int64_t buf_size, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, Error **errp) { BlockDriverState *bs; BlockBackend *blk; BlockDriverState *target_bs; AioContext *aio_context; BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN; Error *local_err = NULL; blk = blk_by_name(device); if (!blk) { error_setg(errp, "Device '%s' not found", device); return; } bs = blk_bs(blk); if (!bs) { error_setg(errp, "Device '%s' has no media", device); return; } target_bs = bdrv_lookup_bs(target, target, errp); if (!target_bs) { return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); bdrv_set_aio_context(target_bs, aio_context); blockdev_mirror_common(bs, target_bs, has_replaces, replaces, sync, backing_mode, has_speed, speed, has_granularity, granularity, has_buf_size, buf_size, has_on_source_error, on_source_error, has_on_target_error, on_target_error, true, true, &local_err); if (local_err) { error_propagate(errp, local_err); } aio_context_release(aio_context); }
false
qemu
621ff94d5074d88253a5818c6b9c4db718fbfc65
void qmp_blockdev_mirror(const char *device, const char *target, bool has_replaces, const char *replaces, MirrorSyncMode sync, bool has_speed, int64_t speed, bool has_granularity, uint32_t granularity, bool has_buf_size, int64_t buf_size, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, Error **errp) { BlockDriverState *bs; BlockBackend *blk; BlockDriverState *target_bs; AioContext *aio_context; BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN; Error *local_err = NULL; blk = blk_by_name(device); if (!blk) { error_setg(errp, "Device '%s' not found", device); return; } bs = blk_bs(blk); if (!bs) { error_setg(errp, "Device '%s' has no media", device); return; } target_bs = bdrv_lookup_bs(target, target, errp); if (!target_bs) { return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); bdrv_set_aio_context(target_bs, aio_context); blockdev_mirror_common(bs, target_bs, has_replaces, replaces, sync, backing_mode, has_speed, speed, has_granularity, granularity, has_buf_size, buf_size, has_on_source_error, on_source_error, has_on_target_error, on_target_error, true, true, &local_err); if (local_err) { error_propagate(errp, local_err); } aio_context_release(aio_context); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, const char *VAR_1, bool VAR_2, const char *VAR_3, MirrorSyncMode VAR_4, bool VAR_5, int64_t VAR_6, bool VAR_7, uint32_t VAR_8, bool VAR_9, int64_t VAR_10, bool VAR_11, BlockdevOnError VAR_12, bool VAR_13, BlockdevOnError VAR_14, Error **VAR_15) { BlockDriverState *bs; BlockBackend *blk; BlockDriverState *target_bs; AioContext *aio_context; BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN; Error *local_err = NULL; blk = blk_by_name(VAR_0); if (!blk) { error_setg(VAR_15, "Device '%s' not found", VAR_0); return; } bs = blk_bs(blk); if (!bs) { error_setg(VAR_15, "Device '%s' has no media", VAR_0); return; } target_bs = bdrv_lookup_bs(VAR_1, VAR_1, VAR_15); if (!target_bs) { return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); bdrv_set_aio_context(target_bs, aio_context); blockdev_mirror_common(bs, target_bs, VAR_2, VAR_3, VAR_4, backing_mode, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, true, true, &local_err); if (local_err) { error_propagate(VAR_15, local_err); } aio_context_release(aio_context); }
[ "void FUNC_0(const char *VAR_0, const char *VAR_1,\nbool VAR_2, const char *VAR_3,\nMirrorSyncMode VAR_4,\nbool VAR_5, int64_t VAR_6,\nbool VAR_7, uint32_t VAR_8,\nbool VAR_9, int64_t VAR_10,\nbool VAR_11,\nBlockdevOnError VAR_12,\nbool VAR_13,\nBlockdevOnError VAR_14,\nError **VAR_15)\n{", "BlockDriverState *bs;", "BlockBackend *blk;", "BlockDriverState *target_bs;", "AioContext *aio_context;", "BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN;", "Error *local_err = NULL;", "blk = blk_by_name(VAR_0);", "if (!blk) {", "error_setg(VAR_15, \"Device '%s' not found\", VAR_0);", "return;", "}", "bs = blk_bs(blk);", "if (!bs) {", "error_setg(VAR_15, \"Device '%s' has no media\", VAR_0);", "return;", "}", "target_bs = bdrv_lookup_bs(VAR_1, VAR_1, VAR_15);", "if (!target_bs) {", "return;", "}", "aio_context = bdrv_get_aio_context(bs);", "aio_context_acquire(aio_context);", "bdrv_set_aio_context(target_bs, aio_context);", "blockdev_mirror_common(bs, target_bs,\nVAR_2, VAR_3, VAR_4, backing_mode,\nVAR_5, VAR_6,\nVAR_7, VAR_8,\nVAR_9, VAR_10,\nVAR_11, VAR_12,\nVAR_13, VAR_14,\ntrue, true,\n&local_err);", "if (local_err) {", "error_propagate(VAR_15, local_err);", "}", "aio_context_release(aio_context);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 83, 85, 87, 89, 91, 93, 95, 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ] ]
22,401
static X86CPU *pc_new_cpu(const char *cpu_model, int64_t apic_id, DeviceState *icc_bridge, Error **errp) { X86CPU *cpu = NULL; Error *local_err = NULL; if (icc_bridge == NULL) { error_setg(&local_err, "Invalid icc-bridge value"); goto out; } cpu = cpu_x86_create(cpu_model, &local_err); if (local_err != NULL) { goto out; } qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, "icc")); object_property_set_int(OBJECT(cpu), apic_id, "apic-id", &local_err); object_property_set_bool(OBJECT(cpu), true, "realized", &local_err); out: if (local_err) { error_propagate(errp, local_err); object_unref(OBJECT(cpu)); cpu = NULL; } return cpu; }
false
qemu
46232aaacb66733d3e16dcbd0d26c32ec388801d
static X86CPU *pc_new_cpu(const char *cpu_model, int64_t apic_id, DeviceState *icc_bridge, Error **errp) { X86CPU *cpu = NULL; Error *local_err = NULL; if (icc_bridge == NULL) { error_setg(&local_err, "Invalid icc-bridge value"); goto out; } cpu = cpu_x86_create(cpu_model, &local_err); if (local_err != NULL) { goto out; } qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, "icc")); object_property_set_int(OBJECT(cpu), apic_id, "apic-id", &local_err); object_property_set_bool(OBJECT(cpu), true, "realized", &local_err); out: if (local_err) { error_propagate(errp, local_err); object_unref(OBJECT(cpu)); cpu = NULL; } return cpu; }
{ "code": [], "line_no": [] }
static X86CPU *FUNC_0(const char *cpu_model, int64_t apic_id, DeviceState *icc_bridge, Error **errp) { X86CPU *cpu = NULL; Error *local_err = NULL; if (icc_bridge == NULL) { error_setg(&local_err, "Invalid icc-bridge value"); goto out; } cpu = cpu_x86_create(cpu_model, &local_err); if (local_err != NULL) { goto out; } qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, "icc")); object_property_set_int(OBJECT(cpu), apic_id, "apic-id", &local_err); object_property_set_bool(OBJECT(cpu), true, "realized", &local_err); out: if (local_err) { error_propagate(errp, local_err); object_unref(OBJECT(cpu)); cpu = NULL; } return cpu; }
[ "static X86CPU *FUNC_0(const char *cpu_model, int64_t apic_id,\nDeviceState *icc_bridge, Error **errp)\n{", "X86CPU *cpu = NULL;", "Error *local_err = NULL;", "if (icc_bridge == NULL) {", "error_setg(&local_err, \"Invalid icc-bridge value\");", "goto out;", "}", "cpu = cpu_x86_create(cpu_model, &local_err);", "if (local_err != NULL) {", "goto out;", "}", "qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, \"icc\"));", "object_property_set_int(OBJECT(cpu), apic_id, \"apic-id\", &local_err);", "object_property_set_bool(OBJECT(cpu), true, \"realized\", &local_err);", "out:\nif (local_err) {", "error_propagate(errp, local_err);", "object_unref(OBJECT(cpu));", "cpu = NULL;", "}", "return cpu;", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
22,402
static uint64_t lsi_ram_read(void *opaque, target_phys_addr_t addr, unsigned size) { LSIState *s = opaque; uint32_t val; uint32_t mask; val = s->script_ram[addr >> 2]; mask = ((uint64_t)1 << (size * 8)) - 1; val >>= (addr & 3) * 8; return val & mask; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t lsi_ram_read(void *opaque, target_phys_addr_t addr, unsigned size) { LSIState *s = opaque; uint32_t val; uint32_t mask; val = s->script_ram[addr >> 2]; mask = ((uint64_t)1 << (size * 8)) - 1; val >>= (addr & 3) * 8; return val & mask; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { LSIState *s = opaque; uint32_t val; uint32_t mask; val = s->script_ram[addr >> 2]; mask = ((uint64_t)1 << (size * 8)) - 1; val >>= (addr & 3) * 8; return val & mask; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "LSIState *s = opaque;", "uint32_t val;", "uint32_t mask;", "val = s->script_ram[addr >> 2];", "mask = ((uint64_t)1 << (size * 8)) - 1;", "val >>= (addr & 3) * 8;", "return val & mask;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
22,403
void visit_start_list(Visitor *v, const char *name, Error **errp) { v->start_list(v, name, errp); }
false
qemu
d9f62dde1303286b24ac8ce88be27e2b9b9c5f46
void visit_start_list(Visitor *v, const char *name, Error **errp) { v->start_list(v, name, errp); }
{ "code": [], "line_no": [] }
void FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2) { VAR_0->start_list(VAR_0, VAR_1, VAR_2); }
[ "void FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "VAR_0->start_list(VAR_0, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
22,404
static void scsi_write_same_complete(void *opaque, int ret) { WriteSameCBData *data = opaque; SCSIDiskReq *r = data->r; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); assert(r->req.aiocb != NULL); r->req.aiocb = NULL; if (r->req.io_canceled) { scsi_req_cancel_complete(&r->req); goto done; } if (ret < 0) { if (scsi_handle_rw_error(r, -ret, true)) { goto done; } } block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct); data->nb_sectors -= data->iov.iov_len / 512; data->sector += data->iov.iov_len / 512; data->iov.iov_len = MIN(data->nb_sectors * 512, data->iov.iov_len); if (data->iov.iov_len) { block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, data->iov.iov_len, BLOCK_ACCT_WRITE); /* Reinitialize qiov, to handle unaligned WRITE SAME request * where final qiov may need smaller size */ qemu_iovec_init_external(&data->qiov, &data->iov, 1); r->req.aiocb = blk_aio_pwritev(s->qdev.conf.blk, data->sector << BDRV_SECTOR_BITS, &data->qiov, 0, scsi_write_same_complete, data); return; } scsi_req_complete(&r->req, GOOD); done: scsi_req_unref(&r->req); qemu_vfree(data->iov.iov_base); g_free(data); }
false
qemu
5b956f415a356449a4171d5e0c7d9a25bbc84b5a
static void scsi_write_same_complete(void *opaque, int ret) { WriteSameCBData *data = opaque; SCSIDiskReq *r = data->r; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); assert(r->req.aiocb != NULL); r->req.aiocb = NULL; if (r->req.io_canceled) { scsi_req_cancel_complete(&r->req); goto done; } if (ret < 0) { if (scsi_handle_rw_error(r, -ret, true)) { goto done; } } block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct); data->nb_sectors -= data->iov.iov_len / 512; data->sector += data->iov.iov_len / 512; data->iov.iov_len = MIN(data->nb_sectors * 512, data->iov.iov_len); if (data->iov.iov_len) { block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, data->iov.iov_len, BLOCK_ACCT_WRITE); qemu_iovec_init_external(&data->qiov, &data->iov, 1); r->req.aiocb = blk_aio_pwritev(s->qdev.conf.blk, data->sector << BDRV_SECTOR_BITS, &data->qiov, 0, scsi_write_same_complete, data); return; } scsi_req_complete(&r->req, GOOD); done: scsi_req_unref(&r->req); qemu_vfree(data->iov.iov_base); g_free(data); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { WriteSameCBData *data = VAR_0; SCSIDiskReq *r = data->r; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); assert(r->req.aiocb != NULL); r->req.aiocb = NULL; if (r->req.io_canceled) { scsi_req_cancel_complete(&r->req); goto done; } if (VAR_1 < 0) { if (scsi_handle_rw_error(r, -VAR_1, true)) { goto done; } } block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct); data->nb_sectors -= data->iov.iov_len / 512; data->sector += data->iov.iov_len / 512; data->iov.iov_len = MIN(data->nb_sectors * 512, data->iov.iov_len); if (data->iov.iov_len) { block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, data->iov.iov_len, BLOCK_ACCT_WRITE); qemu_iovec_init_external(&data->qiov, &data->iov, 1); r->req.aiocb = blk_aio_pwritev(s->qdev.conf.blk, data->sector << BDRV_SECTOR_BITS, &data->qiov, 0, FUNC_0, data); return; } scsi_req_complete(&r->req, GOOD); done: scsi_req_unref(&r->req); qemu_vfree(data->iov.iov_base); g_free(data); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "WriteSameCBData *data = VAR_0;", "SCSIDiskReq *r = data->r;", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);", "assert(r->req.aiocb != NULL);", "r->req.aiocb = NULL;", "if (r->req.io_canceled) {", "scsi_req_cancel_complete(&r->req);", "goto done;", "}", "if (VAR_1 < 0) {", "if (scsi_handle_rw_error(r, -VAR_1, true)) {", "goto done;", "}", "}", "block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct);", "data->nb_sectors -= data->iov.iov_len / 512;", "data->sector += data->iov.iov_len / 512;", "data->iov.iov_len = MIN(data->nb_sectors * 512, data->iov.iov_len);", "if (data->iov.iov_len) {", "block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct,\ndata->iov.iov_len, BLOCK_ACCT_WRITE);", "qemu_iovec_init_external(&data->qiov, &data->iov, 1);", "r->req.aiocb = blk_aio_pwritev(s->qdev.conf.blk,\ndata->sector << BDRV_SECTOR_BITS,\n&data->qiov, 0,\nFUNC_0, data);", "return;", "}", "scsi_req_complete(&r->req, GOOD);", "done:\nscsi_req_unref(&r->req);", "qemu_vfree(data->iov.iov_base);", "g_free(data);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ] ]
22,406
static inline void gen_op_evslw(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) { TCGv_i32 t0; int l1, l2; l1 = gen_new_label(); l2 = gen_new_label(); t0 = tcg_temp_local_new_i32(); /* No error here: 6 bits are used */ tcg_gen_andi_i32(t0, arg2, 0x3F); tcg_gen_brcondi_i32(TCG_COND_GE, t0, 32, l1); tcg_gen_shl_i32(ret, arg1, t0); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_i32(ret, 0); gen_set_label(l2); tcg_temp_free_i32(t0); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static inline void gen_op_evslw(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) { TCGv_i32 t0; int l1, l2; l1 = gen_new_label(); l2 = gen_new_label(); t0 = tcg_temp_local_new_i32(); tcg_gen_andi_i32(t0, arg2, 0x3F); tcg_gen_brcondi_i32(TCG_COND_GE, t0, 32, l1); tcg_gen_shl_i32(ret, arg1, t0); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_i32(ret, 0); gen_set_label(l2); tcg_temp_free_i32(t0); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGv_i32 VAR_0, TCGv_i32 VAR_1, TCGv_i32 VAR_2) { TCGv_i32 t0; int VAR_3, VAR_4; VAR_3 = gen_new_label(); VAR_4 = gen_new_label(); t0 = tcg_temp_local_new_i32(); tcg_gen_andi_i32(t0, VAR_2, 0x3F); tcg_gen_brcondi_i32(TCG_COND_GE, t0, 32, VAR_3); tcg_gen_shl_i32(VAR_0, VAR_1, t0); tcg_gen_br(VAR_4); gen_set_label(VAR_3); tcg_gen_movi_i32(VAR_0, 0); gen_set_label(VAR_4); tcg_temp_free_i32(t0); }
[ "static inline void FUNC_0(TCGv_i32 VAR_0, TCGv_i32 VAR_1, TCGv_i32 VAR_2)\n{", "TCGv_i32 t0;", "int VAR_3, VAR_4;", "VAR_3 = gen_new_label();", "VAR_4 = gen_new_label();", "t0 = tcg_temp_local_new_i32();", "tcg_gen_andi_i32(t0, VAR_2, 0x3F);", "tcg_gen_brcondi_i32(TCG_COND_GE, t0, 32, VAR_3);", "tcg_gen_shl_i32(VAR_0, VAR_1, t0);", "tcg_gen_br(VAR_4);", "gen_set_label(VAR_3);", "tcg_gen_movi_i32(VAR_0, 0);", "gen_set_label(VAR_4);", "tcg_temp_free_i32(t0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
22,407
static inline void gen_efsabs(DisasContext *ctx) { if (unlikely(!ctx->spe_enabled)) { gen_exception(ctx, POWERPC_EXCP_APU); return; } tcg_gen_andi_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], (target_long)~0x80000000LL); }
false
qemu
27a69bb088bee6d4efea254659422fb9c751b3c7
static inline void gen_efsabs(DisasContext *ctx) { if (unlikely(!ctx->spe_enabled)) { gen_exception(ctx, POWERPC_EXCP_APU); return; } tcg_gen_andi_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], (target_long)~0x80000000LL); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0) { if (unlikely(!VAR_0->spe_enabled)) { gen_exception(VAR_0, POWERPC_EXCP_APU); return; } tcg_gen_andi_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)], (target_long)~0x80000000LL); }
[ "static inline void FUNC_0(DisasContext *VAR_0)\n{", "if (unlikely(!VAR_0->spe_enabled)) {", "gen_exception(VAR_0, POWERPC_EXCP_APU);", "return;", "}", "tcg_gen_andi_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)], (target_long)~0x80000000LL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
22,408
static void vfio_exitfn(PCIDevice *pdev) { VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev); vfio_unregister_err_notifier(vdev); pci_device_set_intx_routing_notifier(&vdev->pdev, NULL); vfio_disable_interrupts(vdev); if (vdev->intx.mmap_timer) { timer_free(vdev->intx.mmap_timer); } vfio_teardown_msi(vdev); vfio_unmap_bars(vdev); }
false
qemu
ba5e6bfa1aee29a8f72c5538c565dfb9889cf273
static void vfio_exitfn(PCIDevice *pdev) { VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev); vfio_unregister_err_notifier(vdev); pci_device_set_intx_routing_notifier(&vdev->pdev, NULL); vfio_disable_interrupts(vdev); if (vdev->intx.mmap_timer) { timer_free(vdev->intx.mmap_timer); } vfio_teardown_msi(vdev); vfio_unmap_bars(vdev); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIDevice *VAR_0) { VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, VAR_0, VAR_0); vfio_unregister_err_notifier(vdev); pci_device_set_intx_routing_notifier(&vdev->VAR_0, NULL); vfio_disable_interrupts(vdev); if (vdev->intx.mmap_timer) { timer_free(vdev->intx.mmap_timer); } vfio_teardown_msi(vdev); vfio_unmap_bars(vdev); }
[ "static void FUNC_0(PCIDevice *VAR_0)\n{", "VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, VAR_0, VAR_0);", "vfio_unregister_err_notifier(vdev);", "pci_device_set_intx_routing_notifier(&vdev->VAR_0, NULL);", "vfio_disable_interrupts(vdev);", "if (vdev->intx.mmap_timer) {", "timer_free(vdev->intx.mmap_timer);", "}", "vfio_teardown_msi(vdev);", "vfio_unmap_bars(vdev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
22,409
static uint64_t vgafb_read(void *opaque, target_phys_addr_t addr, unsigned size) { MilkymistVgafbState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_CTRL: case R_HRES: case R_HSYNC_START: case R_HSYNC_END: case R_HSCAN: case R_VRES: case R_VSYNC_START: case R_VSYNC_END: case R_VSCAN: case R_BASEADDRESS: case R_BURST_COUNT: case R_DDC: case R_SOURCE_CLOCK: r = s->regs[addr]; break; case R_BASEADDRESS_ACT: r = s->regs[R_BASEADDRESS]; break; default: error_report("milkymist_vgafb: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_milkymist_vgafb_memory_read(addr << 2, r); return r; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t vgafb_read(void *opaque, target_phys_addr_t addr, unsigned size) { MilkymistVgafbState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_CTRL: case R_HRES: case R_HSYNC_START: case R_HSYNC_END: case R_HSCAN: case R_VRES: case R_VSYNC_START: case R_VSYNC_END: case R_VSCAN: case R_BASEADDRESS: case R_BURST_COUNT: case R_DDC: case R_SOURCE_CLOCK: r = s->regs[addr]; break; case R_BASEADDRESS_ACT: r = s->regs[R_BASEADDRESS]; break; default: error_report("milkymist_vgafb: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_milkymist_vgafb_memory_read(addr << 2, r); return r; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { MilkymistVgafbState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_CTRL: case R_HRES: case R_HSYNC_START: case R_HSYNC_END: case R_HSCAN: case R_VRES: case R_VSYNC_START: case R_VSYNC_END: case R_VSCAN: case R_BASEADDRESS: case R_BURST_COUNT: case R_DDC: case R_SOURCE_CLOCK: r = s->regs[addr]; break; case R_BASEADDRESS_ACT: r = s->regs[R_BASEADDRESS]; break; default: error_report("milkymist_vgafb: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_milkymist_vgafb_memory_read(addr << 2, r); return r; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "MilkymistVgafbState *s = opaque;", "uint32_t r = 0;", "addr >>= 2;", "switch (addr) {", "case R_CTRL:\ncase R_HRES:\ncase R_HSYNC_START:\ncase R_HSYNC_END:\ncase R_HSCAN:\ncase R_VRES:\ncase R_VSYNC_START:\ncase R_VSYNC_END:\ncase R_VSCAN:\ncase R_BASEADDRESS:\ncase R_BURST_COUNT:\ncase R_DDC:\ncase R_SOURCE_CLOCK:\nr = s->regs[addr];", "break;", "case R_BASEADDRESS_ACT:\nr = s->regs[R_BASEADDRESS];", "break;", "default:\nerror_report(\"milkymist_vgafb: read access to unknown register 0x\"\nTARGET_FMT_plx, addr << 2);", "break;", "}", "trace_milkymist_vgafb_memory_read(addr << 2, r);", "return r;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ] ]
22,410
static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, int flags, FsCred *credp, V9fsFidOpenState *fs) { char *path; int fd = -1; int err = -1; int serrno = 0; V9fsString fullname; char buffer[PATH_MAX]; /* * Mark all the open to not follow symlinks */ flags |= O_NOFOLLOW; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name); path = fullname.data; /* Determine the security model */ if (fs_ctx->export_flags & V9FS_SM_MAPPED) { fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS); if (fd == -1) { err = fd; goto out; } credp->fc_mode = credp->fc_mode|S_IFREG; /* Set cleint credentials in xattr */ err = local_set_xattr(rpath(fs_ctx, path, buffer), credp); if (err == -1) { serrno = errno; goto err_end; } } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS); if (fd == -1) { err = fd; goto out; } credp->fc_mode = credp->fc_mode|S_IFREG; /* Set client credentials in .virtfs_metadata directory files */ err = local_set_mapped_file_attr(fs_ctx, path, credp); if (err == -1) { serrno = errno; goto err_end; } } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { fd = open(rpath(fs_ctx, path, buffer), flags, credp->fc_mode); if (fd == -1) { err = fd; goto out; } err = local_post_create_passthrough(fs_ctx, path, credp); if (err == -1) { serrno = errno; goto err_end; } } err = fd; fs->fd = fd; goto out; err_end: close(fd); remove(rpath(fs_ctx, path, buffer)); errno = serrno; out: v9fs_string_free(&fullname); return err; }
false
qemu
4fa4ce7107c6ec432f185307158c5df91ce54308
static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, int flags, FsCred *credp, V9fsFidOpenState *fs) { char *path; int fd = -1; int err = -1; int serrno = 0; V9fsString fullname; char buffer[PATH_MAX]; flags |= O_NOFOLLOW; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name); path = fullname.data; if (fs_ctx->export_flags & V9FS_SM_MAPPED) { fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS); if (fd == -1) { err = fd; goto out; } credp->fc_mode = credp->fc_mode|S_IFREG; err = local_set_xattr(rpath(fs_ctx, path, buffer), credp); if (err == -1) { serrno = errno; goto err_end; } } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS); if (fd == -1) { err = fd; goto out; } credp->fc_mode = credp->fc_mode|S_IFREG; err = local_set_mapped_file_attr(fs_ctx, path, credp); if (err == -1) { serrno = errno; goto err_end; } } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { fd = open(rpath(fs_ctx, path, buffer), flags, credp->fc_mode); if (fd == -1) { err = fd; goto out; } err = local_post_create_passthrough(fs_ctx, path, credp); if (err == -1) { serrno = errno; goto err_end; } } err = fd; fs->fd = fd; goto out; err_end: close(fd); remove(rpath(fs_ctx, path, buffer)); errno = serrno; out: v9fs_string_free(&fullname); return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const char *VAR_2, int VAR_3, FsCred *VAR_4, V9fsFidOpenState *VAR_5) { char *VAR_6; int VAR_7 = -1; int VAR_8 = -1; int VAR_9 = 0; V9fsString fullname; char VAR_10[PATH_MAX]; VAR_3 |= O_NOFOLLOW; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2); VAR_6 = fullname.data; if (VAR_0->export_flags & V9FS_SM_MAPPED) { VAR_7 = open(rpath(VAR_0, VAR_6, VAR_10), VAR_3, SM_LOCAL_MODE_BITS); if (VAR_7 == -1) { VAR_8 = VAR_7; goto out; } VAR_4->fc_mode = VAR_4->fc_mode|S_IFREG; VAR_8 = local_set_xattr(rpath(VAR_0, VAR_6, VAR_10), VAR_4); if (VAR_8 == -1) { VAR_9 = errno; goto err_end; } } else if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) { VAR_7 = open(rpath(VAR_0, VAR_6, VAR_10), VAR_3, SM_LOCAL_MODE_BITS); if (VAR_7 == -1) { VAR_8 = VAR_7; goto out; } VAR_4->fc_mode = VAR_4->fc_mode|S_IFREG; VAR_8 = local_set_mapped_file_attr(VAR_0, VAR_6, VAR_4); if (VAR_8 == -1) { VAR_9 = errno; goto err_end; } } else if ((VAR_0->export_flags & V9FS_SM_PASSTHROUGH) || (VAR_0->export_flags & V9FS_SM_NONE)) { VAR_7 = open(rpath(VAR_0, VAR_6, VAR_10), VAR_3, VAR_4->fc_mode); if (VAR_7 == -1) { VAR_8 = VAR_7; goto out; } VAR_8 = local_post_create_passthrough(VAR_0, VAR_6, VAR_4); if (VAR_8 == -1) { VAR_9 = errno; goto err_end; } } VAR_8 = VAR_7; VAR_5->VAR_7 = VAR_7; goto out; err_end: close(VAR_7); remove(rpath(VAR_0, VAR_6, VAR_10)); errno = VAR_9; out: v9fs_string_free(&fullname); return VAR_8; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const char *VAR_2,\nint VAR_3, FsCred *VAR_4, V9fsFidOpenState *VAR_5)\n{", "char *VAR_6;", "int VAR_7 = -1;", "int VAR_8 = -1;", "int VAR_9 = 0;", "V9fsString fullname;", "char VAR_10[PATH_MAX];", "VAR_3 |= O_NOFOLLOW;", "v9fs_string_init(&fullname);", "v9fs_string_sprintf(&fullname, \"%s/%s\", VAR_1->data, VAR_2);", "VAR_6 = fullname.data;", "if (VAR_0->export_flags & V9FS_SM_MAPPED) {", "VAR_7 = open(rpath(VAR_0, VAR_6, VAR_10), VAR_3, SM_LOCAL_MODE_BITS);", "if (VAR_7 == -1) {", "VAR_8 = VAR_7;", "goto out;", "}", "VAR_4->fc_mode = VAR_4->fc_mode|S_IFREG;", "VAR_8 = local_set_xattr(rpath(VAR_0, VAR_6, VAR_10), VAR_4);", "if (VAR_8 == -1) {", "VAR_9 = errno;", "goto err_end;", "}", "} else if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) {", "VAR_7 = open(rpath(VAR_0, VAR_6, VAR_10), VAR_3, SM_LOCAL_MODE_BITS);", "if (VAR_7 == -1) {", "VAR_8 = VAR_7;", "goto out;", "}", "VAR_4->fc_mode = VAR_4->fc_mode|S_IFREG;", "VAR_8 = local_set_mapped_file_attr(VAR_0, VAR_6, VAR_4);", "if (VAR_8 == -1) {", "VAR_9 = errno;", "goto err_end;", "}", "} else if ((VAR_0->export_flags & V9FS_SM_PASSTHROUGH) ||", "(VAR_0->export_flags & V9FS_SM_NONE)) {", "VAR_7 = open(rpath(VAR_0, VAR_6, VAR_10), VAR_3, VAR_4->fc_mode);", "if (VAR_7 == -1) {", "VAR_8 = VAR_7;", "goto out;", "}", "VAR_8 = local_post_create_passthrough(VAR_0, VAR_6, VAR_4);", "if (VAR_8 == -1) {", "VAR_9 = errno;", "goto err_end;", "}", "}", "VAR_8 = VAR_7;", "VAR_5->VAR_7 = VAR_7;", "goto out;", "err_end:\nclose(VAR_7);", "remove(rpath(VAR_0, VAR_6, VAR_10));", "errno = VAR_9;", "out:\nv9fs_string_free(&fullname);", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ] ]
22,411
static int realloc_refcount_array(BDRVQcow2State *s, void **array, int64_t *size, int64_t new_size) { size_t old_byte_size, new_byte_size; void *new_ptr; /* Round to clusters so the array can be directly written to disk */ old_byte_size = size_to_clusters(s, refcount_array_byte_size(s, *size)) * s->cluster_size; new_byte_size = size_to_clusters(s, refcount_array_byte_size(s, new_size)) * s->cluster_size; if (new_byte_size == old_byte_size) { *size = new_size; return 0; } assert(new_byte_size > 0); new_ptr = g_try_realloc(*array, new_byte_size); if (!new_ptr) { return -ENOMEM; } if (new_byte_size > old_byte_size) { memset((void *)((uintptr_t)new_ptr + old_byte_size), 0, new_byte_size - old_byte_size); } *array = new_ptr; *size = new_size; return 0; }
false
qemu
b6d36def6d9e9fd187327182d0abafc9b7085d8f
static int realloc_refcount_array(BDRVQcow2State *s, void **array, int64_t *size, int64_t new_size) { size_t old_byte_size, new_byte_size; void *new_ptr; old_byte_size = size_to_clusters(s, refcount_array_byte_size(s, *size)) * s->cluster_size; new_byte_size = size_to_clusters(s, refcount_array_byte_size(s, new_size)) * s->cluster_size; if (new_byte_size == old_byte_size) { *size = new_size; return 0; } assert(new_byte_size > 0); new_ptr = g_try_realloc(*array, new_byte_size); if (!new_ptr) { return -ENOMEM; } if (new_byte_size > old_byte_size) { memset((void *)((uintptr_t)new_ptr + old_byte_size), 0, new_byte_size - old_byte_size); } *array = new_ptr; *size = new_size; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BDRVQcow2State *VAR_0, void **VAR_1, int64_t *VAR_2, int64_t VAR_3) { size_t old_byte_size, new_byte_size; void *VAR_4; old_byte_size = size_to_clusters(VAR_0, refcount_array_byte_size(VAR_0, *VAR_2)) * VAR_0->cluster_size; new_byte_size = size_to_clusters(VAR_0, refcount_array_byte_size(VAR_0, VAR_3)) * VAR_0->cluster_size; if (new_byte_size == old_byte_size) { *VAR_2 = VAR_3; return 0; } assert(new_byte_size > 0); VAR_4 = g_try_realloc(*VAR_1, new_byte_size); if (!VAR_4) { return -ENOMEM; } if (new_byte_size > old_byte_size) { memset((void *)((uintptr_t)VAR_4 + old_byte_size), 0, new_byte_size - old_byte_size); } *VAR_1 = VAR_4; *VAR_2 = VAR_3; return 0; }
[ "static int FUNC_0(BDRVQcow2State *VAR_0, void **VAR_1,\nint64_t *VAR_2, int64_t VAR_3)\n{", "size_t old_byte_size, new_byte_size;", "void *VAR_4;", "old_byte_size = size_to_clusters(VAR_0, refcount_array_byte_size(VAR_0, *VAR_2))\n* VAR_0->cluster_size;", "new_byte_size = size_to_clusters(VAR_0, refcount_array_byte_size(VAR_0, VAR_3))\n* VAR_0->cluster_size;", "if (new_byte_size == old_byte_size) {", "*VAR_2 = VAR_3;", "return 0;", "}", "assert(new_byte_size > 0);", "VAR_4 = g_try_realloc(*VAR_1, new_byte_size);", "if (!VAR_4) {", "return -ENOMEM;", "}", "if (new_byte_size > old_byte_size) {", "memset((void *)((uintptr_t)VAR_4 + old_byte_size), 0,\nnew_byte_size - old_byte_size);", "}", "*VAR_1 = VAR_4;", "*VAR_2 = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15, 17 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
22,412
Coroutine *qemu_coroutine_new(void) { CoroutineThreadState *s = coroutine_get_thread_state(); Coroutine *co; co = QLIST_FIRST(&s->pool); if (co) { QLIST_REMOVE(co, pool_next); s->pool_size--; } else { co = coroutine_new(); } return co; }
false
qemu
39a7a362e16bb27e98738d63f24d1ab5811e26a8
Coroutine *qemu_coroutine_new(void) { CoroutineThreadState *s = coroutine_get_thread_state(); Coroutine *co; co = QLIST_FIRST(&s->pool); if (co) { QLIST_REMOVE(co, pool_next); s->pool_size--; } else { co = coroutine_new(); } return co; }
{ "code": [], "line_no": [] }
Coroutine *FUNC_0(void) { CoroutineThreadState *s = coroutine_get_thread_state(); Coroutine *co; co = QLIST_FIRST(&s->pool); if (co) { QLIST_REMOVE(co, pool_next); s->pool_size--; } else { co = coroutine_new(); } return co; }
[ "Coroutine *FUNC_0(void)\n{", "CoroutineThreadState *s = coroutine_get_thread_state();", "Coroutine *co;", "co = QLIST_FIRST(&s->pool);", "if (co) {", "QLIST_REMOVE(co, pool_next);", "s->pool_size--;", "} else {", "co = coroutine_new();", "}", "return co;", "}" ]
[ 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 ] ]
22,414
static uint64_t qemu_next_deadline_dyntick(void) { int64_t delta; int64_t rtdelta; if (use_icount) delta = INT32_MAX; else delta = (qemu_next_deadline() + 999) / 1000; if (active_timers[QEMU_TIMER_REALTIME]) { rtdelta = (active_timers[QEMU_TIMER_REALTIME]->expire_time - qemu_get_clock(rt_clock))*1000; if (rtdelta < delta) delta = rtdelta; } if (delta < MIN_TIMER_REARM_US) delta = MIN_TIMER_REARM_US; return delta; }
false
qemu
0fdddf80a88ac2efe068990d1878f472bb6b95d9
static uint64_t qemu_next_deadline_dyntick(void) { int64_t delta; int64_t rtdelta; if (use_icount) delta = INT32_MAX; else delta = (qemu_next_deadline() + 999) / 1000; if (active_timers[QEMU_TIMER_REALTIME]) { rtdelta = (active_timers[QEMU_TIMER_REALTIME]->expire_time - qemu_get_clock(rt_clock))*1000; if (rtdelta < delta) delta = rtdelta; } if (delta < MIN_TIMER_REARM_US) delta = MIN_TIMER_REARM_US; return delta; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void) { int64_t delta; int64_t rtdelta; if (use_icount) delta = INT32_MAX; else delta = (qemu_next_deadline() + 999) / 1000; if (active_timers[QEMU_TIMER_REALTIME]) { rtdelta = (active_timers[QEMU_TIMER_REALTIME]->expire_time - qemu_get_clock(rt_clock))*1000; if (rtdelta < delta) delta = rtdelta; } if (delta < MIN_TIMER_REARM_US) delta = MIN_TIMER_REARM_US; return delta; }
[ "static uint64_t FUNC_0(void)\n{", "int64_t delta;", "int64_t rtdelta;", "if (use_icount)\ndelta = INT32_MAX;", "else\ndelta = (qemu_next_deadline() + 999) / 1000;", "if (active_timers[QEMU_TIMER_REALTIME]) {", "rtdelta = (active_timers[QEMU_TIMER_REALTIME]->expire_time -\nqemu_get_clock(rt_clock))*1000;", "if (rtdelta < delta)\ndelta = rtdelta;", "}", "if (delta < MIN_TIMER_REARM_US)\ndelta = MIN_TIMER_REARM_US;", "return delta;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 35, 37 ], [ 41 ], [ 43 ] ]
22,416
int ff_aac_ac3_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { AACAC3ParseContext *s = s1->priv_data; const uint8_t *buf_ptr; int len, sample_rate, bit_rate, channels, samples; *poutbuf = NULL; *poutbuf_size = 0; buf_ptr = buf; while (buf_size > 0) { int size_needed= s->frame_size ? s->frame_size : s->header_size; len = s->inbuf_ptr - s->inbuf; if(len<size_needed){ len = FFMIN(size_needed - len, buf_size); memcpy(s->inbuf_ptr, buf_ptr, len); buf_ptr += len; s->inbuf_ptr += len; buf_size -= len; } if (s->frame_size == 0) { if ((s->inbuf_ptr - s->inbuf) == s->header_size) { len = s->sync(s->inbuf, &channels, &sample_rate, &bit_rate, &samples); if (len == 0) { /* no sync found : move by one byte (inefficient, but simple!) */ memmove(s->inbuf, s->inbuf + 1, s->header_size - 1); s->inbuf_ptr--; } else { s->frame_size = len; /* update codec info */ avctx->sample_rate = sample_rate; avctx->channels = channels; /* allow downmixing to mono or stereo for AC3 */ if(avctx->request_channels > 0 && avctx->request_channels < channels && avctx->request_channels <= 2 && avctx->codec_id == CODEC_ID_AC3) { avctx->channels = avctx->request_channels; } avctx->bit_rate = bit_rate; avctx->frame_size = samples; } } } else { if(s->inbuf_ptr - s->inbuf == s->frame_size){ *poutbuf = s->inbuf; *poutbuf_size = s->frame_size; s->inbuf_ptr = s->inbuf; s->frame_size = 0; break; } } } return buf_ptr - buf; }
false
FFmpeg
6cd325c1064c80f47b596f3b2bea24f227b198f2
int ff_aac_ac3_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { AACAC3ParseContext *s = s1->priv_data; const uint8_t *buf_ptr; int len, sample_rate, bit_rate, channels, samples; *poutbuf = NULL; *poutbuf_size = 0; buf_ptr = buf; while (buf_size > 0) { int size_needed= s->frame_size ? s->frame_size : s->header_size; len = s->inbuf_ptr - s->inbuf; if(len<size_needed){ len = FFMIN(size_needed - len, buf_size); memcpy(s->inbuf_ptr, buf_ptr, len); buf_ptr += len; s->inbuf_ptr += len; buf_size -= len; } if (s->frame_size == 0) { if ((s->inbuf_ptr - s->inbuf) == s->header_size) { len = s->sync(s->inbuf, &channels, &sample_rate, &bit_rate, &samples); if (len == 0) { memmove(s->inbuf, s->inbuf + 1, s->header_size - 1); s->inbuf_ptr--; } else { s->frame_size = len; avctx->sample_rate = sample_rate; avctx->channels = channels; if(avctx->request_channels > 0 && avctx->request_channels < channels && avctx->request_channels <= 2 && avctx->codec_id == CODEC_ID_AC3) { avctx->channels = avctx->request_channels; } avctx->bit_rate = bit_rate; avctx->frame_size = samples; } } } else { if(s->inbuf_ptr - s->inbuf == s->frame_size){ *poutbuf = s->inbuf; *poutbuf_size = s->frame_size; s->inbuf_ptr = s->inbuf; s->frame_size = 0; break; } } } return buf_ptr - buf; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t **VAR_2, int *VAR_3, const uint8_t *VAR_4, int VAR_5) { AACAC3ParseContext *s = VAR_0->priv_data; const uint8_t *VAR_6; int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; *VAR_2 = NULL; *VAR_3 = 0; VAR_6 = VAR_4; while (VAR_5 > 0) { int VAR_12= s->frame_size ? s->frame_size : s->header_size; VAR_7 = s->inbuf_ptr - s->inbuf; if(VAR_7<VAR_12){ VAR_7 = FFMIN(VAR_12 - VAR_7, VAR_5); memcpy(s->inbuf_ptr, VAR_6, VAR_7); VAR_6 += VAR_7; s->inbuf_ptr += VAR_7; VAR_5 -= VAR_7; } if (s->frame_size == 0) { if ((s->inbuf_ptr - s->inbuf) == s->header_size) { VAR_7 = s->sync(s->inbuf, &VAR_10, &VAR_8, &VAR_9, &VAR_11); if (VAR_7 == 0) { memmove(s->inbuf, s->inbuf + 1, s->header_size - 1); s->inbuf_ptr--; } else { s->frame_size = VAR_7; VAR_1->VAR_8 = VAR_8; VAR_1->VAR_10 = VAR_10; if(VAR_1->request_channels > 0 && VAR_1->request_channels < VAR_10 && VAR_1->request_channels <= 2 && VAR_1->codec_id == CODEC_ID_AC3) { VAR_1->VAR_10 = VAR_1->request_channels; } VAR_1->VAR_9 = VAR_9; VAR_1->frame_size = VAR_11; } } } else { if(s->inbuf_ptr - s->inbuf == s->frame_size){ *VAR_2 = s->inbuf; *VAR_3 = s->frame_size; s->inbuf_ptr = s->inbuf; s->frame_size = 0; break; } } } return VAR_6 - VAR_4; }
[ "int FUNC_0(AVCodecParserContext *VAR_0,\nAVCodecContext *VAR_1,\nconst uint8_t **VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{", "AACAC3ParseContext *s = VAR_0->priv_data;", "const uint8_t *VAR_6;", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "*VAR_2 = NULL;", "*VAR_3 = 0;", "VAR_6 = VAR_4;", "while (VAR_5 > 0) {", "int VAR_12= s->frame_size ? s->frame_size : s->header_size;", "VAR_7 = s->inbuf_ptr - s->inbuf;", "if(VAR_7<VAR_12){", "VAR_7 = FFMIN(VAR_12 - VAR_7, VAR_5);", "memcpy(s->inbuf_ptr, VAR_6, VAR_7);", "VAR_6 += VAR_7;", "s->inbuf_ptr += VAR_7;", "VAR_5 -= VAR_7;", "}", "if (s->frame_size == 0) {", "if ((s->inbuf_ptr - s->inbuf) == s->header_size) {", "VAR_7 = s->sync(s->inbuf, &VAR_10, &VAR_8, &VAR_9,\n&VAR_11);", "if (VAR_7 == 0) {", "memmove(s->inbuf, s->inbuf + 1, s->header_size - 1);", "s->inbuf_ptr--;", "} else {", "s->frame_size = VAR_7;", "VAR_1->VAR_8 = VAR_8;", "VAR_1->VAR_10 = VAR_10;", "if(VAR_1->request_channels > 0 &&\nVAR_1->request_channels < VAR_10 &&\nVAR_1->request_channels <= 2 &&\nVAR_1->codec_id == CODEC_ID_AC3) {", "VAR_1->VAR_10 = VAR_1->request_channels;", "}", "VAR_1->VAR_9 = VAR_9;", "VAR_1->frame_size = VAR_11;", "}", "}", "} else {", "if(s->inbuf_ptr - s->inbuf == s->frame_size){", "*VAR_2 = s->inbuf;", "*VAR_3 = s->frame_size;", "s->inbuf_ptr = s->inbuf;", "s->frame_size = 0;", "break;", "}", "}", "}", "return VAR_6 - 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79, 81, 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ] ]
22,419
static uint32_t virtio_net_get_features(VirtIODevice *vdev) { uint32_t features = (1 << VIRTIO_NET_F_MAC); return features; }
false
qemu
554c97dd43e021b626c78ed5bd72bca33d5cb99c
static uint32_t virtio_net_get_features(VirtIODevice *vdev) { uint32_t features = (1 << VIRTIO_NET_F_MAC); return features; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(VirtIODevice *vdev) { uint32_t features = (1 << VIRTIO_NET_F_MAC); return features; }
[ "static uint32_t FUNC_0(VirtIODevice *vdev)\n{", "uint32_t features = (1 << VIRTIO_NET_F_MAC);", "return features;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
22,420
static void s390_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) { CPUState *env = NULL; ram_addr_t ram_addr; ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int i; /* XXX we only work on KVM for now */ if (!kvm_enabled()) { fprintf(stderr, "The S390 target only works with KVM enabled\n"); exit(1); } /* get a BUS */ s390_bus = s390_virtio_bus_init(&ram_size); /* allocate RAM */ ram_addr = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0, ram_size, ram_addr); /* init CPUs */ if (cpu_model == NULL) { cpu_model = "host"; } ipi_states = qemu_malloc(sizeof(CPUState *) * smp_cpus); for (i = 0; i < smp_cpus; i++) { CPUState *tmp_env; tmp_env = cpu_init(cpu_model); if (!env) { env = tmp_env; } ipi_states[i] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; } env->halted = 0; env->exception_index = 0; if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); if (lduw_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *bios_filename; /* Load zipl bootloader */ if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset)); stq_phys(INITRD_PARM_START, initrd_offset); stq_phys(INITRD_PARM_SIZE, initrd_size); } if (kernel_cmdline) { cpu_physical_memory_rw(KERN_PARM_AREA, (uint8_t *)kernel_cmdline, strlen(kernel_cmdline), 1); } /* Create VirtIO network adapters */ for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; DeviceState *dev; if (!nd->model) { nd->model = qemu_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } /* Create VirtIO disk drives */ for(i = 0; i < MAX_BLK_DEVS; i++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, i); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive(dev, "drive", dinfo); qdev_init_nofail(dev); } }
false
qemu
f8b6cc0070aab8b75bd082582c829be1353f395f
static void s390_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) { CPUState *env = NULL; ram_addr_t ram_addr; ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int i; if (!kvm_enabled()) { fprintf(stderr, "The S390 target only works with KVM enabled\n"); exit(1); } s390_bus = s390_virtio_bus_init(&ram_size); ram_addr = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0, ram_size, ram_addr); if (cpu_model == NULL) { cpu_model = "host"; } ipi_states = qemu_malloc(sizeof(CPUState *) * smp_cpus); for (i = 0; i < smp_cpus; i++) { CPUState *tmp_env; tmp_env = cpu_init(cpu_model); if (!env) { env = tmp_env; } ipi_states[i] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; } env->halted = 0; env->exception_index = 0; if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); if (lduw_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *bios_filename; if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset)); stq_phys(INITRD_PARM_START, initrd_offset); stq_phys(INITRD_PARM_SIZE, initrd_size); } if (kernel_cmdline) { cpu_physical_memory_rw(KERN_PARM_AREA, (uint8_t *)kernel_cmdline, strlen(kernel_cmdline), 1); } for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; DeviceState *dev; if (!nd->model) { nd->model = qemu_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } for(i = 0; i < MAX_BLK_DEVS; i++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, i); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive(dev, "drive", dinfo); qdev_init_nofail(dev); } }
{ "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) { CPUState *env = NULL; ram_addr_t ram_addr; ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int VAR_6; if (!kvm_enabled()) { fprintf(stderr, "The S390 target only works with KVM enabled\n"); exit(1); } s390_bus = s390_virtio_bus_init(&VAR_0); ram_addr = qemu_ram_alloc(VAR_0); cpu_register_physical_memory(0, VAR_0, ram_addr); if (VAR_5 == NULL) { VAR_5 = "host"; } ipi_states = qemu_malloc(sizeof(CPUState *) * smp_cpus); for (VAR_6 = 0; VAR_6 < smp_cpus; VAR_6++) { CPUState *tmp_env; tmp_env = cpu_init(VAR_5); if (!env) { env = tmp_env; } ipi_states[VAR_6] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; } env->halted = 0; env->exception_index = 0; if (VAR_2) { kernel_size = load_image(VAR_2, qemu_get_ram_ptr(0)); if (lduw_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *VAR_7; if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(VAR_7, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (VAR_4) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(VAR_4, qemu_get_ram_ptr(initrd_offset)); stq_phys(INITRD_PARM_START, initrd_offset); stq_phys(INITRD_PARM_SIZE, initrd_size); } if (VAR_3) { cpu_physical_memory_rw(KERN_PARM_AREA, (uint8_t *)VAR_3, strlen(VAR_3), 1); } for(VAR_6 = 0; VAR_6 < nb_nics; VAR_6++) { NICInfo *nd = &nd_table[VAR_6]; DeviceState *dev; if (!nd->model) { nd->model = qemu_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } for(VAR_6 = 0; VAR_6 < MAX_BLK_DEVS; VAR_6++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, VAR_6); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive(dev, "drive", dinfo); qdev_init_nofail(dev); } }
[ "static void FUNC_0(ram_addr_t VAR_0,\nconst char *VAR_1,\nconst char *VAR_2,\nconst char *VAR_3,\nconst char *VAR_4,\nconst char *VAR_5)\n{", "CPUState *env = NULL;", "ram_addr_t ram_addr;", "ram_addr_t kernel_size = 0;", "ram_addr_t initrd_offset;", "ram_addr_t initrd_size = 0;", "int VAR_6;", "if (!kvm_enabled()) {", "fprintf(stderr, \"The S390 target only works with KVM enabled\\n\");", "exit(1);", "}", "s390_bus = s390_virtio_bus_init(&VAR_0);", "ram_addr = qemu_ram_alloc(VAR_0);", "cpu_register_physical_memory(0, VAR_0, ram_addr);", "if (VAR_5 == NULL) {", "VAR_5 = \"host\";", "}", "ipi_states = qemu_malloc(sizeof(CPUState *) * smp_cpus);", "for (VAR_6 = 0; VAR_6 < smp_cpus; VAR_6++) {", "CPUState *tmp_env;", "tmp_env = cpu_init(VAR_5);", "if (!env) {", "env = tmp_env;", "}", "ipi_states[VAR_6] = tmp_env;", "tmp_env->halted = 1;", "tmp_env->exception_index = EXCP_HLT;", "}", "env->halted = 0;", "env->exception_index = 0;", "if (VAR_2) {", "kernel_size = load_image(VAR_2, qemu_get_ram_ptr(0));", "if (lduw_phys(KERN_IMAGE_START) != 0x0dd0) {", "fprintf(stderr, \"Specified image is not an s390 boot image\\n\");", "exit(1);", "}", "env->psw.addr = KERN_IMAGE_START;", "env->psw.mask = 0x0000000180000000ULL;", "} else {", "ram_addr_t bios_size = 0;", "char *VAR_7;", "if (bios_name == NULL) {", "bios_name = ZIPL_FILENAME;", "}", "VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "bios_size = load_image(VAR_7, qemu_get_ram_ptr(ZIPL_LOAD_ADDR));", "if ((long)bios_size < 0) {", "hw_error(\"could not load bootloader '%s'\\n\", bios_name);", "}", "if (bios_size > 4096) {", "hw_error(\"stage1 bootloader is > 4k\\n\");", "}", "env->psw.addr = ZIPL_START;", "env->psw.mask = 0x0000000180000000ULL;", "}", "if (VAR_4) {", "initrd_offset = INITRD_START;", "while (kernel_size + 0x100000 > initrd_offset) {", "initrd_offset += 0x100000;", "}", "initrd_size = load_image(VAR_4, qemu_get_ram_ptr(initrd_offset));", "stq_phys(INITRD_PARM_START, initrd_offset);", "stq_phys(INITRD_PARM_SIZE, initrd_size);", "}", "if (VAR_3) {", "cpu_physical_memory_rw(KERN_PARM_AREA, (uint8_t *)VAR_3,\nstrlen(VAR_3), 1);", "}", "for(VAR_6 = 0; VAR_6 < nb_nics; VAR_6++) {", "NICInfo *nd = &nd_table[VAR_6];", "DeviceState *dev;", "if (!nd->model) {", "nd->model = qemu_strdup(\"virtio\");", "}", "if (strcmp(nd->model, \"virtio\")) {", "fprintf(stderr, \"S390 only supports VirtIO nics\\n\");", "exit(1);", "}", "dev = qdev_create((BusState *)s390_bus, \"virtio-net-s390\");", "qdev_set_nic_properties(dev, nd);", "qdev_init_nofail(dev);", "}", "for(VAR_6 = 0; VAR_6 < MAX_BLK_DEVS; VAR_6++) {", "DriveInfo *dinfo;", "DeviceState *dev;", "dinfo = drive_get(IF_IDE, 0, VAR_6);", "if (!dinfo) {", "continue;", "}", "dev = qdev_create((BusState *)s390_bus, \"virtio-blk-s390\");", "qdev_prop_set_drive(dev, \"drive\", dinfo);", "qdev_init_nofail(dev);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 51 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ] ]
22,422
static void decode_opc(CPUMIPSState *env, DisasContext *ctx) { int32_t offset; int rs, rt, rd, sa; uint32_t op, op1; int16_t imm; /* make sure instructions are on a word boundary */ if (ctx->pc & 0x3) { env->CP0_BadVAddr = ctx->pc; generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL); return; } /* Handle blikely not taken case */ if ((ctx->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) { TCGLabel *l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1); tcg_gen_movi_i32(hflags, ctx->hflags & ~MIPS_HFLAG_BMASK); gen_goto_tb(ctx, 1, ctx->pc + 4); gen_set_label(l1); } op = MASK_OP_MAJOR(ctx->opcode); rs = (ctx->opcode >> 21) & 0x1f; rt = (ctx->opcode >> 16) & 0x1f; rd = (ctx->opcode >> 11) & 0x1f; sa = (ctx->opcode >> 6) & 0x1f; imm = (int16_t)ctx->opcode; switch (op) { case OPC_SPECIAL: decode_opc_special(env, ctx); break; case OPC_SPECIAL2: decode_opc_special2_legacy(env, ctx); break; case OPC_SPECIAL3: decode_opc_special3(env, ctx); break; case OPC_REGIMM: op1 = MASK_REGIMM(ctx->opcode); switch (op1) { case OPC_BLTZL: /* REGIMM branches */ case OPC_BGEZL: case OPC_BLTZALL: case OPC_BGEZALL: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); /* Fallthrough */ case OPC_BLTZ: case OPC_BGEZ: gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2, 4); break; case OPC_BLTZAL: case OPC_BGEZAL: if (ctx->insn_flags & ISA_MIPS32R6) { if (rs == 0) { /* OPC_NAL, OPC_BAL */ gen_compute_branch(ctx, op1, 4, 0, -1, imm << 2, 4); } else { generate_exception_end(ctx, EXCP_RI); } } else { gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2, 4); } break; case OPC_TGEI ... OPC_TEQI: /* REGIMM traps */ case OPC_TNEI: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_trap(ctx, op1, rs, -1, imm); break; case OPC_SIGRIE: check_insn(ctx, ISA_MIPS32R6); generate_exception_end(ctx, EXCP_RI); break; case OPC_SYNCI: check_insn(ctx, ISA_MIPS32R2); /* Break the TB to be able to sync copied instructions immediately */ ctx->bstate = BS_STOP; break; case OPC_BPOSGE32: /* MIPS DSP branch */ #if defined(TARGET_MIPS64) case OPC_BPOSGE64: #endif check_dsp(ctx); gen_compute_branch(ctx, op1, 4, -1, -2, (int32_t)imm << 2, 4); break; #if defined(TARGET_MIPS64) case OPC_DAHI: check_insn(ctx, ISA_MIPS32R6); check_mips_64(ctx); if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rs], cpu_gpr[rs], (int64_t)imm << 32); } break; case OPC_DATI: check_insn(ctx, ISA_MIPS32R6); check_mips_64(ctx); if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rs], cpu_gpr[rs], (int64_t)imm << 48); } break; #endif default: /* Invalid */ MIPS_INVAL("regimm"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_CP0: check_cp0_enabled(ctx); op1 = MASK_CP0(ctx->opcode); switch (op1) { case OPC_MFC0: case OPC_MTC0: case OPC_MFTR: case OPC_MTTR: case OPC_MFHC0: case OPC_MTHC0: #if defined(TARGET_MIPS64) case OPC_DMFC0: case OPC_DMTC0: #endif #ifndef CONFIG_USER_ONLY gen_cp0(env, ctx, op1, rt, rd); #endif /* !CONFIG_USER_ONLY */ break; case OPC_C0_FIRST ... OPC_C0_LAST: #ifndef CONFIG_USER_ONLY gen_cp0(env, ctx, MASK_C0(ctx->opcode), rt, rd); #endif /* !CONFIG_USER_ONLY */ break; case OPC_MFMC0: #ifndef CONFIG_USER_ONLY { uint32_t op2; TCGv t0 = tcg_temp_new(); op2 = MASK_MFMC0(ctx->opcode); switch (op2) { case OPC_DMT: check_insn(ctx, ASE_MT); gen_helper_dmt(t0); gen_store_gpr(t0, rt); break; case OPC_EMT: check_insn(ctx, ASE_MT); gen_helper_emt(t0); gen_store_gpr(t0, rt); break; case OPC_DVPE: check_insn(ctx, ASE_MT); gen_helper_dvpe(t0, cpu_env); gen_store_gpr(t0, rt); break; case OPC_EVPE: check_insn(ctx, ASE_MT); gen_helper_evpe(t0, cpu_env); gen_store_gpr(t0, rt); break; case OPC_DVP: check_insn(ctx, ISA_MIPS32R6); if (ctx->vp) { gen_helper_dvp(t0, cpu_env); gen_store_gpr(t0, rt); } break; case OPC_EVP: check_insn(ctx, ISA_MIPS32R6); if (ctx->vp) { gen_helper_evp(t0, cpu_env); gen_store_gpr(t0, rt); } break; case OPC_DI: check_insn(ctx, ISA_MIPS32R2); save_cpu_state(ctx, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, rt); /* Stop translation as we may have switched the execution mode. */ ctx->bstate = BS_STOP; break; case OPC_EI: check_insn(ctx, ISA_MIPS32R2); save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rt); /* Stop translation as we may have switched the execution mode. */ ctx->bstate = BS_STOP; break; default: /* Invalid */ MIPS_INVAL("mfmc0"); generate_exception_end(ctx, EXCP_RI); break; } tcg_temp_free(t0); } #endif /* !CONFIG_USER_ONLY */ break; case OPC_RDPGPR: check_insn(ctx, ISA_MIPS32R2); gen_load_srsgpr(rt, rd); break; case OPC_WRPGPR: check_insn(ctx, ISA_MIPS32R2); gen_store_srsgpr(rt, rd); break; default: MIPS_INVAL("cp0"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_BOVC: /* OPC_BEQZALC, OPC_BEQC, OPC_ADDI */ if (ctx->insn_flags & ISA_MIPS32R6) { /* OPC_BOVC, OPC_BEQZALC, OPC_BEQC */ gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { /* OPC_ADDI */ /* Arithmetic with immediate opcode */ gen_arith_imm(ctx, op, rt, rs, imm); } break; case OPC_ADDIU: gen_arith_imm(ctx, op, rt, rs, imm); break; case OPC_SLTI: /* Set on less than with immediate opcode */ case OPC_SLTIU: gen_slt_imm(ctx, op, rt, rs, imm); break; case OPC_ANDI: /* Arithmetic with immediate opcode */ case OPC_LUI: /* OPC_AUI */ case OPC_ORI: case OPC_XORI: gen_logic_imm(ctx, op, rt, rs, imm); break; case OPC_J ... OPC_JAL: /* Jump */ offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2; gen_compute_branch(ctx, op, 4, rs, rt, offset, 4); break; /* Branch */ case OPC_BLEZC: /* OPC_BGEZC, OPC_BGEC, OPC_BLEZL */ if (ctx->insn_flags & ISA_MIPS32R6) { if (rt == 0) { generate_exception_end(ctx, EXCP_RI); break; } /* OPC_BLEZC, OPC_BGEZC, OPC_BGEC */ gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { /* OPC_BLEZL */ gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } break; case OPC_BGTZC: /* OPC_BLTZC, OPC_BLTC, OPC_BGTZL */ if (ctx->insn_flags & ISA_MIPS32R6) { if (rt == 0) { generate_exception_end(ctx, EXCP_RI); break; } /* OPC_BGTZC, OPC_BLTZC, OPC_BLTC */ gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { /* OPC_BGTZL */ gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } break; case OPC_BLEZALC: /* OPC_BGEZALC, OPC_BGEUC, OPC_BLEZ */ if (rt == 0) { /* OPC_BLEZ */ gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } else { check_insn(ctx, ISA_MIPS32R6); /* OPC_BLEZALC, OPC_BGEZALC, OPC_BGEUC */ gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } break; case OPC_BGTZALC: /* OPC_BLTZALC, OPC_BLTUC, OPC_BGTZ */ if (rt == 0) { /* OPC_BGTZ */ gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } else { check_insn(ctx, ISA_MIPS32R6); /* OPC_BGTZALC, OPC_BLTZALC, OPC_BLTUC */ gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } break; case OPC_BEQL: case OPC_BNEL: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); /* Fallthrough */ case OPC_BEQ: case OPC_BNE: gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); break; case OPC_LL: /* Load and stores */ check_insn(ctx, ISA_MIPS2); /* Fallthrough */ case OPC_LWL: case OPC_LWR: check_insn_opc_removed(ctx, ISA_MIPS32R6); /* Fallthrough */ case OPC_LB ... OPC_LH: case OPC_LW ... OPC_LHU: gen_ld(ctx, op, rt, rs, imm); break; case OPC_SWL: case OPC_SWR: check_insn_opc_removed(ctx, ISA_MIPS32R6); /* fall through */ case OPC_SB ... OPC_SH: case OPC_SW: gen_st(ctx, op, rt, rs, imm); break; case OPC_SC: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_st_cond(ctx, op, rt, rs, imm); break; case OPC_CACHE: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS3 | ISA_MIPS32); if (ctx->hflags & MIPS_HFLAG_ITC_CACHE) { gen_cache_operation(ctx, rt, rs, imm); } /* Treat as NOP. */ break; case OPC_PREF: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn(ctx, ISA_MIPS4 | ISA_MIPS32); /* Treat as NOP. */ break; /* Floating point (COP1). */ case OPC_LWC1: case OPC_LDC1: case OPC_SWC1: case OPC_SDC1: gen_cop1_ldst(ctx, op, rt, rs, imm); break; case OPC_CP1: op1 = MASK_CP1(ctx->opcode); switch (op1) { case OPC_MFHC1: case OPC_MTHC1: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); case OPC_MFC1: case OPC_CFC1: case OPC_MTC1: case OPC_CTC1: check_cp1_enabled(ctx); gen_cp1(ctx, op1, rt, rd); break; #if defined(TARGET_MIPS64) case OPC_DMFC1: case OPC_DMTC1: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_cp1(ctx, op1, rt, rd); break; #endif case OPC_BC1EQZ: /* OPC_BC1ANY2 */ check_cp1_enabled(ctx); if (ctx->insn_flags & ISA_MIPS32R6) { /* OPC_BC1EQZ */ gen_compute_branch1_r6(ctx, MASK_CP1(ctx->opcode), rt, imm << 2, 4); } else { /* OPC_BC1ANY2 */ check_cop1x(ctx); check_insn(ctx, ASE_MIPS3D); gen_compute_branch1(ctx, MASK_BC1(ctx->opcode), (rt >> 2) & 0x7, imm << 2); } break; case OPC_BC1NEZ: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS32R6); gen_compute_branch1_r6(ctx, MASK_CP1(ctx->opcode), rt, imm << 2, 4); break; case OPC_BC1ANY4: check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS32R6); check_cop1x(ctx); check_insn(ctx, ASE_MIPS3D); /* fall through */ case OPC_BC1: check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_compute_branch1(ctx, MASK_BC1(ctx->opcode), (rt >> 2) & 0x7, imm << 2); break; case OPC_PS_FMT: check_ps(ctx); /* fall through */ case OPC_S_FMT: case OPC_D_FMT: check_cp1_enabled(ctx); gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); break; case OPC_W_FMT: case OPC_L_FMT: { int r6_op = ctx->opcode & FOP(0x3f, 0x1f); check_cp1_enabled(ctx); if (ctx->insn_flags & ISA_MIPS32R6) { switch (r6_op) { case R6_OPC_CMP_AF_S: case R6_OPC_CMP_UN_S: case R6_OPC_CMP_EQ_S: case R6_OPC_CMP_UEQ_S: case R6_OPC_CMP_LT_S: case R6_OPC_CMP_ULT_S: case R6_OPC_CMP_LE_S: case R6_OPC_CMP_ULE_S: case R6_OPC_CMP_SAF_S: case R6_OPC_CMP_SUN_S: case R6_OPC_CMP_SEQ_S: case R6_OPC_CMP_SEUQ_S: case R6_OPC_CMP_SLT_S: case R6_OPC_CMP_SULT_S: case R6_OPC_CMP_SLE_S: case R6_OPC_CMP_SULE_S: case R6_OPC_CMP_OR_S: case R6_OPC_CMP_UNE_S: case R6_OPC_CMP_NE_S: case R6_OPC_CMP_SOR_S: case R6_OPC_CMP_SUNE_S: case R6_OPC_CMP_SNE_S: gen_r6_cmp_s(ctx, ctx->opcode & 0x1f, rt, rd, sa); break; case R6_OPC_CMP_AF_D: case R6_OPC_CMP_UN_D: case R6_OPC_CMP_EQ_D: case R6_OPC_CMP_UEQ_D: case R6_OPC_CMP_LT_D: case R6_OPC_CMP_ULT_D: case R6_OPC_CMP_LE_D: case R6_OPC_CMP_ULE_D: case R6_OPC_CMP_SAF_D: case R6_OPC_CMP_SUN_D: case R6_OPC_CMP_SEQ_D: case R6_OPC_CMP_SEUQ_D: case R6_OPC_CMP_SLT_D: case R6_OPC_CMP_SULT_D: case R6_OPC_CMP_SLE_D: case R6_OPC_CMP_SULE_D: case R6_OPC_CMP_OR_D: case R6_OPC_CMP_UNE_D: case R6_OPC_CMP_NE_D: case R6_OPC_CMP_SOR_D: case R6_OPC_CMP_SUNE_D: case R6_OPC_CMP_SNE_D: gen_r6_cmp_d(ctx, ctx->opcode & 0x1f, rt, rd, sa); break; default: gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); break; } } else { gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); } break; } case OPC_BZ_V: case OPC_BNZ_V: case OPC_BZ_B: case OPC_BZ_H: case OPC_BZ_W: case OPC_BZ_D: case OPC_BNZ_B: case OPC_BNZ_H: case OPC_BNZ_W: case OPC_BNZ_D: check_insn(ctx, ASE_MSA); gen_msa_branch(env, ctx, op1); break; default: MIPS_INVAL("cp1"); generate_exception_end(ctx, EXCP_RI); break; } break; /* Compact branches [R6] and COP2 [non-R6] */ case OPC_BC: /* OPC_LWC2 */ case OPC_BALC: /* OPC_SWC2 */ if (ctx->insn_flags & ISA_MIPS32R6) { /* OPC_BC, OPC_BALC */ gen_compute_compact_branch(ctx, op, 0, 0, sextract32(ctx->opcode << 2, 0, 28)); } else { /* OPC_LWC2, OPC_SWC2 */ /* COP2: Not implemented. */ generate_exception_err(ctx, EXCP_CpU, 2); } break; case OPC_BEQZC: /* OPC_JIC, OPC_LDC2 */ case OPC_BNEZC: /* OPC_JIALC, OPC_SDC2 */ if (ctx->insn_flags & ISA_MIPS32R6) { if (rs != 0) { /* OPC_BEQZC, OPC_BNEZC */ gen_compute_compact_branch(ctx, op, rs, 0, sextract32(ctx->opcode << 2, 0, 23)); } else { /* OPC_JIC, OPC_JIALC */ gen_compute_compact_branch(ctx, op, 0, rt, imm); } } else { /* OPC_LWC2, OPC_SWC2 */ /* COP2: Not implemented. */ generate_exception_err(ctx, EXCP_CpU, 2); } break; case OPC_CP2: check_insn(ctx, INSN_LOONGSON2F); /* Note that these instructions use different fields. */ gen_loongson_multimedia(ctx, sa, rd, rt); break; case OPC_CP3: check_insn_opc_removed(ctx, ISA_MIPS32R6); if (ctx->CP0_Config1 & (1 << CP0C1_FP)) { check_cp1_enabled(ctx); op1 = MASK_CP3(ctx->opcode); switch (op1) { case OPC_LUXC1: case OPC_SUXC1: check_insn(ctx, ISA_MIPS5 | ISA_MIPS32R2); /* Fallthrough */ case OPC_LWXC1: case OPC_LDXC1: case OPC_SWXC1: case OPC_SDXC1: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_ldst(ctx, op1, sa, rd, rs, rt); break; case OPC_PREFX: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); /* Treat as NOP. */ break; case OPC_ALNV_PS: check_insn(ctx, ISA_MIPS5 | ISA_MIPS32R2); /* Fallthrough */ case OPC_MADD_S: case OPC_MADD_D: case OPC_MADD_PS: case OPC_MSUB_S: case OPC_MSUB_D: case OPC_MSUB_PS: case OPC_NMADD_S: case OPC_NMADD_D: case OPC_NMADD_PS: case OPC_NMSUB_S: case OPC_NMSUB_D: case OPC_NMSUB_PS: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_arith(ctx, op1, sa, rs, rd, rt); break; default: MIPS_INVAL("cp3"); generate_exception_end(ctx, EXCP_RI); break; } } else { generate_exception_err(ctx, EXCP_CpU, 1); } break; #if defined(TARGET_MIPS64) /* MIPS64 opcodes */ case OPC_LDL ... OPC_LDR: case OPC_LLD: check_insn_opc_removed(ctx, ISA_MIPS32R6); /* fall through */ case OPC_LWU: case OPC_LD: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_ld(ctx, op, rt, rs, imm); break; case OPC_SDL ... OPC_SDR: check_insn_opc_removed(ctx, ISA_MIPS32R6); /* fall through */ case OPC_SD: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_st(ctx, op, rt, rs, imm); break; case OPC_SCD: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_st_cond(ctx, op, rt, rs, imm); break; case OPC_BNVC: /* OPC_BNEZALC, OPC_BNEC, OPC_DADDI */ if (ctx->insn_flags & ISA_MIPS32R6) { /* OPC_BNVC, OPC_BNEZALC, OPC_BNEC */ gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { /* OPC_DADDI */ check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_arith_imm(ctx, op, rt, rs, imm); } break; case OPC_DADDIU: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_arith_imm(ctx, op, rt, rs, imm); break; #else case OPC_BNVC: /* OPC_BNEZALC, OPC_BNEC */ if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { MIPS_INVAL("major opcode"); generate_exception_end(ctx, EXCP_RI); } break; #endif case OPC_DAUI: /* OPC_JALX */ if (ctx->insn_flags & ISA_MIPS32R6) { #if defined(TARGET_MIPS64) /* OPC_DAUI */ check_mips_64(ctx); if (rs == 0) { generate_exception(ctx, EXCP_RI); } else if (rt != 0) { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rs); tcg_gen_addi_tl(cpu_gpr[rt], t0, imm << 16); tcg_temp_free(t0); } #else generate_exception_end(ctx, EXCP_RI); MIPS_INVAL("major opcode"); #endif } else { /* OPC_JALX */ check_insn(ctx, ASE_MIPS16 | ASE_MICROMIPS); offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2; gen_compute_branch(ctx, op, 4, rs, rt, offset, 4); } break; case OPC_MSA: /* OPC_MDMX */ /* MDMX: Not implemented. */ gen_msa(env, ctx); break; case OPC_PCREL: check_insn(ctx, ISA_MIPS32R6); gen_pcrel(ctx, ctx->opcode, ctx->pc, rs); break; default: /* Invalid */ MIPS_INVAL("major opcode"); generate_exception_end(ctx, EXCP_RI); break; } }
false
qemu
b74cddcbf6063f684725e3f8bca49a68e30cba71
static void decode_opc(CPUMIPSState *env, DisasContext *ctx) { int32_t offset; int rs, rt, rd, sa; uint32_t op, op1; int16_t imm; if (ctx->pc & 0x3) { env->CP0_BadVAddr = ctx->pc; generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL); return; } if ((ctx->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) { TCGLabel *l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1); tcg_gen_movi_i32(hflags, ctx->hflags & ~MIPS_HFLAG_BMASK); gen_goto_tb(ctx, 1, ctx->pc + 4); gen_set_label(l1); } op = MASK_OP_MAJOR(ctx->opcode); rs = (ctx->opcode >> 21) & 0x1f; rt = (ctx->opcode >> 16) & 0x1f; rd = (ctx->opcode >> 11) & 0x1f; sa = (ctx->opcode >> 6) & 0x1f; imm = (int16_t)ctx->opcode; switch (op) { case OPC_SPECIAL: decode_opc_special(env, ctx); break; case OPC_SPECIAL2: decode_opc_special2_legacy(env, ctx); break; case OPC_SPECIAL3: decode_opc_special3(env, ctx); break; case OPC_REGIMM: op1 = MASK_REGIMM(ctx->opcode); switch (op1) { case OPC_BLTZL: case OPC_BGEZL: case OPC_BLTZALL: case OPC_BGEZALL: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_BLTZ: case OPC_BGEZ: gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2, 4); break; case OPC_BLTZAL: case OPC_BGEZAL: if (ctx->insn_flags & ISA_MIPS32R6) { if (rs == 0) { gen_compute_branch(ctx, op1, 4, 0, -1, imm << 2, 4); } else { generate_exception_end(ctx, EXCP_RI); } } else { gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2, 4); } break; case OPC_TGEI ... OPC_TEQI: case OPC_TNEI: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_trap(ctx, op1, rs, -1, imm); break; case OPC_SIGRIE: check_insn(ctx, ISA_MIPS32R6); generate_exception_end(ctx, EXCP_RI); break; case OPC_SYNCI: check_insn(ctx, ISA_MIPS32R2); ctx->bstate = BS_STOP; break; case OPC_BPOSGE32: #if defined(TARGET_MIPS64) case OPC_BPOSGE64: #endif check_dsp(ctx); gen_compute_branch(ctx, op1, 4, -1, -2, (int32_t)imm << 2, 4); break; #if defined(TARGET_MIPS64) case OPC_DAHI: check_insn(ctx, ISA_MIPS32R6); check_mips_64(ctx); if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rs], cpu_gpr[rs], (int64_t)imm << 32); } break; case OPC_DATI: check_insn(ctx, ISA_MIPS32R6); check_mips_64(ctx); if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rs], cpu_gpr[rs], (int64_t)imm << 48); } break; #endif default: MIPS_INVAL("regimm"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_CP0: check_cp0_enabled(ctx); op1 = MASK_CP0(ctx->opcode); switch (op1) { case OPC_MFC0: case OPC_MTC0: case OPC_MFTR: case OPC_MTTR: case OPC_MFHC0: case OPC_MTHC0: #if defined(TARGET_MIPS64) case OPC_DMFC0: case OPC_DMTC0: #endif #ifndef CONFIG_USER_ONLY gen_cp0(env, ctx, op1, rt, rd); #endif break; case OPC_C0_FIRST ... OPC_C0_LAST: #ifndef CONFIG_USER_ONLY gen_cp0(env, ctx, MASK_C0(ctx->opcode), rt, rd); #endif break; case OPC_MFMC0: #ifndef CONFIG_USER_ONLY { uint32_t op2; TCGv t0 = tcg_temp_new(); op2 = MASK_MFMC0(ctx->opcode); switch (op2) { case OPC_DMT: check_insn(ctx, ASE_MT); gen_helper_dmt(t0); gen_store_gpr(t0, rt); break; case OPC_EMT: check_insn(ctx, ASE_MT); gen_helper_emt(t0); gen_store_gpr(t0, rt); break; case OPC_DVPE: check_insn(ctx, ASE_MT); gen_helper_dvpe(t0, cpu_env); gen_store_gpr(t0, rt); break; case OPC_EVPE: check_insn(ctx, ASE_MT); gen_helper_evpe(t0, cpu_env); gen_store_gpr(t0, rt); break; case OPC_DVP: check_insn(ctx, ISA_MIPS32R6); if (ctx->vp) { gen_helper_dvp(t0, cpu_env); gen_store_gpr(t0, rt); } break; case OPC_EVP: check_insn(ctx, ISA_MIPS32R6); if (ctx->vp) { gen_helper_evp(t0, cpu_env); gen_store_gpr(t0, rt); } break; case OPC_DI: check_insn(ctx, ISA_MIPS32R2); save_cpu_state(ctx, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, rt); ctx->bstate = BS_STOP; break; case OPC_EI: check_insn(ctx, ISA_MIPS32R2); save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rt); ctx->bstate = BS_STOP; break; default: MIPS_INVAL("mfmc0"); generate_exception_end(ctx, EXCP_RI); break; } tcg_temp_free(t0); } #endif break; case OPC_RDPGPR: check_insn(ctx, ISA_MIPS32R2); gen_load_srsgpr(rt, rd); break; case OPC_WRPGPR: check_insn(ctx, ISA_MIPS32R2); gen_store_srsgpr(rt, rd); break; default: MIPS_INVAL("cp0"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_BOVC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { gen_arith_imm(ctx, op, rt, rs, imm); } break; case OPC_ADDIU: gen_arith_imm(ctx, op, rt, rs, imm); break; case OPC_SLTI: case OPC_SLTIU: gen_slt_imm(ctx, op, rt, rs, imm); break; case OPC_ANDI: case OPC_LUI: case OPC_ORI: case OPC_XORI: gen_logic_imm(ctx, op, rt, rs, imm); break; case OPC_J ... OPC_JAL: offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2; gen_compute_branch(ctx, op, 4, rs, rt, offset, 4); break; case OPC_BLEZC: if (ctx->insn_flags & ISA_MIPS32R6) { if (rt == 0) { generate_exception_end(ctx, EXCP_RI); break; } gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } break; case OPC_BGTZC: if (ctx->insn_flags & ISA_MIPS32R6) { if (rt == 0) { generate_exception_end(ctx, EXCP_RI); break; } gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } break; case OPC_BLEZALC: if (rt == 0) { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } else { check_insn(ctx, ISA_MIPS32R6); gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } break; case OPC_BGTZALC: if (rt == 0) { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } else { check_insn(ctx, ISA_MIPS32R6); gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } break; case OPC_BEQL: case OPC_BNEL: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_BEQ: case OPC_BNE: gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); break; case OPC_LL: check_insn(ctx, ISA_MIPS2); case OPC_LWL: case OPC_LWR: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_LB ... OPC_LH: case OPC_LW ... OPC_LHU: gen_ld(ctx, op, rt, rs, imm); break; case OPC_SWL: case OPC_SWR: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_SB ... OPC_SH: case OPC_SW: gen_st(ctx, op, rt, rs, imm); break; case OPC_SC: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_st_cond(ctx, op, rt, rs, imm); break; case OPC_CACHE: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS3 | ISA_MIPS32); if (ctx->hflags & MIPS_HFLAG_ITC_CACHE) { gen_cache_operation(ctx, rt, rs, imm); } break; case OPC_PREF: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn(ctx, ISA_MIPS4 | ISA_MIPS32); break; case OPC_LWC1: case OPC_LDC1: case OPC_SWC1: case OPC_SDC1: gen_cop1_ldst(ctx, op, rt, rs, imm); break; case OPC_CP1: op1 = MASK_CP1(ctx->opcode); switch (op1) { case OPC_MFHC1: case OPC_MTHC1: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); case OPC_MFC1: case OPC_CFC1: case OPC_MTC1: case OPC_CTC1: check_cp1_enabled(ctx); gen_cp1(ctx, op1, rt, rd); break; #if defined(TARGET_MIPS64) case OPC_DMFC1: case OPC_DMTC1: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_cp1(ctx, op1, rt, rd); break; #endif case OPC_BC1EQZ: check_cp1_enabled(ctx); if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_branch1_r6(ctx, MASK_CP1(ctx->opcode), rt, imm << 2, 4); } else { check_cop1x(ctx); check_insn(ctx, ASE_MIPS3D); gen_compute_branch1(ctx, MASK_BC1(ctx->opcode), (rt >> 2) & 0x7, imm << 2); } break; case OPC_BC1NEZ: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS32R6); gen_compute_branch1_r6(ctx, MASK_CP1(ctx->opcode), rt, imm << 2, 4); break; case OPC_BC1ANY4: check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS32R6); check_cop1x(ctx); check_insn(ctx, ASE_MIPS3D); case OPC_BC1: check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_compute_branch1(ctx, MASK_BC1(ctx->opcode), (rt >> 2) & 0x7, imm << 2); break; case OPC_PS_FMT: check_ps(ctx); case OPC_S_FMT: case OPC_D_FMT: check_cp1_enabled(ctx); gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); break; case OPC_W_FMT: case OPC_L_FMT: { int r6_op = ctx->opcode & FOP(0x3f, 0x1f); check_cp1_enabled(ctx); if (ctx->insn_flags & ISA_MIPS32R6) { switch (r6_op) { case R6_OPC_CMP_AF_S: case R6_OPC_CMP_UN_S: case R6_OPC_CMP_EQ_S: case R6_OPC_CMP_UEQ_S: case R6_OPC_CMP_LT_S: case R6_OPC_CMP_ULT_S: case R6_OPC_CMP_LE_S: case R6_OPC_CMP_ULE_S: case R6_OPC_CMP_SAF_S: case R6_OPC_CMP_SUN_S: case R6_OPC_CMP_SEQ_S: case R6_OPC_CMP_SEUQ_S: case R6_OPC_CMP_SLT_S: case R6_OPC_CMP_SULT_S: case R6_OPC_CMP_SLE_S: case R6_OPC_CMP_SULE_S: case R6_OPC_CMP_OR_S: case R6_OPC_CMP_UNE_S: case R6_OPC_CMP_NE_S: case R6_OPC_CMP_SOR_S: case R6_OPC_CMP_SUNE_S: case R6_OPC_CMP_SNE_S: gen_r6_cmp_s(ctx, ctx->opcode & 0x1f, rt, rd, sa); break; case R6_OPC_CMP_AF_D: case R6_OPC_CMP_UN_D: case R6_OPC_CMP_EQ_D: case R6_OPC_CMP_UEQ_D: case R6_OPC_CMP_LT_D: case R6_OPC_CMP_ULT_D: case R6_OPC_CMP_LE_D: case R6_OPC_CMP_ULE_D: case R6_OPC_CMP_SAF_D: case R6_OPC_CMP_SUN_D: case R6_OPC_CMP_SEQ_D: case R6_OPC_CMP_SEUQ_D: case R6_OPC_CMP_SLT_D: case R6_OPC_CMP_SULT_D: case R6_OPC_CMP_SLE_D: case R6_OPC_CMP_SULE_D: case R6_OPC_CMP_OR_D: case R6_OPC_CMP_UNE_D: case R6_OPC_CMP_NE_D: case R6_OPC_CMP_SOR_D: case R6_OPC_CMP_SUNE_D: case R6_OPC_CMP_SNE_D: gen_r6_cmp_d(ctx, ctx->opcode & 0x1f, rt, rd, sa); break; default: gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); break; } } else { gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); } break; } case OPC_BZ_V: case OPC_BNZ_V: case OPC_BZ_B: case OPC_BZ_H: case OPC_BZ_W: case OPC_BZ_D: case OPC_BNZ_B: case OPC_BNZ_H: case OPC_BNZ_W: case OPC_BNZ_D: check_insn(ctx, ASE_MSA); gen_msa_branch(env, ctx, op1); break; default: MIPS_INVAL("cp1"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_BC: case OPC_BALC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, 0, 0, sextract32(ctx->opcode << 2, 0, 28)); } else { generate_exception_err(ctx, EXCP_CpU, 2); } break; case OPC_BEQZC: case OPC_BNEZC: if (ctx->insn_flags & ISA_MIPS32R6) { if (rs != 0) { gen_compute_compact_branch(ctx, op, rs, 0, sextract32(ctx->opcode << 2, 0, 23)); } else { gen_compute_compact_branch(ctx, op, 0, rt, imm); } } else { generate_exception_err(ctx, EXCP_CpU, 2); } break; case OPC_CP2: check_insn(ctx, INSN_LOONGSON2F); gen_loongson_multimedia(ctx, sa, rd, rt); break; case OPC_CP3: check_insn_opc_removed(ctx, ISA_MIPS32R6); if (ctx->CP0_Config1 & (1 << CP0C1_FP)) { check_cp1_enabled(ctx); op1 = MASK_CP3(ctx->opcode); switch (op1) { case OPC_LUXC1: case OPC_SUXC1: check_insn(ctx, ISA_MIPS5 | ISA_MIPS32R2); case OPC_LWXC1: case OPC_LDXC1: case OPC_SWXC1: case OPC_SDXC1: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_ldst(ctx, op1, sa, rd, rs, rt); break; case OPC_PREFX: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); break; case OPC_ALNV_PS: check_insn(ctx, ISA_MIPS5 | ISA_MIPS32R2); case OPC_MADD_S: case OPC_MADD_D: case OPC_MADD_PS: case OPC_MSUB_S: case OPC_MSUB_D: case OPC_MSUB_PS: case OPC_NMADD_S: case OPC_NMADD_D: case OPC_NMADD_PS: case OPC_NMSUB_S: case OPC_NMSUB_D: case OPC_NMSUB_PS: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_arith(ctx, op1, sa, rs, rd, rt); break; default: MIPS_INVAL("cp3"); generate_exception_end(ctx, EXCP_RI); break; } } else { generate_exception_err(ctx, EXCP_CpU, 1); } break; #if defined(TARGET_MIPS64) case OPC_LDL ... OPC_LDR: case OPC_LLD: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_LWU: case OPC_LD: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_ld(ctx, op, rt, rs, imm); break; case OPC_SDL ... OPC_SDR: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_SD: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_st(ctx, op, rt, rs, imm); break; case OPC_SCD: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_st_cond(ctx, op, rt, rs, imm); break; case OPC_BNVC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_arith_imm(ctx, op, rt, rs, imm); } break; case OPC_DADDIU: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_arith_imm(ctx, op, rt, rs, imm); break; #else case OPC_BNVC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { MIPS_INVAL("major opcode"); generate_exception_end(ctx, EXCP_RI); } break; #endif case OPC_DAUI: if (ctx->insn_flags & ISA_MIPS32R6) { #if defined(TARGET_MIPS64) check_mips_64(ctx); if (rs == 0) { generate_exception(ctx, EXCP_RI); } else if (rt != 0) { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rs); tcg_gen_addi_tl(cpu_gpr[rt], t0, imm << 16); tcg_temp_free(t0); } #else generate_exception_end(ctx, EXCP_RI); MIPS_INVAL("major opcode"); #endif } else { check_insn(ctx, ASE_MIPS16 | ASE_MICROMIPS); offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2; gen_compute_branch(ctx, op, 4, rs, rt, offset, 4); } break; case OPC_MSA: gen_msa(env, ctx); break; case OPC_PCREL: check_insn(ctx, ISA_MIPS32R6); gen_pcrel(ctx, ctx->opcode, ctx->pc, rs); break; default: MIPS_INVAL("major opcode"); generate_exception_end(ctx, EXCP_RI); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1) { int32_t offset; int VAR_2, VAR_3, VAR_4, VAR_5; uint32_t op, op1; int16_t imm; if (VAR_1->pc & 0x3) { VAR_0->CP0_BadVAddr = VAR_1->pc; generate_exception_err(VAR_1, EXCP_AdEL, EXCP_INST_NOTAVAIL); return; } if ((VAR_1->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) { TCGLabel *l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1); tcg_gen_movi_i32(hflags, VAR_1->hflags & ~MIPS_HFLAG_BMASK); gen_goto_tb(VAR_1, 1, VAR_1->pc + 4); gen_set_label(l1); } op = MASK_OP_MAJOR(VAR_1->opcode); VAR_2 = (VAR_1->opcode >> 21) & 0x1f; VAR_3 = (VAR_1->opcode >> 16) & 0x1f; VAR_4 = (VAR_1->opcode >> 11) & 0x1f; VAR_5 = (VAR_1->opcode >> 6) & 0x1f; imm = (int16_t)VAR_1->opcode; switch (op) { case OPC_SPECIAL: decode_opc_special(VAR_0, VAR_1); break; case OPC_SPECIAL2: decode_opc_special2_legacy(VAR_0, VAR_1); break; case OPC_SPECIAL3: decode_opc_special3(VAR_0, VAR_1); break; case OPC_REGIMM: op1 = MASK_REGIMM(VAR_1->opcode); switch (op1) { case OPC_BLTZL: case OPC_BGEZL: case OPC_BLTZALL: case OPC_BGEZALL: check_insn(VAR_1, ISA_MIPS2); check_insn_opc_removed(VAR_1, ISA_MIPS32R6); case OPC_BLTZ: case OPC_BGEZ: gen_compute_branch(VAR_1, op1, 4, VAR_2, -1, imm << 2, 4); break; case OPC_BLTZAL: case OPC_BGEZAL: if (VAR_1->insn_flags & ISA_MIPS32R6) { if (VAR_2 == 0) { gen_compute_branch(VAR_1, op1, 4, 0, -1, imm << 2, 4); } else { generate_exception_end(VAR_1, EXCP_RI); } } else { gen_compute_branch(VAR_1, op1, 4, VAR_2, -1, imm << 2, 4); } break; case OPC_TGEI ... OPC_TEQI: case OPC_TNEI: check_insn(VAR_1, ISA_MIPS2); check_insn_opc_removed(VAR_1, ISA_MIPS32R6); gen_trap(VAR_1, op1, VAR_2, -1, imm); break; case OPC_SIGRIE: check_insn(VAR_1, ISA_MIPS32R6); generate_exception_end(VAR_1, EXCP_RI); break; case OPC_SYNCI: check_insn(VAR_1, ISA_MIPS32R2); VAR_1->bstate = BS_STOP; break; case OPC_BPOSGE32: #if defined(TARGET_MIPS64) case OPC_BPOSGE64: #endif check_dsp(VAR_1); gen_compute_branch(VAR_1, op1, 4, -1, -2, (int32_t)imm << 2, 4); break; #if defined(TARGET_MIPS64) case OPC_DAHI: check_insn(VAR_1, ISA_MIPS32R6); check_mips_64(VAR_1); if (VAR_2 != 0) { tcg_gen_addi_tl(cpu_gpr[VAR_2], cpu_gpr[VAR_2], (int64_t)imm << 32); } break; case OPC_DATI: check_insn(VAR_1, ISA_MIPS32R6); check_mips_64(VAR_1); if (VAR_2 != 0) { tcg_gen_addi_tl(cpu_gpr[VAR_2], cpu_gpr[VAR_2], (int64_t)imm << 48); } break; #endif default: MIPS_INVAL("regimm"); generate_exception_end(VAR_1, EXCP_RI); break; } break; case OPC_CP0: check_cp0_enabled(VAR_1); op1 = MASK_CP0(VAR_1->opcode); switch (op1) { case OPC_MFC0: case OPC_MTC0: case OPC_MFTR: case OPC_MTTR: case OPC_MFHC0: case OPC_MTHC0: #if defined(TARGET_MIPS64) case OPC_DMFC0: case OPC_DMTC0: #endif #ifndef CONFIG_USER_ONLY gen_cp0(VAR_0, VAR_1, op1, VAR_3, VAR_4); #endif break; case OPC_C0_FIRST ... OPC_C0_LAST: #ifndef CONFIG_USER_ONLY gen_cp0(VAR_0, VAR_1, MASK_C0(VAR_1->opcode), VAR_3, VAR_4); #endif break; case OPC_MFMC0: #ifndef CONFIG_USER_ONLY { uint32_t op2; TCGv t0 = tcg_temp_new(); op2 = MASK_MFMC0(VAR_1->opcode); switch (op2) { case OPC_DMT: check_insn(VAR_1, ASE_MT); gen_helper_dmt(t0); gen_store_gpr(t0, VAR_3); break; case OPC_EMT: check_insn(VAR_1, ASE_MT); gen_helper_emt(t0); gen_store_gpr(t0, VAR_3); break; case OPC_DVPE: check_insn(VAR_1, ASE_MT); gen_helper_dvpe(t0, cpu_env); gen_store_gpr(t0, VAR_3); break; case OPC_EVPE: check_insn(VAR_1, ASE_MT); gen_helper_evpe(t0, cpu_env); gen_store_gpr(t0, VAR_3); break; case OPC_DVP: check_insn(VAR_1, ISA_MIPS32R6); if (VAR_1->vp) { gen_helper_dvp(t0, cpu_env); gen_store_gpr(t0, VAR_3); } break; case OPC_EVP: check_insn(VAR_1, ISA_MIPS32R6); if (VAR_1->vp) { gen_helper_evp(t0, cpu_env); gen_store_gpr(t0, VAR_3); } break; case OPC_DI: check_insn(VAR_1, ISA_MIPS32R2); save_cpu_state(VAR_1, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, VAR_3); VAR_1->bstate = BS_STOP; break; case OPC_EI: check_insn(VAR_1, ISA_MIPS32R2); save_cpu_state(VAR_1, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, VAR_3); VAR_1->bstate = BS_STOP; break; default: MIPS_INVAL("mfmc0"); generate_exception_end(VAR_1, EXCP_RI); break; } tcg_temp_free(t0); } #endif break; case OPC_RDPGPR: check_insn(VAR_1, ISA_MIPS32R2); gen_load_srsgpr(VAR_3, VAR_4); break; case OPC_WRPGPR: check_insn(VAR_1, ISA_MIPS32R2); gen_store_srsgpr(VAR_3, VAR_4); break; default: MIPS_INVAL("cp0"); generate_exception_end(VAR_1, EXCP_RI); break; } break; case OPC_BOVC: if (VAR_1->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2); } else { gen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm); } break; case OPC_ADDIU: gen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_SLTI: case OPC_SLTIU: gen_slt_imm(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_ANDI: case OPC_LUI: case OPC_ORI: case OPC_XORI: gen_logic_imm(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_J ... OPC_JAL: offset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2; gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, offset, 4); break; case OPC_BLEZC: if (VAR_1->insn_flags & ISA_MIPS32R6) { if (VAR_3 == 0) { generate_exception_end(VAR_1, EXCP_RI); break; } gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2); } else { gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4); } break; case OPC_BGTZC: if (VAR_1->insn_flags & ISA_MIPS32R6) { if (VAR_3 == 0) { generate_exception_end(VAR_1, EXCP_RI); break; } gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2); } else { gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4); } break; case OPC_BLEZALC: if (VAR_3 == 0) { gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4); } else { check_insn(VAR_1, ISA_MIPS32R6); gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2); } break; case OPC_BGTZALC: if (VAR_3 == 0) { gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4); } else { check_insn(VAR_1, ISA_MIPS32R6); gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2); } break; case OPC_BEQL: case OPC_BNEL: check_insn(VAR_1, ISA_MIPS2); check_insn_opc_removed(VAR_1, ISA_MIPS32R6); case OPC_BEQ: case OPC_BNE: gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4); break; case OPC_LL: check_insn(VAR_1, ISA_MIPS2); case OPC_LWL: case OPC_LWR: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); case OPC_LB ... OPC_LH: case OPC_LW ... OPC_LHU: gen_ld(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_SWL: case OPC_SWR: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); case OPC_SB ... OPC_SH: case OPC_SW: gen_st(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_SC: check_insn(VAR_1, ISA_MIPS2); check_insn_opc_removed(VAR_1, ISA_MIPS32R6); gen_st_cond(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_CACHE: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); check_cp0_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS3 | ISA_MIPS32); if (VAR_1->hflags & MIPS_HFLAG_ITC_CACHE) { gen_cache_operation(VAR_1, VAR_3, VAR_2, imm); } break; case OPC_PREF: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); check_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32); break; case OPC_LWC1: case OPC_LDC1: case OPC_SWC1: case OPC_SDC1: gen_cop1_ldst(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_CP1: op1 = MASK_CP1(VAR_1->opcode); switch (op1) { case OPC_MFHC1: case OPC_MTHC1: check_cp1_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS32R2); case OPC_MFC1: case OPC_CFC1: case OPC_MTC1: case OPC_CTC1: check_cp1_enabled(VAR_1); gen_cp1(VAR_1, op1, VAR_3, VAR_4); break; #if defined(TARGET_MIPS64) case OPC_DMFC1: case OPC_DMTC1: check_cp1_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS3); check_mips_64(VAR_1); gen_cp1(VAR_1, op1, VAR_3, VAR_4); break; #endif case OPC_BC1EQZ: check_cp1_enabled(VAR_1); if (VAR_1->insn_flags & ISA_MIPS32R6) { gen_compute_branch1_r6(VAR_1, MASK_CP1(VAR_1->opcode), VAR_3, imm << 2, 4); } else { check_cop1x(VAR_1); check_insn(VAR_1, ASE_MIPS3D); gen_compute_branch1(VAR_1, MASK_BC1(VAR_1->opcode), (VAR_3 >> 2) & 0x7, imm << 2); } break; case OPC_BC1NEZ: check_cp1_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS32R6); gen_compute_branch1_r6(VAR_1, MASK_CP1(VAR_1->opcode), VAR_3, imm << 2, 4); break; case OPC_BC1ANY4: check_cp1_enabled(VAR_1); check_insn_opc_removed(VAR_1, ISA_MIPS32R6); check_cop1x(VAR_1); check_insn(VAR_1, ASE_MIPS3D); case OPC_BC1: check_cp1_enabled(VAR_1); check_insn_opc_removed(VAR_1, ISA_MIPS32R6); gen_compute_branch1(VAR_1, MASK_BC1(VAR_1->opcode), (VAR_3 >> 2) & 0x7, imm << 2); break; case OPC_PS_FMT: check_ps(VAR_1); case OPC_S_FMT: case OPC_D_FMT: check_cp1_enabled(VAR_1); gen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f), VAR_3, VAR_4, VAR_5, (imm >> 8) & 0x7); break; case OPC_W_FMT: case OPC_L_FMT: { int VAR_6 = VAR_1->opcode & FOP(0x3f, 0x1f); check_cp1_enabled(VAR_1); if (VAR_1->insn_flags & ISA_MIPS32R6) { switch (VAR_6) { case R6_OPC_CMP_AF_S: case R6_OPC_CMP_UN_S: case R6_OPC_CMP_EQ_S: case R6_OPC_CMP_UEQ_S: case R6_OPC_CMP_LT_S: case R6_OPC_CMP_ULT_S: case R6_OPC_CMP_LE_S: case R6_OPC_CMP_ULE_S: case R6_OPC_CMP_SAF_S: case R6_OPC_CMP_SUN_S: case R6_OPC_CMP_SEQ_S: case R6_OPC_CMP_SEUQ_S: case R6_OPC_CMP_SLT_S: case R6_OPC_CMP_SULT_S: case R6_OPC_CMP_SLE_S: case R6_OPC_CMP_SULE_S: case R6_OPC_CMP_OR_S: case R6_OPC_CMP_UNE_S: case R6_OPC_CMP_NE_S: case R6_OPC_CMP_SOR_S: case R6_OPC_CMP_SUNE_S: case R6_OPC_CMP_SNE_S: gen_r6_cmp_s(VAR_1, VAR_1->opcode & 0x1f, VAR_3, VAR_4, VAR_5); break; case R6_OPC_CMP_AF_D: case R6_OPC_CMP_UN_D: case R6_OPC_CMP_EQ_D: case R6_OPC_CMP_UEQ_D: case R6_OPC_CMP_LT_D: case R6_OPC_CMP_ULT_D: case R6_OPC_CMP_LE_D: case R6_OPC_CMP_ULE_D: case R6_OPC_CMP_SAF_D: case R6_OPC_CMP_SUN_D: case R6_OPC_CMP_SEQ_D: case R6_OPC_CMP_SEUQ_D: case R6_OPC_CMP_SLT_D: case R6_OPC_CMP_SULT_D: case R6_OPC_CMP_SLE_D: case R6_OPC_CMP_SULE_D: case R6_OPC_CMP_OR_D: case R6_OPC_CMP_UNE_D: case R6_OPC_CMP_NE_D: case R6_OPC_CMP_SOR_D: case R6_OPC_CMP_SUNE_D: case R6_OPC_CMP_SNE_D: gen_r6_cmp_d(VAR_1, VAR_1->opcode & 0x1f, VAR_3, VAR_4, VAR_5); break; default: gen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f), VAR_3, VAR_4, VAR_5, (imm >> 8) & 0x7); break; } } else { gen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f), VAR_3, VAR_4, VAR_5, (imm >> 8) & 0x7); } break; } case OPC_BZ_V: case OPC_BNZ_V: case OPC_BZ_B: case OPC_BZ_H: case OPC_BZ_W: case OPC_BZ_D: case OPC_BNZ_B: case OPC_BNZ_H: case OPC_BNZ_W: case OPC_BNZ_D: check_insn(VAR_1, ASE_MSA); gen_msa_branch(VAR_0, VAR_1, op1); break; default: MIPS_INVAL("cp1"); generate_exception_end(VAR_1, EXCP_RI); break; } break; case OPC_BC: case OPC_BALC: if (VAR_1->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(VAR_1, op, 0, 0, sextract32(VAR_1->opcode << 2, 0, 28)); } else { generate_exception_err(VAR_1, EXCP_CpU, 2); } break; case OPC_BEQZC: case OPC_BNEZC: if (VAR_1->insn_flags & ISA_MIPS32R6) { if (VAR_2 != 0) { gen_compute_compact_branch(VAR_1, op, VAR_2, 0, sextract32(VAR_1->opcode << 2, 0, 23)); } else { gen_compute_compact_branch(VAR_1, op, 0, VAR_3, imm); } } else { generate_exception_err(VAR_1, EXCP_CpU, 2); } break; case OPC_CP2: check_insn(VAR_1, INSN_LOONGSON2F); gen_loongson_multimedia(VAR_1, VAR_5, VAR_4, VAR_3); break; case OPC_CP3: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); if (VAR_1->CP0_Config1 & (1 << CP0C1_FP)) { check_cp1_enabled(VAR_1); op1 = MASK_CP3(VAR_1->opcode); switch (op1) { case OPC_LUXC1: case OPC_SUXC1: check_insn(VAR_1, ISA_MIPS5 | ISA_MIPS32R2); case OPC_LWXC1: case OPC_LDXC1: case OPC_SWXC1: case OPC_SDXC1: check_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_ldst(VAR_1, op1, VAR_5, VAR_4, VAR_2, VAR_3); break; case OPC_PREFX: check_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32R2); break; case OPC_ALNV_PS: check_insn(VAR_1, ISA_MIPS5 | ISA_MIPS32R2); case OPC_MADD_S: case OPC_MADD_D: case OPC_MADD_PS: case OPC_MSUB_S: case OPC_MSUB_D: case OPC_MSUB_PS: case OPC_NMADD_S: case OPC_NMADD_D: case OPC_NMADD_PS: case OPC_NMSUB_S: case OPC_NMSUB_D: case OPC_NMSUB_PS: check_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_arith(VAR_1, op1, VAR_5, VAR_2, VAR_4, VAR_3); break; default: MIPS_INVAL("cp3"); generate_exception_end(VAR_1, EXCP_RI); break; } } else { generate_exception_err(VAR_1, EXCP_CpU, 1); } break; #if defined(TARGET_MIPS64) case OPC_LDL ... OPC_LDR: case OPC_LLD: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); case OPC_LWU: case OPC_LD: check_insn(VAR_1, ISA_MIPS3); check_mips_64(VAR_1); gen_ld(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_SDL ... OPC_SDR: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); case OPC_SD: check_insn(VAR_1, ISA_MIPS3); check_mips_64(VAR_1); gen_st(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_SCD: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); check_insn(VAR_1, ISA_MIPS3); check_mips_64(VAR_1); gen_st_cond(VAR_1, op, VAR_3, VAR_2, imm); break; case OPC_BNVC: if (VAR_1->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2); } else { check_insn(VAR_1, ISA_MIPS3); check_mips_64(VAR_1); gen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm); } break; case OPC_DADDIU: check_insn(VAR_1, ISA_MIPS3); check_mips_64(VAR_1); gen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm); break; #else case OPC_BNVC: if (VAR_1->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2); } else { MIPS_INVAL("major opcode"); generate_exception_end(VAR_1, EXCP_RI); } break; #endif case OPC_DAUI: if (VAR_1->insn_flags & ISA_MIPS32R6) { #if defined(TARGET_MIPS64) check_mips_64(VAR_1); if (VAR_2 == 0) { generate_exception(VAR_1, EXCP_RI); } else if (VAR_3 != 0) { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, VAR_2); tcg_gen_addi_tl(cpu_gpr[VAR_3], t0, imm << 16); tcg_temp_free(t0); } #else generate_exception_end(VAR_1, EXCP_RI); MIPS_INVAL("major opcode"); #endif } else { check_insn(VAR_1, ASE_MIPS16 | ASE_MICROMIPS); offset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2; gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, offset, 4); } break; case OPC_MSA: gen_msa(VAR_0, VAR_1); break; case OPC_PCREL: check_insn(VAR_1, ISA_MIPS32R6); gen_pcrel(VAR_1, VAR_1->opcode, VAR_1->pc, VAR_2); break; default: MIPS_INVAL("major opcode"); generate_exception_end(VAR_1, EXCP_RI); break; } }
[ "static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1)\n{", "int32_t offset;", "int VAR_2, VAR_3, VAR_4, VAR_5;", "uint32_t op, op1;", "int16_t imm;", "if (VAR_1->pc & 0x3) {", "VAR_0->CP0_BadVAddr = VAR_1->pc;", "generate_exception_err(VAR_1, EXCP_AdEL, EXCP_INST_NOTAVAIL);", "return;", "}", "if ((VAR_1->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) {", "TCGLabel *l1 = gen_new_label();", "tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1);", "tcg_gen_movi_i32(hflags, VAR_1->hflags & ~MIPS_HFLAG_BMASK);", "gen_goto_tb(VAR_1, 1, VAR_1->pc + 4);", "gen_set_label(l1);", "}", "op = MASK_OP_MAJOR(VAR_1->opcode);", "VAR_2 = (VAR_1->opcode >> 21) & 0x1f;", "VAR_3 = (VAR_1->opcode >> 16) & 0x1f;", "VAR_4 = (VAR_1->opcode >> 11) & 0x1f;", "VAR_5 = (VAR_1->opcode >> 6) & 0x1f;", "imm = (int16_t)VAR_1->opcode;", "switch (op) {", "case OPC_SPECIAL:\ndecode_opc_special(VAR_0, VAR_1);", "break;", "case OPC_SPECIAL2:\ndecode_opc_special2_legacy(VAR_0, VAR_1);", "break;", "case OPC_SPECIAL3:\ndecode_opc_special3(VAR_0, VAR_1);", "break;", "case OPC_REGIMM:\nop1 = MASK_REGIMM(VAR_1->opcode);", "switch (op1) {", "case OPC_BLTZL:\ncase OPC_BGEZL:\ncase OPC_BLTZALL:\ncase OPC_BGEZALL:\ncheck_insn(VAR_1, ISA_MIPS2);", "check_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "case OPC_BLTZ:\ncase OPC_BGEZ:\ngen_compute_branch(VAR_1, op1, 4, VAR_2, -1, imm << 2, 4);", "break;", "case OPC_BLTZAL:\ncase OPC_BGEZAL:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "if (VAR_2 == 0) {", "gen_compute_branch(VAR_1, op1, 4, 0, -1, imm << 2, 4);", "} else {", "generate_exception_end(VAR_1, EXCP_RI);", "}", "} else {", "gen_compute_branch(VAR_1, op1, 4, VAR_2, -1, imm << 2, 4);", "}", "break;", "case OPC_TGEI ... OPC_TEQI:\ncase OPC_TNEI:\ncheck_insn(VAR_1, ISA_MIPS2);", "check_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "gen_trap(VAR_1, op1, VAR_2, -1, imm);", "break;", "case OPC_SIGRIE:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "case OPC_SYNCI:\ncheck_insn(VAR_1, ISA_MIPS32R2);", "VAR_1->bstate = BS_STOP;", "break;", "case OPC_BPOSGE32:\n#if defined(TARGET_MIPS64)\ncase OPC_BPOSGE64:\n#endif\ncheck_dsp(VAR_1);", "gen_compute_branch(VAR_1, op1, 4, -1, -2, (int32_t)imm << 2, 4);", "break;", "#if defined(TARGET_MIPS64)\ncase OPC_DAHI:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "check_mips_64(VAR_1);", "if (VAR_2 != 0) {", "tcg_gen_addi_tl(cpu_gpr[VAR_2], cpu_gpr[VAR_2], (int64_t)imm << 32);", "}", "break;", "case OPC_DATI:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "check_mips_64(VAR_1);", "if (VAR_2 != 0) {", "tcg_gen_addi_tl(cpu_gpr[VAR_2], cpu_gpr[VAR_2], (int64_t)imm << 48);", "}", "break;", "#endif\ndefault:\nMIPS_INVAL(\"regimm\");", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "break;", "case OPC_CP0:\ncheck_cp0_enabled(VAR_1);", "op1 = MASK_CP0(VAR_1->opcode);", "switch (op1) {", "case OPC_MFC0:\ncase OPC_MTC0:\ncase OPC_MFTR:\ncase OPC_MTTR:\ncase OPC_MFHC0:\ncase OPC_MTHC0:\n#if defined(TARGET_MIPS64)\ncase OPC_DMFC0:\ncase OPC_DMTC0:\n#endif\n#ifndef CONFIG_USER_ONLY\ngen_cp0(VAR_0, VAR_1, op1, VAR_3, VAR_4);", "#endif\nbreak;", "case OPC_C0_FIRST ... OPC_C0_LAST:\n#ifndef CONFIG_USER_ONLY\ngen_cp0(VAR_0, VAR_1, MASK_C0(VAR_1->opcode), VAR_3, VAR_4);", "#endif\nbreak;", "case OPC_MFMC0:\n#ifndef CONFIG_USER_ONLY\n{", "uint32_t op2;", "TCGv t0 = tcg_temp_new();", "op2 = MASK_MFMC0(VAR_1->opcode);", "switch (op2) {", "case OPC_DMT:\ncheck_insn(VAR_1, ASE_MT);", "gen_helper_dmt(t0);", "gen_store_gpr(t0, VAR_3);", "break;", "case OPC_EMT:\ncheck_insn(VAR_1, ASE_MT);", "gen_helper_emt(t0);", "gen_store_gpr(t0, VAR_3);", "break;", "case OPC_DVPE:\ncheck_insn(VAR_1, ASE_MT);", "gen_helper_dvpe(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "break;", "case OPC_EVPE:\ncheck_insn(VAR_1, ASE_MT);", "gen_helper_evpe(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "break;", "case OPC_DVP:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "if (VAR_1->vp) {", "gen_helper_dvp(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "}", "break;", "case OPC_EVP:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "if (VAR_1->vp) {", "gen_helper_evp(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "}", "break;", "case OPC_DI:\ncheck_insn(VAR_1, ISA_MIPS32R2);", "save_cpu_state(VAR_1, 1);", "gen_helper_di(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "VAR_1->bstate = BS_STOP;", "break;", "case OPC_EI:\ncheck_insn(VAR_1, ISA_MIPS32R2);", "save_cpu_state(VAR_1, 1);", "gen_helper_ei(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "VAR_1->bstate = BS_STOP;", "break;", "default:\nMIPS_INVAL(\"mfmc0\");", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "tcg_temp_free(t0);", "}", "#endif\nbreak;", "case OPC_RDPGPR:\ncheck_insn(VAR_1, ISA_MIPS32R2);", "gen_load_srsgpr(VAR_3, VAR_4);", "break;", "case OPC_WRPGPR:\ncheck_insn(VAR_1, ISA_MIPS32R2);", "gen_store_srsgpr(VAR_3, VAR_4);", "break;", "default:\nMIPS_INVAL(\"cp0\");", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "break;", "case OPC_BOVC:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2);", "} else {", "gen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm);", "}", "break;", "case OPC_ADDIU:\ngen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_SLTI:\ncase OPC_SLTIU:\ngen_slt_imm(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_ANDI:\ncase OPC_LUI:\ncase OPC_ORI:\ncase OPC_XORI:\ngen_logic_imm(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_J ... OPC_JAL:\noffset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2;", "gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, offset, 4);", "break;", "case OPC_BLEZC:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "if (VAR_3 == 0) {", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2);", "} else {", "gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4);", "}", "break;", "case OPC_BGTZC:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "if (VAR_3 == 0) {", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2);", "} else {", "gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4);", "}", "break;", "case OPC_BLEZALC:\nif (VAR_3 == 0) {", "gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4);", "} else {", "check_insn(VAR_1, ISA_MIPS32R6);", "gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2);", "}", "break;", "case OPC_BGTZALC:\nif (VAR_3 == 0) {", "gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4);", "} else {", "check_insn(VAR_1, ISA_MIPS32R6);", "gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2);", "}", "break;", "case OPC_BEQL:\ncase OPC_BNEL:\ncheck_insn(VAR_1, ISA_MIPS2);", "check_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "case OPC_BEQ:\ncase OPC_BNE:\ngen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, imm << 2, 4);", "break;", "case OPC_LL:\ncheck_insn(VAR_1, ISA_MIPS2);", "case OPC_LWL:\ncase OPC_LWR:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "case OPC_LB ... OPC_LH:\ncase OPC_LW ... OPC_LHU:\ngen_ld(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_SWL:\ncase OPC_SWR:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "case OPC_SB ... OPC_SH:\ncase OPC_SW:\ngen_st(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_SC:\ncheck_insn(VAR_1, ISA_MIPS2);", "check_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "gen_st_cond(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_CACHE:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "check_cp0_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS3 | ISA_MIPS32);", "if (VAR_1->hflags & MIPS_HFLAG_ITC_CACHE) {", "gen_cache_operation(VAR_1, VAR_3, VAR_2, imm);", "}", "break;", "case OPC_PREF:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "check_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32);", "break;", "case OPC_LWC1:\ncase OPC_LDC1:\ncase OPC_SWC1:\ncase OPC_SDC1:\ngen_cop1_ldst(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_CP1:\nop1 = MASK_CP1(VAR_1->opcode);", "switch (op1) {", "case OPC_MFHC1:\ncase OPC_MTHC1:\ncheck_cp1_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS32R2);", "case OPC_MFC1:\ncase OPC_CFC1:\ncase OPC_MTC1:\ncase OPC_CTC1:\ncheck_cp1_enabled(VAR_1);", "gen_cp1(VAR_1, op1, VAR_3, VAR_4);", "break;", "#if defined(TARGET_MIPS64)\ncase OPC_DMFC1:\ncase OPC_DMTC1:\ncheck_cp1_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS3);", "check_mips_64(VAR_1);", "gen_cp1(VAR_1, op1, VAR_3, VAR_4);", "break;", "#endif\ncase OPC_BC1EQZ:\ncheck_cp1_enabled(VAR_1);", "if (VAR_1->insn_flags & ISA_MIPS32R6) {", "gen_compute_branch1_r6(VAR_1, MASK_CP1(VAR_1->opcode),\nVAR_3, imm << 2, 4);", "} else {", "check_cop1x(VAR_1);", "check_insn(VAR_1, ASE_MIPS3D);", "gen_compute_branch1(VAR_1, MASK_BC1(VAR_1->opcode),\n(VAR_3 >> 2) & 0x7, imm << 2);", "}", "break;", "case OPC_BC1NEZ:\ncheck_cp1_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS32R6);", "gen_compute_branch1_r6(VAR_1, MASK_CP1(VAR_1->opcode),\nVAR_3, imm << 2, 4);", "break;", "case OPC_BC1ANY4:\ncheck_cp1_enabled(VAR_1);", "check_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "check_cop1x(VAR_1);", "check_insn(VAR_1, ASE_MIPS3D);", "case OPC_BC1:\ncheck_cp1_enabled(VAR_1);", "check_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "gen_compute_branch1(VAR_1, MASK_BC1(VAR_1->opcode),\n(VAR_3 >> 2) & 0x7, imm << 2);", "break;", "case OPC_PS_FMT:\ncheck_ps(VAR_1);", "case OPC_S_FMT:\ncase OPC_D_FMT:\ncheck_cp1_enabled(VAR_1);", "gen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f), VAR_3, VAR_4, VAR_5,\n(imm >> 8) & 0x7);", "break;", "case OPC_W_FMT:\ncase OPC_L_FMT:\n{", "int VAR_6 = VAR_1->opcode & FOP(0x3f, 0x1f);", "check_cp1_enabled(VAR_1);", "if (VAR_1->insn_flags & ISA_MIPS32R6) {", "switch (VAR_6) {", "case R6_OPC_CMP_AF_S:\ncase R6_OPC_CMP_UN_S:\ncase R6_OPC_CMP_EQ_S:\ncase R6_OPC_CMP_UEQ_S:\ncase R6_OPC_CMP_LT_S:\ncase R6_OPC_CMP_ULT_S:\ncase R6_OPC_CMP_LE_S:\ncase R6_OPC_CMP_ULE_S:\ncase R6_OPC_CMP_SAF_S:\ncase R6_OPC_CMP_SUN_S:\ncase R6_OPC_CMP_SEQ_S:\ncase R6_OPC_CMP_SEUQ_S:\ncase R6_OPC_CMP_SLT_S:\ncase R6_OPC_CMP_SULT_S:\ncase R6_OPC_CMP_SLE_S:\ncase R6_OPC_CMP_SULE_S:\ncase R6_OPC_CMP_OR_S:\ncase R6_OPC_CMP_UNE_S:\ncase R6_OPC_CMP_NE_S:\ncase R6_OPC_CMP_SOR_S:\ncase R6_OPC_CMP_SUNE_S:\ncase R6_OPC_CMP_SNE_S:\ngen_r6_cmp_s(VAR_1, VAR_1->opcode & 0x1f, VAR_3, VAR_4, VAR_5);", "break;", "case R6_OPC_CMP_AF_D:\ncase R6_OPC_CMP_UN_D:\ncase R6_OPC_CMP_EQ_D:\ncase R6_OPC_CMP_UEQ_D:\ncase R6_OPC_CMP_LT_D:\ncase R6_OPC_CMP_ULT_D:\ncase R6_OPC_CMP_LE_D:\ncase R6_OPC_CMP_ULE_D:\ncase R6_OPC_CMP_SAF_D:\ncase R6_OPC_CMP_SUN_D:\ncase R6_OPC_CMP_SEQ_D:\ncase R6_OPC_CMP_SEUQ_D:\ncase R6_OPC_CMP_SLT_D:\ncase R6_OPC_CMP_SULT_D:\ncase R6_OPC_CMP_SLE_D:\ncase R6_OPC_CMP_SULE_D:\ncase R6_OPC_CMP_OR_D:\ncase R6_OPC_CMP_UNE_D:\ncase R6_OPC_CMP_NE_D:\ncase R6_OPC_CMP_SOR_D:\ncase R6_OPC_CMP_SUNE_D:\ncase R6_OPC_CMP_SNE_D:\ngen_r6_cmp_d(VAR_1, VAR_1->opcode & 0x1f, VAR_3, VAR_4, VAR_5);", "break;", "default:\ngen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f),\nVAR_3, VAR_4, VAR_5, (imm >> 8) & 0x7);", "break;", "}", "} else {", "gen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f), VAR_3, VAR_4, VAR_5,\n(imm >> 8) & 0x7);", "}", "break;", "}", "case OPC_BZ_V:\ncase OPC_BNZ_V:\ncase OPC_BZ_B:\ncase OPC_BZ_H:\ncase OPC_BZ_W:\ncase OPC_BZ_D:\ncase OPC_BNZ_B:\ncase OPC_BNZ_H:\ncase OPC_BNZ_W:\ncase OPC_BNZ_D:\ncheck_insn(VAR_1, ASE_MSA);", "gen_msa_branch(VAR_0, VAR_1, op1);", "break;", "default:\nMIPS_INVAL(\"cp1\");", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "break;", "case OPC_BC:\ncase OPC_BALC:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "gen_compute_compact_branch(VAR_1, op, 0, 0,\nsextract32(VAR_1->opcode << 2, 0, 28));", "} else {", "generate_exception_err(VAR_1, EXCP_CpU, 2);", "}", "break;", "case OPC_BEQZC:\ncase OPC_BNEZC:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "if (VAR_2 != 0) {", "gen_compute_compact_branch(VAR_1, op, VAR_2, 0,\nsextract32(VAR_1->opcode << 2, 0, 23));", "} else {", "gen_compute_compact_branch(VAR_1, op, 0, VAR_3, imm);", "}", "} else {", "generate_exception_err(VAR_1, EXCP_CpU, 2);", "}", "break;", "case OPC_CP2:\ncheck_insn(VAR_1, INSN_LOONGSON2F);", "gen_loongson_multimedia(VAR_1, VAR_5, VAR_4, VAR_3);", "break;", "case OPC_CP3:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "if (VAR_1->CP0_Config1 & (1 << CP0C1_FP)) {", "check_cp1_enabled(VAR_1);", "op1 = MASK_CP3(VAR_1->opcode);", "switch (op1) {", "case OPC_LUXC1:\ncase OPC_SUXC1:\ncheck_insn(VAR_1, ISA_MIPS5 | ISA_MIPS32R2);", "case OPC_LWXC1:\ncase OPC_LDXC1:\ncase OPC_SWXC1:\ncase OPC_SDXC1:\ncheck_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32R2);", "gen_flt3_ldst(VAR_1, op1, VAR_5, VAR_4, VAR_2, VAR_3);", "break;", "case OPC_PREFX:\ncheck_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32R2);", "break;", "case OPC_ALNV_PS:\ncheck_insn(VAR_1, ISA_MIPS5 | ISA_MIPS32R2);", "case OPC_MADD_S:\ncase OPC_MADD_D:\ncase OPC_MADD_PS:\ncase OPC_MSUB_S:\ncase OPC_MSUB_D:\ncase OPC_MSUB_PS:\ncase OPC_NMADD_S:\ncase OPC_NMADD_D:\ncase OPC_NMADD_PS:\ncase OPC_NMSUB_S:\ncase OPC_NMSUB_D:\ncase OPC_NMSUB_PS:\ncheck_insn(VAR_1, ISA_MIPS4 | ISA_MIPS32R2);", "gen_flt3_arith(VAR_1, op1, VAR_5, VAR_2, VAR_4, VAR_3);", "break;", "default:\nMIPS_INVAL(\"cp3\");", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "} else {", "generate_exception_err(VAR_1, EXCP_CpU, 1);", "}", "break;", "#if defined(TARGET_MIPS64)\ncase OPC_LDL ... OPC_LDR:\ncase OPC_LLD:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "case OPC_LWU:\ncase OPC_LD:\ncheck_insn(VAR_1, ISA_MIPS3);", "check_mips_64(VAR_1);", "gen_ld(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_SDL ... OPC_SDR:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "case OPC_SD:\ncheck_insn(VAR_1, ISA_MIPS3);", "check_mips_64(VAR_1);", "gen_st(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_SCD:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "check_insn(VAR_1, ISA_MIPS3);", "check_mips_64(VAR_1);", "gen_st_cond(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "case OPC_BNVC:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2);", "} else {", "check_insn(VAR_1, ISA_MIPS3);", "check_mips_64(VAR_1);", "gen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm);", "}", "break;", "case OPC_DADDIU:\ncheck_insn(VAR_1, ISA_MIPS3);", "check_mips_64(VAR_1);", "gen_arith_imm(VAR_1, op, VAR_3, VAR_2, imm);", "break;", "#else\ncase OPC_BNVC:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "gen_compute_compact_branch(VAR_1, op, VAR_2, VAR_3, imm << 2);", "} else {", "MIPS_INVAL(\"major opcode\");", "generate_exception_end(VAR_1, EXCP_RI);", "}", "break;", "#endif\ncase OPC_DAUI:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "#if defined(TARGET_MIPS64)\ncheck_mips_64(VAR_1);", "if (VAR_2 == 0) {", "generate_exception(VAR_1, EXCP_RI);", "} else if (VAR_3 != 0) {", "TCGv t0 = tcg_temp_new();", "gen_load_gpr(t0, VAR_2);", "tcg_gen_addi_tl(cpu_gpr[VAR_3], t0, imm << 16);", "tcg_temp_free(t0);", "}", "#else\ngenerate_exception_end(VAR_1, EXCP_RI);", "MIPS_INVAL(\"major opcode\");", "#endif\n} else {", "check_insn(VAR_1, ASE_MIPS16 | ASE_MICROMIPS);", "offset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2;", "gen_compute_branch(VAR_1, op, 4, VAR_2, VAR_3, offset, 4);", "}", "break;", "case OPC_MSA:\ngen_msa(VAR_0, VAR_1);", "break;", "case OPC_PCREL:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "gen_pcrel(VAR_1, VAR_1->opcode, VAR_1->pc, VAR_2);", "break;", "default:\nMIPS_INVAL(\"major opcode\");", "generate_exception_end(VAR_1, EXCP_RI);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 89, 91, 93, 95 ], [ 97 ], [ 101, 103, 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 163 ], [ 165 ], [ 167, 169, 171, 173, 175 ], [ 177 ], [ 179 ], [ 181, 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211, 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255 ], [ 257, 259 ], [ 261, 263, 265 ], [ 267, 269 ], [ 271, 273, 275 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297, 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341, 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 363 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 381 ], [ 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 ], [ 443 ], [ 445 ], [ 451 ], [ 453 ], [ 455 ], [ 457, 459 ], [ 461 ], [ 463, 465, 467 ], [ 469 ], [ 471, 473, 475, 477, 479 ], [ 481 ], [ 483, 485 ], [ 487 ], [ 489 ], [ 493, 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 507 ], [ 509 ], [ 513 ], [ 515 ], [ 517 ], [ 519, 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 533 ], [ 535 ], [ 539 ], [ 541 ], [ 543 ], [ 545, 547 ], [ 551 ], [ 553 ], [ 555 ], [ 559 ], [ 561 ], [ 563 ], [ 565, 567 ], [ 571 ], [ 573 ], [ 575 ], [ 579 ], [ 581 ], [ 583 ], [ 585, 587, 589 ], [ 591 ], [ 595, 597, 599 ], [ 601 ], [ 603, 605 ], [ 609, 611, 613 ], [ 617, 619, 621 ], [ 623 ], [ 625, 627, 629 ], [ 633, 635, 637 ], [ 639 ], [ 641, 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651, 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 667 ], [ 669, 671 ], [ 673 ], [ 677 ], [ 683, 685, 687, 689, 691 ], [ 693 ], [ 697, 699 ], [ 703 ], [ 705, 707, 709 ], [ 711 ], [ 713, 715, 717, 719, 721 ], [ 723 ], [ 725 ], [ 727, 729, 731, 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743, 745, 747 ], [ 749 ], [ 753, 755 ], [ 757 ], [ 761 ], [ 763 ], [ 765, 767 ], [ 769 ], [ 771 ], [ 773, 775 ], [ 777 ], [ 779, 781 ], [ 783 ], [ 785, 787 ], [ 789 ], [ 791 ], [ 793 ], [ 797, 799 ], [ 801 ], [ 803, 805 ], [ 807 ], [ 809, 811 ], [ 815, 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, 899, 901, 903, 905, 907, 909, 911, 913, 915, 917, 919, 921, 923, 925, 927, 929, 931, 933 ], [ 935 ], [ 937, 939, 941 ], [ 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 ], [ 1003, 1005, 1007 ], [ 1011, 1013 ], [ 1015 ], [ 1021 ], [ 1023 ], [ 1025 ], [ 1027, 1029, 1031 ], [ 1033 ], [ 1037, 1039 ], [ 1041 ], [ 1045 ], [ 1047 ], [ 1049 ], [ 1055 ], [ 1057 ], [ 1059 ], [ 1061, 1063 ], [ 1067 ], [ 1069 ], [ 1073, 1075 ], [ 1077 ], [ 1079 ], [ 1081 ], [ 1083 ], [ 1085, 1087, 1089 ], [ 1093, 1095, 1097, 1099, 1101 ], [ 1103 ], [ 1105 ], [ 1107, 1109 ], [ 1113 ], [ 1115, 1117 ], [ 1121, 1123, 1125, 1127, 1129, 1131, 1133, 1135, 1137, 1139, 1141, 1143, 1145 ], [ 1147 ], [ 1149 ], [ 1151, 1153 ], [ 1155 ], [ 1157 ], [ 1159 ], [ 1161 ], [ 1163 ], [ 1165 ], [ 1167 ], [ 1171, 1175, 1177, 1179 ], [ 1183, 1185, 1187 ], [ 1189 ], [ 1191 ], [ 1193 ], [ 1195, 1197 ], [ 1201, 1203 ], [ 1205 ], [ 1207 ], [ 1209 ], [ 1211, 1213 ], [ 1215 ], [ 1217 ], [ 1219 ], [ 1221 ], [ 1223, 1225 ], [ 1229 ], [ 1231 ], [ 1235 ], [ 1237 ], [ 1239 ], [ 1241 ], [ 1243 ], [ 1245, 1247 ], [ 1249 ], [ 1251 ], [ 1253 ], [ 1255, 1257, 1259 ], [ 1261 ], [ 1263 ], [ 1265 ], [ 1267 ], [ 1269 ], [ 1271 ], [ 1273, 1275, 1277 ], [ 1279, 1283 ], [ 1285 ], [ 1287 ], [ 1289 ], [ 1291 ], [ 1293 ], [ 1295 ], [ 1297 ], [ 1299 ], [ 1301, 1303 ], [ 1305 ], [ 1307, 1309 ], [ 1313 ], [ 1315 ], [ 1317 ], [ 1319 ], [ 1321 ], [ 1323, 1327 ], [ 1329 ], [ 1331, 1333 ], [ 1335 ], [ 1337 ], [ 1339, 1341 ], [ 1343 ], [ 1345 ], [ 1347 ], [ 1349 ] ]
22,424
static int mpegts_read_header(AVFormatContext *s, AVFormatParameters *ap) { MpegTSContext *ts = s->priv_data; AVIOContext *pb = s->pb; uint8_t buf[5*1024]; int len; int64_t pos; #if FF_API_FORMAT_PARAMETERS if (ap) { if (ap->mpeg2ts_compute_pcr) ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; if(ap->mpeg2ts_raw){ av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n"); return -1; } } #endif /* read the first 1024 bytes to get packet size */ pos = avio_tell(pb); len = avio_read(pb, buf, sizeof(buf)); if (len != sizeof(buf)) goto fail; ts->raw_packet_size = get_packet_size(buf, sizeof(buf)); if (ts->raw_packet_size <= 0) goto fail; ts->stream = s; ts->auto_guess = 0; if (s->iformat == &ff_mpegts_demuxer) { /* normal demux */ /* first do a scaning to get all the services */ if (avio_seek(pb, pos, SEEK_SET) < 0) av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n"); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1); handle_packets(ts, s->probesize / ts->raw_packet_size); /* if could not find service, enable auto_guess */ ts->auto_guess = 1; av_dlog(ts->stream, "tuning done\n"); s->ctx_flags |= AVFMTCTX_NOHEADER; } else { AVStream *st; int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l; int64_t pcrs[2], pcr_h; int packet_count[2]; uint8_t packet[TS_PACKET_SIZE]; /* only read packets */ st = av_new_stream(s, 0); if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id = CODEC_ID_MPEG2TS; /* we iterate until we find two PCRs to estimate the bitrate */ pcr_pid = -1; nb_pcrs = 0; nb_packets = 0; for(;;) { ret = read_packet(s, packet, ts->raw_packet_size); if (ret < 0) return -1; pid = AV_RB16(packet + 1) & 0x1fff; if ((pcr_pid == -1 || pcr_pid == pid) && parse_pcr(&pcr_h, &pcr_l, packet) == 0) { pcr_pid = pid; packet_count[nb_pcrs] = nb_packets; pcrs[nb_pcrs] = pcr_h * 300 + pcr_l; nb_pcrs++; if (nb_pcrs >= 2) break; } nb_packets++; } /* NOTE1: the bitrate is computed without the FEC */ /* NOTE2: it is only the bitrate of the start of the stream */ ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]); ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0]; s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; st->codec->bit_rate = s->bit_rate; st->start_time = ts->cur_pcr; av_dlog(ts->stream, "start=%0.3f pcr=%0.3f incr=%d\n", st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); } avio_seek(pb, pos, SEEK_SET); return 0; fail: return -1; }
false
FFmpeg
298c4e3c522a1bc43cb557efe2e443be2ee80bb5
static int mpegts_read_header(AVFormatContext *s, AVFormatParameters *ap) { MpegTSContext *ts = s->priv_data; AVIOContext *pb = s->pb; uint8_t buf[5*1024]; int len; int64_t pos; #if FF_API_FORMAT_PARAMETERS if (ap) { if (ap->mpeg2ts_compute_pcr) ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; if(ap->mpeg2ts_raw){ av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n"); return -1; } } #endif pos = avio_tell(pb); len = avio_read(pb, buf, sizeof(buf)); if (len != sizeof(buf)) goto fail; ts->raw_packet_size = get_packet_size(buf, sizeof(buf)); if (ts->raw_packet_size <= 0) goto fail; ts->stream = s; ts->auto_guess = 0; if (s->iformat == &ff_mpegts_demuxer) { if (avio_seek(pb, pos, SEEK_SET) < 0) av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n"); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1); handle_packets(ts, s->probesize / ts->raw_packet_size); ts->auto_guess = 1; av_dlog(ts->stream, "tuning done\n"); s->ctx_flags |= AVFMTCTX_NOHEADER; } else { AVStream *st; int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l; int64_t pcrs[2], pcr_h; int packet_count[2]; uint8_t packet[TS_PACKET_SIZE]; st = av_new_stream(s, 0); if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id = CODEC_ID_MPEG2TS; pcr_pid = -1; nb_pcrs = 0; nb_packets = 0; for(;;) { ret = read_packet(s, packet, ts->raw_packet_size); if (ret < 0) return -1; pid = AV_RB16(packet + 1) & 0x1fff; if ((pcr_pid == -1 || pcr_pid == pid) && parse_pcr(&pcr_h, &pcr_l, packet) == 0) { pcr_pid = pid; packet_count[nb_pcrs] = nb_packets; pcrs[nb_pcrs] = pcr_h * 300 + pcr_l; nb_pcrs++; if (nb_pcrs >= 2) break; } nb_packets++; } ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]); ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0]; s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; st->codec->bit_rate = s->bit_rate; st->start_time = ts->cur_pcr; av_dlog(ts->stream, "start=%0.3f pcr=%0.3f incr=%d\n", st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); } avio_seek(pb, pos, SEEK_SET); return 0; fail: return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { MpegTSContext *ts = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; uint8_t buf[5*1024]; int VAR_2; int64_t pos; #if FF_API_FORMAT_PARAMETERS if (VAR_1) { if (VAR_1->mpeg2ts_compute_pcr) ts->mpeg2ts_compute_pcr = VAR_1->mpeg2ts_compute_pcr; if(VAR_1->mpeg2ts_raw){ av_log(VAR_0, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n"); return -1; } } #endif pos = avio_tell(pb); VAR_2 = avio_read(pb, buf, sizeof(buf)); if (VAR_2 != sizeof(buf)) goto fail; ts->raw_packet_size = get_packet_size(buf, sizeof(buf)); if (ts->raw_packet_size <= 0) goto fail; ts->stream = VAR_0; ts->auto_guess = 0; if (VAR_0->iformat == &ff_mpegts_demuxer) { if (avio_seek(pb, pos, SEEK_SET) < 0) av_log(VAR_0, AV_LOG_ERROR, "Unable to seek back to the start\n"); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1); handle_packets(ts, VAR_0->probesize / ts->raw_packet_size); ts->auto_guess = 1; av_dlog(ts->stream, "tuning done\n"); VAR_0->ctx_flags |= AVFMTCTX_NOHEADER; } else { AVStream *st; int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int64_t pcrs[2], pcr_h; int VAR_9[2]; uint8_t packet[TS_PACKET_SIZE]; st = av_new_stream(VAR_0, 0); if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id = CODEC_ID_MPEG2TS; VAR_3 = -1; VAR_6 = 0; VAR_5 = 0; for(;;) { VAR_7 = read_packet(VAR_0, packet, ts->raw_packet_size); if (VAR_7 < 0) return -1; VAR_4 = AV_RB16(packet + 1) & 0x1fff; if ((VAR_3 == -1 || VAR_3 == VAR_4) && parse_pcr(&pcr_h, &VAR_8, packet) == 0) { VAR_3 = VAR_4; VAR_9[VAR_6] = VAR_5; pcrs[VAR_6] = pcr_h * 300 + VAR_8; VAR_6++; if (VAR_6 >= 2) break; } VAR_5++; } ts->pcr_incr = (pcrs[1] - pcrs[0]) / (VAR_9[1] - VAR_9[0]); ts->cur_pcr = pcrs[0] - ts->pcr_incr * VAR_9[0]; VAR_0->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; st->codec->bit_rate = VAR_0->bit_rate; st->start_time = ts->cur_pcr; av_dlog(ts->stream, "start=%0.3f pcr=%0.3f incr=%d\n", st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); } avio_seek(pb, pos, SEEK_SET); return 0; fail: return -1; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{", "MpegTSContext *ts = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "uint8_t buf[5*1024];", "int VAR_2;", "int64_t pos;", "#if FF_API_FORMAT_PARAMETERS\nif (VAR_1) {", "if (VAR_1->mpeg2ts_compute_pcr)\nts->mpeg2ts_compute_pcr = VAR_1->mpeg2ts_compute_pcr;", "if(VAR_1->mpeg2ts_raw){", "av_log(VAR_0, AV_LOG_ERROR, \"use mpegtsraw_demuxer!\\n\");", "return -1;", "}", "}", "#endif\npos = avio_tell(pb);", "VAR_2 = avio_read(pb, buf, sizeof(buf));", "if (VAR_2 != sizeof(buf))\ngoto fail;", "ts->raw_packet_size = get_packet_size(buf, sizeof(buf));", "if (ts->raw_packet_size <= 0)\ngoto fail;", "ts->stream = VAR_0;", "ts->auto_guess = 0;", "if (VAR_0->iformat == &ff_mpegts_demuxer) {", "if (avio_seek(pb, pos, SEEK_SET) < 0)\nav_log(VAR_0, AV_LOG_ERROR, \"Unable to seek back to the start\\n\");", "mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1);", "mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1);", "handle_packets(ts, VAR_0->probesize / ts->raw_packet_size);", "ts->auto_guess = 1;", "av_dlog(ts->stream, \"tuning done\\n\");", "VAR_0->ctx_flags |= AVFMTCTX_NOHEADER;", "} else {", "AVStream *st;", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "int64_t pcrs[2], pcr_h;", "int VAR_9[2];", "uint8_t packet[TS_PACKET_SIZE];", "st = av_new_stream(VAR_0, 0);", "if (!st)\ngoto fail;", "av_set_pts_info(st, 60, 1, 27000000);", "st->codec->codec_type = AVMEDIA_TYPE_DATA;", "st->codec->codec_id = CODEC_ID_MPEG2TS;", "VAR_3 = -1;", "VAR_6 = 0;", "VAR_5 = 0;", "for(;;) {", "VAR_7 = read_packet(VAR_0, packet, ts->raw_packet_size);", "if (VAR_7 < 0)\nreturn -1;", "VAR_4 = AV_RB16(packet + 1) & 0x1fff;", "if ((VAR_3 == -1 || VAR_3 == VAR_4) &&\nparse_pcr(&pcr_h, &VAR_8, packet) == 0) {", "VAR_3 = VAR_4;", "VAR_9[VAR_6] = VAR_5;", "pcrs[VAR_6] = pcr_h * 300 + VAR_8;", "VAR_6++;", "if (VAR_6 >= 2)\nbreak;", "}", "VAR_5++;", "}", "ts->pcr_incr = (pcrs[1] - pcrs[0]) / (VAR_9[1] - VAR_9[0]);", "ts->cur_pcr = pcrs[0] - ts->pcr_incr * VAR_9[0];", "VAR_0->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;", "st->codec->bit_rate = VAR_0->bit_rate;", "st->start_time = ts->cur_pcr;", "av_dlog(ts->stream, \"start=%0.3f pcr=%0.3f incr=%d\\n\",\nst->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);", "}", "avio_seek(pb, pos, SEEK_SET);", "return 0;", "fail:\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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 63 ], [ 71, 73 ], [ 77 ], [ 81 ], [ 85 ], [ 91 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ] ]
22,427
static void pl080_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->no_user = 1; dc->vmsd = &vmstate_pl080; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void pl080_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->no_user = 1; dc->vmsd = &vmstate_pl080; }
{ "code": [ " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;" ], "line_no": [ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->no_user = 1; dc->vmsd = &vmstate_pl080; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->no_user = 1;", "dc->vmsd = &vmstate_pl080;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
22,428
static void guest_panicked(void) { QObject *data; data = qobject_from_jsonf("{ 'action': %s }", "pause"); monitor_protocol_event(QEVENT_GUEST_PANICKED, data); qobject_decref(data); vm_stop(RUN_STATE_GUEST_PANICKED); }
true
qemu
3a4496903795e05c1e8367bb4c9862d5670f48d7
static void guest_panicked(void) { QObject *data; data = qobject_from_jsonf("{ 'action': %s }", "pause"); monitor_protocol_event(QEVENT_GUEST_PANICKED, data); qobject_decref(data); vm_stop(RUN_STATE_GUEST_PANICKED); }
{ "code": [ " QObject *data;", " monitor_protocol_event(QEVENT_GUEST_PANICKED, data);", " qobject_decref(data);", " QObject *data;", " data = qobject_from_jsonf(\"{ 'action': %s }\", \"pause\");", " monitor_protocol_event(QEVENT_GUEST_PANICKED, data);", " qobject_decref(data);" ], "line_no": [ 5, 11, 13, 5, 9, 11, 13 ] }
static void FUNC_0(void) { QObject *data; data = qobject_from_jsonf("{ 'action': %s }", "pause"); monitor_protocol_event(QEVENT_GUEST_PANICKED, data); qobject_decref(data); vm_stop(RUN_STATE_GUEST_PANICKED); }
[ "static void FUNC_0(void)\n{", "QObject *data;", "data = qobject_from_jsonf(\"{ 'action': %s }\", \"pause\");", "monitor_protocol_event(QEVENT_GUEST_PANICKED, data);", "qobject_decref(data);", "vm_stop(RUN_STATE_GUEST_PANICKED);", "}" ]
[ 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
22,430
void vnc_init_state(VncState *vs) { vs->initialized = true; VncDisplay *vd = vs->vd; vs->last_x = -1; vs->last_y = -1; vs->as.freq = 44100; vs->as.nchannels = 2; vs->as.fmt = AUD_FMT_S16; vs->as.endianness = 0; qemu_mutex_init(&vs->output_mutex); vs->bh = qemu_bh_new(vnc_jobs_bh, vs); QTAILQ_INSERT_HEAD(&vd->clients, vs, next); graphic_hw_update(vd->dcl.con); vnc_write(vs, "RFB 003.008\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); reset_keys(vs); if (vs->vd->lock_key_sync) vs->led = qemu_add_led_event_handler(kbd_leds, vs); vs->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier); /* vs might be free()ed here */ }
true
qemu
e5f34cdd2da54f28d90889a3afd15fad2d6105ff
void vnc_init_state(VncState *vs) { vs->initialized = true; VncDisplay *vd = vs->vd; vs->last_x = -1; vs->last_y = -1; vs->as.freq = 44100; vs->as.nchannels = 2; vs->as.fmt = AUD_FMT_S16; vs->as.endianness = 0; qemu_mutex_init(&vs->output_mutex); vs->bh = qemu_bh_new(vnc_jobs_bh, vs); QTAILQ_INSERT_HEAD(&vd->clients, vs, next); graphic_hw_update(vd->dcl.con); vnc_write(vs, "RFB 003.008\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); reset_keys(vs); if (vs->vd->lock_key_sync) vs->led = qemu_add_led_event_handler(kbd_leds, vs); vs->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier); }
{ "code": [ " QTAILQ_INSERT_HEAD(&vd->clients, vs, next);" ], "line_no": [ 33 ] }
void FUNC_0(VncState *VAR_0) { VAR_0->initialized = true; VncDisplay *vd = VAR_0->vd; VAR_0->last_x = -1; VAR_0->last_y = -1; VAR_0->as.freq = 44100; VAR_0->as.nchannels = 2; VAR_0->as.fmt = AUD_FMT_S16; VAR_0->as.endianness = 0; qemu_mutex_init(&VAR_0->output_mutex); VAR_0->bh = qemu_bh_new(vnc_jobs_bh, VAR_0); QTAILQ_INSERT_HEAD(&vd->clients, VAR_0, next); graphic_hw_update(vd->dcl.con); vnc_write(VAR_0, "RFB 003.008\n", 12); vnc_flush(VAR_0); vnc_read_when(VAR_0, protocol_version, 12); reset_keys(VAR_0); if (VAR_0->vd->lock_key_sync) VAR_0->led = qemu_add_led_event_handler(kbd_leds, VAR_0); VAR_0->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier); }
[ "void FUNC_0(VncState *VAR_0)\n{", "VAR_0->initialized = true;", "VncDisplay *vd = VAR_0->vd;", "VAR_0->last_x = -1;", "VAR_0->last_y = -1;", "VAR_0->as.freq = 44100;", "VAR_0->as.nchannels = 2;", "VAR_0->as.fmt = AUD_FMT_S16;", "VAR_0->as.endianness = 0;", "qemu_mutex_init(&VAR_0->output_mutex);", "VAR_0->bh = qemu_bh_new(vnc_jobs_bh, VAR_0);", "QTAILQ_INSERT_HEAD(&vd->clients, VAR_0, next);", "graphic_hw_update(vd->dcl.con);", "vnc_write(VAR_0, \"RFB 003.008\\n\", 12);", "vnc_flush(VAR_0);", "vnc_read_when(VAR_0, protocol_version, 12);", "reset_keys(VAR_0);", "if (VAR_0->vd->lock_key_sync)\nVAR_0->led = qemu_add_led_event_handler(kbd_leds, VAR_0);", "VAR_0->mouse_mode_notifier.notify = check_pointer_type_change;", "qemu_add_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier);", "}" ]
[ 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 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 63 ] ]
22,432
static void puv3_load_kernel(const char *kernel_filename) { int size; if (kernel_filename == NULL && qtest_enabled()) { return; } assert(kernel_filename != NULL); /* only zImage format supported */ size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE); if (size < 0) { error_report("Load kernel error: '%s'", kernel_filename); exit(1); } /* cheat curses that we have a graphic console, only under ocd console */ graphic_console_init(NULL, 0, &no_ops, NULL); }
true
qemu
36bed541ca886da735bef1e8d76d09f8849ed5dd
static void puv3_load_kernel(const char *kernel_filename) { int size; if (kernel_filename == NULL && qtest_enabled()) { return; } assert(kernel_filename != NULL); size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE); if (size < 0) { error_report("Load kernel error: '%s'", kernel_filename); exit(1); } graphic_console_init(NULL, 0, &no_ops, NULL); }
{ "code": [ " assert(kernel_filename != NULL);" ], "line_no": [ 15 ] }
static void FUNC_0(const char *VAR_0) { int VAR_1; if (VAR_0 == NULL && qtest_enabled()) { return; } assert(VAR_0 != NULL); VAR_1 = load_image_targphys(VAR_0, KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE); if (VAR_1 < 0) { error_report("Load kernel error: '%s'", VAR_0); exit(1); } graphic_console_init(NULL, 0, &no_ops, NULL); }
[ "static void FUNC_0(const char *VAR_0)\n{", "int VAR_1;", "if (VAR_0 == NULL && qtest_enabled()) {", "return;", "}", "assert(VAR_0 != NULL);", "VAR_1 = load_image_targphys(VAR_0, KERNEL_LOAD_ADDR,\nKERNEL_MAX_SIZE);", "if (VAR_1 < 0) {", "error_report(\"Load kernel error: '%s'\", VAR_0);", "exit(1);", "}", "graphic_console_init(NULL, 0, &no_ops, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ] ]
22,433
static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int entries, i, j; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_rb32(pb); // version + flags entries = avio_rb32(pb); if (entries > (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 || entries >= UINT_MAX / sizeof(*sc->drefs)) return AVERROR_INVALIDDATA; av_free(sc->drefs); sc->drefs_count = 0; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); if (!sc->drefs) return AVERROR(ENOMEM); sc->drefs_count = entries; for (i = 0; i < sc->drefs_count; i++) { MOVDref *dref = &sc->drefs[i]; uint32_t size = avio_rb32(pb); int64_t next = avio_tell(pb) + size - 4; if (size < 12) return AVERROR_INVALIDDATA; dref->type = avio_rl32(pb); avio_rb32(pb); // version + flags av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { /* macintosh alias record */ uint16_t volume_len, len; int16_t type; avio_skip(pb, 10); volume_len = avio_r8(pb); volume_len = FFMIN(volume_len, 27); avio_read(pb, dref->volume, 27); dref->volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); avio_skip(pb, 12); len = avio_r8(pb); len = FFMIN(len, 63); avio_read(pb, dref->filename, 63); dref->filename[len] = 0; av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); avio_skip(pb, 16); /* read next level up_from_alias/down_to_target */ dref->nlvl_from = avio_rb16(pb); dref->nlvl_to = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", dref->nlvl_from, dref->nlvl_to); avio_skip(pb, 16); for (type = 0; type != -1 && avio_tell(pb) < next; ) { if(url_feof(pb)) return AVERROR_EOF; type = avio_rb16(pb); len = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { // absolute path av_free(dref->path); dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); avio_read(pb, dref->path, len); if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (j = 0; j < len; j++) if (dref->path[j] == ':') dref->path[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else if (type == 0) { // directory name av_free(dref->dir); dref->dir = av_malloc(len+1); if (!dref->dir) return AVERROR(ENOMEM); avio_read(pb, dref->dir, len); dref->dir[len] = 0; for (j = 0; j < len; j++) if (dref->dir[j] == ':') dref->dir[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); } else avio_skip(pb, len); } } avio_seek(pb, next, SEEK_SET); } return 0; }
true
FFmpeg
4156df59f59626f60186a4effed80f60c9c4e8cc
static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int entries, i, j; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_rb32(pb); entries = avio_rb32(pb); if (entries > (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 || entries >= UINT_MAX / sizeof(*sc->drefs)) return AVERROR_INVALIDDATA; av_free(sc->drefs); sc->drefs_count = 0; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); if (!sc->drefs) return AVERROR(ENOMEM); sc->drefs_count = entries; for (i = 0; i < sc->drefs_count; i++) { MOVDref *dref = &sc->drefs[i]; uint32_t size = avio_rb32(pb); int64_t next = avio_tell(pb) + size - 4; if (size < 12) return AVERROR_INVALIDDATA; dref->type = avio_rl32(pb); avio_rb32(pb); av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { uint16_t volume_len, len; int16_t type; avio_skip(pb, 10); volume_len = avio_r8(pb); volume_len = FFMIN(volume_len, 27); avio_read(pb, dref->volume, 27); dref->volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); avio_skip(pb, 12); len = avio_r8(pb); len = FFMIN(len, 63); avio_read(pb, dref->filename, 63); dref->filename[len] = 0; av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); avio_skip(pb, 16); dref->nlvl_from = avio_rb16(pb); dref->nlvl_to = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", dref->nlvl_from, dref->nlvl_to); avio_skip(pb, 16); for (type = 0; type != -1 && avio_tell(pb) < next; ) { if(url_feof(pb)) return AVERROR_EOF; type = avio_rb16(pb); len = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { av_free(dref->path); dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); avio_read(pb, dref->path, len); if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (j = 0; j < len; j++) if (dref->path[j] == ':') dref->path[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else if (type == 0) { av_free(dref->dir); dref->dir = av_malloc(len+1); if (!dref->dir) return AVERROR(ENOMEM); avio_read(pb, dref->dir, len); dref->dir[len] = 0; for (j = 0; j < len; j++) if (dref->dir[j] == ':') dref->dir[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); } else avio_skip(pb, len); } } avio_seek(pb, next, SEEK_SET); } return 0; }
{ "code": [ " avio_read(pb, dref->dir, len);" ], "line_no": [ 189 ] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; int VAR_3, VAR_4, VAR_5; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; avio_rb32(VAR_1); VAR_3 = avio_rb32(VAR_1); if (VAR_3 > (VAR_2.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 || VAR_3 >= UINT_MAX / sizeof(*sc->drefs)) return AVERROR_INVALIDDATA; av_free(sc->drefs); sc->drefs_count = 0; sc->drefs = av_mallocz(VAR_3 * sizeof(*sc->drefs)); if (!sc->drefs) return AVERROR(ENOMEM); sc->drefs_count = VAR_3; for (VAR_4 = 0; VAR_4 < sc->drefs_count; VAR_4++) { MOVDref *dref = &sc->drefs[VAR_4]; uint32_t size = avio_rb32(VAR_1); int64_t next = avio_tell(VAR_1) + size - 4; if (size < 12) return AVERROR_INVALIDDATA; dref->type = avio_rl32(VAR_1); avio_rb32(VAR_1); av_dlog(VAR_0->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','VAR_4','s') && size > 150) { uint16_t volume_len, len; int16_t type; avio_skip(VAR_1, 10); volume_len = avio_r8(VAR_1); volume_len = FFMIN(volume_len, 27); avio_read(VAR_1, dref->volume, 27); dref->volume[volume_len] = 0; av_log(VAR_0->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); avio_skip(VAR_1, 12); len = avio_r8(VAR_1); len = FFMIN(len, 63); avio_read(VAR_1, dref->filename, 63); dref->filename[len] = 0; av_log(VAR_0->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); avio_skip(VAR_1, 16); dref->nlvl_from = avio_rb16(VAR_1); dref->nlvl_to = avio_rb16(VAR_1); av_log(VAR_0->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", dref->nlvl_from, dref->nlvl_to); avio_skip(VAR_1, 16); for (type = 0; type != -1 && avio_tell(VAR_1) < next; ) { if(url_feof(VAR_1)) return AVERROR_EOF; type = avio_rb16(VAR_1); len = avio_rb16(VAR_1); av_log(VAR_0->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { av_free(dref->path); dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); avio_read(VAR_1, dref->path, len); if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (VAR_5 = 0; VAR_5 < len; VAR_5++) if (dref->path[VAR_5] == ':') dref->path[VAR_5] = '/'; av_log(VAR_0->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else if (type == 0) { av_free(dref->dir); dref->dir = av_malloc(len+1); if (!dref->dir) return AVERROR(ENOMEM); avio_read(VAR_1, dref->dir, len); dref->dir[len] = 0; for (VAR_5 = 0; VAR_5 < len; VAR_5++) if (dref->dir[VAR_5] == ':') dref->dir[VAR_5] = '/'; av_log(VAR_0->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); } else avio_skip(VAR_1, len); } } avio_seek(VAR_1, next, SEEK_SET); } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "int VAR_3, VAR_4, VAR_5;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "avio_rb32(VAR_1);", "VAR_3 = avio_rb32(VAR_1);", "if (VAR_3 > (VAR_2.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||\nVAR_3 >= UINT_MAX / sizeof(*sc->drefs))\nreturn AVERROR_INVALIDDATA;", "av_free(sc->drefs);", "sc->drefs_count = 0;", "sc->drefs = av_mallocz(VAR_3 * sizeof(*sc->drefs));", "if (!sc->drefs)\nreturn AVERROR(ENOMEM);", "sc->drefs_count = VAR_3;", "for (VAR_4 = 0; VAR_4 < sc->drefs_count; VAR_4++) {", "MOVDref *dref = &sc->drefs[VAR_4];", "uint32_t size = avio_rb32(VAR_1);", "int64_t next = avio_tell(VAR_1) + size - 4;", "if (size < 12)\nreturn AVERROR_INVALIDDATA;", "dref->type = avio_rl32(VAR_1);", "avio_rb32(VAR_1);", "av_dlog(VAR_0->fc, \"type %.4s size %d\\n\", (char*)&dref->type, size);", "if (dref->type == MKTAG('a','l','VAR_4','s') && size > 150) {", "uint16_t volume_len, len;", "int16_t type;", "avio_skip(VAR_1, 10);", "volume_len = avio_r8(VAR_1);", "volume_len = FFMIN(volume_len, 27);", "avio_read(VAR_1, dref->volume, 27);", "dref->volume[volume_len] = 0;", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"volume %s, len %d\\n\", dref->volume, volume_len);", "avio_skip(VAR_1, 12);", "len = avio_r8(VAR_1);", "len = FFMIN(len, 63);", "avio_read(VAR_1, dref->filename, 63);", "dref->filename[len] = 0;", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"filename %s, len %d\\n\", dref->filename, len);", "avio_skip(VAR_1, 16);", "dref->nlvl_from = avio_rb16(VAR_1);", "dref->nlvl_to = avio_rb16(VAR_1);", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"nlvl from %d, nlvl to %d\\n\",\ndref->nlvl_from, dref->nlvl_to);", "avio_skip(VAR_1, 16);", "for (type = 0; type != -1 && avio_tell(VAR_1) < next; ) {", "if(url_feof(VAR_1))\nreturn AVERROR_EOF;", "type = avio_rb16(VAR_1);", "len = avio_rb16(VAR_1);", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"type %d, len %d\\n\", type, len);", "if (len&1)\nlen += 1;", "if (type == 2) {", "av_free(dref->path);", "dref->path = av_mallocz(len+1);", "if (!dref->path)\nreturn AVERROR(ENOMEM);", "avio_read(VAR_1, dref->path, len);", "if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) {", "len -= volume_len;", "memmove(dref->path, dref->path+volume_len, len);", "dref->path[len] = 0;", "}", "for (VAR_5 = 0; VAR_5 < len; VAR_5++)", "if (dref->path[VAR_5] == ':')\ndref->path[VAR_5] = '/';", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"path %s\\n\", dref->path);", "} else if (type == 0) {", "av_free(dref->dir);", "dref->dir = av_malloc(len+1);", "if (!dref->dir)\nreturn AVERROR(ENOMEM);", "avio_read(VAR_1, dref->dir, len);", "dref->dir[len] = 0;", "for (VAR_5 = 0; VAR_5 < len; VAR_5++)", "if (dref->dir[VAR_5] == ':')\ndref->dir[VAR_5] = '/';", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"dir %s\\n\", dref->dir);", "} else", "avio_skip(VAR_1, len);", "}", "}", "avio_seek(VAR_1, next, SEEK_SET);", "}", "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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ] ]
22,434
static void init_blk_migration(QEMUFile *f) { BlockDriverState *bs; BlkMigDevState *bmds; int64_t sectors; block_mig_state.submitted = 0; block_mig_state.read_done = 0; block_mig_state.transferred = 0; block_mig_state.total_sector_sum = 0; block_mig_state.prev_progress = -1; block_mig_state.bulk_completed = 0; block_mig_state.zero_blocks = migrate_zero_blocks(); for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) { if (bdrv_is_read_only(bs)) { continue; } sectors = bdrv_nb_sectors(bs); if (sectors <= 0) { return; } bmds = g_new0(BlkMigDevState, 1); bmds->bs = bs; bmds->bulk_completed = 0; bmds->total_sectors = sectors; bmds->completed_sectors = 0; bmds->shared_base = block_mig_state.shared_base; alloc_aio_bitmap(bmds); error_setg(&bmds->blocker, "block device is in use by migration"); bdrv_op_block_all(bs, bmds->blocker); bdrv_ref(bs); block_mig_state.total_sector_sum += sectors; if (bmds->shared_base) { DPRINTF("Start migration for %s with shared base image\n", bdrv_get_device_name(bs)); } else { DPRINTF("Start full migration for %s\n", bdrv_get_device_name(bs)); } QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); } }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void init_blk_migration(QEMUFile *f) { BlockDriverState *bs; BlkMigDevState *bmds; int64_t sectors; block_mig_state.submitted = 0; block_mig_state.read_done = 0; block_mig_state.transferred = 0; block_mig_state.total_sector_sum = 0; block_mig_state.prev_progress = -1; block_mig_state.bulk_completed = 0; block_mig_state.zero_blocks = migrate_zero_blocks(); for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) { if (bdrv_is_read_only(bs)) { continue; } sectors = bdrv_nb_sectors(bs); if (sectors <= 0) { return; } bmds = g_new0(BlkMigDevState, 1); bmds->bs = bs; bmds->bulk_completed = 0; bmds->total_sectors = sectors; bmds->completed_sectors = 0; bmds->shared_base = block_mig_state.shared_base; alloc_aio_bitmap(bmds); error_setg(&bmds->blocker, "block device is in use by migration"); bdrv_op_block_all(bs, bmds->blocker); bdrv_ref(bs); block_mig_state.total_sector_sum += sectors; if (bmds->shared_base) { DPRINTF("Start migration for %s with shared base image\n", bdrv_get_device_name(bs)); } else { DPRINTF("Start full migration for %s\n", bdrv_get_device_name(bs)); } QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); } }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUFile *VAR_0) { BlockDriverState *bs; BlkMigDevState *bmds; int64_t sectors; block_mig_state.submitted = 0; block_mig_state.read_done = 0; block_mig_state.transferred = 0; block_mig_state.total_sector_sum = 0; block_mig_state.prev_progress = -1; block_mig_state.bulk_completed = 0; block_mig_state.zero_blocks = migrate_zero_blocks(); for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) { if (bdrv_is_read_only(bs)) { continue; } sectors = bdrv_nb_sectors(bs); if (sectors <= 0) { return; } bmds = g_new0(BlkMigDevState, 1); bmds->bs = bs; bmds->bulk_completed = 0; bmds->total_sectors = sectors; bmds->completed_sectors = 0; bmds->shared_base = block_mig_state.shared_base; alloc_aio_bitmap(bmds); error_setg(&bmds->blocker, "block device is in use by migration"); bdrv_op_block_all(bs, bmds->blocker); bdrv_ref(bs); block_mig_state.total_sector_sum += sectors; if (bmds->shared_base) { DPRINTF("Start migration for %s with shared base image\n", bdrv_get_device_name(bs)); } else { DPRINTF("Start full migration for %s\n", bdrv_get_device_name(bs)); } QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); } }
[ "static void FUNC_0(QEMUFile *VAR_0)\n{", "BlockDriverState *bs;", "BlkMigDevState *bmds;", "int64_t sectors;", "block_mig_state.submitted = 0;", "block_mig_state.read_done = 0;", "block_mig_state.transferred = 0;", "block_mig_state.total_sector_sum = 0;", "block_mig_state.prev_progress = -1;", "block_mig_state.bulk_completed = 0;", "block_mig_state.zero_blocks = migrate_zero_blocks();", "for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) {", "if (bdrv_is_read_only(bs)) {", "continue;", "}", "sectors = bdrv_nb_sectors(bs);", "if (sectors <= 0) {", "return;", "}", "bmds = g_new0(BlkMigDevState, 1);", "bmds->bs = bs;", "bmds->bulk_completed = 0;", "bmds->total_sectors = sectors;", "bmds->completed_sectors = 0;", "bmds->shared_base = block_mig_state.shared_base;", "alloc_aio_bitmap(bmds);", "error_setg(&bmds->blocker, \"block device is in use by migration\");", "bdrv_op_block_all(bs, bmds->blocker);", "bdrv_ref(bs);", "block_mig_state.total_sector_sum += sectors;", "if (bmds->shared_base) {", "DPRINTF(\"Start migration for %s with shared base image\\n\",\nbdrv_get_device_name(bs));", "} else {", "DPRINTF(\"Start full migration for %s\\n\", bdrv_get_device_name(bs));", "}", "QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ] ]
22,435
int ff_pulse_audio_get_devices(AVDeviceInfoList *devices, const char *server, int output) { pa_mainloop *pa_ml = NULL; pa_mainloop_api *pa_mlapi = NULL; pa_operation *pa_op = NULL; pa_context *pa_ctx = NULL; enum pa_operation_state op_state; enum PulseAudioContextState loop_state = PULSE_CONTEXT_INITIALIZING; PulseAudioDeviceList dev_list = { 0 }; int i; dev_list.output = output; dev_list.devices = devices; if (!devices) return AVERROR(EINVAL); devices->nb_devices = 0; devices->devices = NULL; if (!(pa_ml = pa_mainloop_new())) return AVERROR(ENOMEM); if (!(pa_mlapi = pa_mainloop_get_api(pa_ml))) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } if (!(pa_ctx = pa_context_new(pa_mlapi, "Query devices"))) { dev_list.error_code = AVERROR(ENOMEM); goto fail; } pa_context_set_state_callback(pa_ctx, pa_state_cb, &loop_state); if (pa_context_connect(pa_ctx, server, 0, NULL) < 0) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } while (loop_state == PULSE_CONTEXT_INITIALIZING) pa_mainloop_iterate(pa_ml, 1, NULL); if (loop_state == PULSE_CONTEXT_FINISHED) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } if (output) pa_op = pa_context_get_sink_info_list(pa_ctx, pulse_audio_sink_device_cb, &dev_list); else pa_op = pa_context_get_source_info_list(pa_ctx, pulse_audio_source_device_cb, &dev_list); while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING) pa_mainloop_iterate(pa_ml, 1, NULL); if (op_state != PA_OPERATION_DONE) dev_list.error_code = AVERROR_EXTERNAL; pa_operation_unref(pa_op); if (dev_list.error_code < 0) goto fail; pa_op = pa_context_get_server_info(pa_ctx, pulse_server_info_cb, &dev_list); while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING) pa_mainloop_iterate(pa_ml, 1, NULL); if (op_state != PA_OPERATION_DONE) dev_list.error_code = AVERROR_EXTERNAL; pa_operation_unref(pa_op); if (dev_list.error_code < 0) goto fail; devices->default_device = -1; for (i = 0; i < devices->nb_devices; i++) { if (!strcmp(devices->devices[i]->device_name, dev_list.default_device)) { devices->default_device = i; break; } } fail: av_free(dev_list.default_device); if(pa_ctx) pa_context_disconnect(pa_ctx); if (pa_ctx) pa_context_unref(pa_ctx); if (pa_ml) pa_mainloop_free(pa_ml); return dev_list.error_code; }
false
FFmpeg
176046d2b59c2042cd35a58848d4964563287f63
int ff_pulse_audio_get_devices(AVDeviceInfoList *devices, const char *server, int output) { pa_mainloop *pa_ml = NULL; pa_mainloop_api *pa_mlapi = NULL; pa_operation *pa_op = NULL; pa_context *pa_ctx = NULL; enum pa_operation_state op_state; enum PulseAudioContextState loop_state = PULSE_CONTEXT_INITIALIZING; PulseAudioDeviceList dev_list = { 0 }; int i; dev_list.output = output; dev_list.devices = devices; if (!devices) return AVERROR(EINVAL); devices->nb_devices = 0; devices->devices = NULL; if (!(pa_ml = pa_mainloop_new())) return AVERROR(ENOMEM); if (!(pa_mlapi = pa_mainloop_get_api(pa_ml))) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } if (!(pa_ctx = pa_context_new(pa_mlapi, "Query devices"))) { dev_list.error_code = AVERROR(ENOMEM); goto fail; } pa_context_set_state_callback(pa_ctx, pa_state_cb, &loop_state); if (pa_context_connect(pa_ctx, server, 0, NULL) < 0) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } while (loop_state == PULSE_CONTEXT_INITIALIZING) pa_mainloop_iterate(pa_ml, 1, NULL); if (loop_state == PULSE_CONTEXT_FINISHED) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } if (output) pa_op = pa_context_get_sink_info_list(pa_ctx, pulse_audio_sink_device_cb, &dev_list); else pa_op = pa_context_get_source_info_list(pa_ctx, pulse_audio_source_device_cb, &dev_list); while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING) pa_mainloop_iterate(pa_ml, 1, NULL); if (op_state != PA_OPERATION_DONE) dev_list.error_code = AVERROR_EXTERNAL; pa_operation_unref(pa_op); if (dev_list.error_code < 0) goto fail; pa_op = pa_context_get_server_info(pa_ctx, pulse_server_info_cb, &dev_list); while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING) pa_mainloop_iterate(pa_ml, 1, NULL); if (op_state != PA_OPERATION_DONE) dev_list.error_code = AVERROR_EXTERNAL; pa_operation_unref(pa_op); if (dev_list.error_code < 0) goto fail; devices->default_device = -1; for (i = 0; i < devices->nb_devices; i++) { if (!strcmp(devices->devices[i]->device_name, dev_list.default_device)) { devices->default_device = i; break; } } fail: av_free(dev_list.default_device); if(pa_ctx) pa_context_disconnect(pa_ctx); if (pa_ctx) pa_context_unref(pa_ctx); if (pa_ml) pa_mainloop_free(pa_ml); return dev_list.error_code; }
{ "code": [], "line_no": [] }
int FUNC_0(AVDeviceInfoList *VAR_0, const char *VAR_1, int VAR_2) { pa_mainloop *pa_ml = NULL; pa_mainloop_api *pa_mlapi = NULL; pa_operation *pa_op = NULL; pa_context *pa_ctx = NULL; enum pa_operation_state VAR_3; enum PulseAudioContextState VAR_4 = PULSE_CONTEXT_INITIALIZING; PulseAudioDeviceList dev_list = { 0 }; int VAR_5; dev_list.VAR_2 = VAR_2; dev_list.VAR_0 = VAR_0; if (!VAR_0) return AVERROR(EINVAL); VAR_0->nb_devices = 0; VAR_0->VAR_0 = NULL; if (!(pa_ml = pa_mainloop_new())) return AVERROR(ENOMEM); if (!(pa_mlapi = pa_mainloop_get_api(pa_ml))) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } if (!(pa_ctx = pa_context_new(pa_mlapi, "Query VAR_0"))) { dev_list.error_code = AVERROR(ENOMEM); goto fail; } pa_context_set_state_callback(pa_ctx, pa_state_cb, &VAR_4); if (pa_context_connect(pa_ctx, VAR_1, 0, NULL) < 0) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } while (VAR_4 == PULSE_CONTEXT_INITIALIZING) pa_mainloop_iterate(pa_ml, 1, NULL); if (VAR_4 == PULSE_CONTEXT_FINISHED) { dev_list.error_code = AVERROR_EXTERNAL; goto fail; } if (VAR_2) pa_op = pa_context_get_sink_info_list(pa_ctx, pulse_audio_sink_device_cb, &dev_list); else pa_op = pa_context_get_source_info_list(pa_ctx, pulse_audio_source_device_cb, &dev_list); while ((VAR_3 = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING) pa_mainloop_iterate(pa_ml, 1, NULL); if (VAR_3 != PA_OPERATION_DONE) dev_list.error_code = AVERROR_EXTERNAL; pa_operation_unref(pa_op); if (dev_list.error_code < 0) goto fail; pa_op = pa_context_get_server_info(pa_ctx, pulse_server_info_cb, &dev_list); while ((VAR_3 = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING) pa_mainloop_iterate(pa_ml, 1, NULL); if (VAR_3 != PA_OPERATION_DONE) dev_list.error_code = AVERROR_EXTERNAL; pa_operation_unref(pa_op); if (dev_list.error_code < 0) goto fail; VAR_0->default_device = -1; for (VAR_5 = 0; VAR_5 < VAR_0->nb_devices; VAR_5++) { if (!strcmp(VAR_0->VAR_0[VAR_5]->device_name, dev_list.default_device)) { VAR_0->default_device = VAR_5; break; } } fail: av_free(dev_list.default_device); if(pa_ctx) pa_context_disconnect(pa_ctx); if (pa_ctx) pa_context_unref(pa_ctx); if (pa_ml) pa_mainloop_free(pa_ml); return dev_list.error_code; }
[ "int FUNC_0(AVDeviceInfoList *VAR_0, const char *VAR_1, int VAR_2)\n{", "pa_mainloop *pa_ml = NULL;", "pa_mainloop_api *pa_mlapi = NULL;", "pa_operation *pa_op = NULL;", "pa_context *pa_ctx = NULL;", "enum pa_operation_state VAR_3;", "enum PulseAudioContextState VAR_4 = PULSE_CONTEXT_INITIALIZING;", "PulseAudioDeviceList dev_list = { 0 };", "int VAR_5;", "dev_list.VAR_2 = VAR_2;", "dev_list.VAR_0 = VAR_0;", "if (!VAR_0)\nreturn AVERROR(EINVAL);", "VAR_0->nb_devices = 0;", "VAR_0->VAR_0 = NULL;", "if (!(pa_ml = pa_mainloop_new()))\nreturn AVERROR(ENOMEM);", "if (!(pa_mlapi = pa_mainloop_get_api(pa_ml))) {", "dev_list.error_code = AVERROR_EXTERNAL;", "goto fail;", "}", "if (!(pa_ctx = pa_context_new(pa_mlapi, \"Query VAR_0\"))) {", "dev_list.error_code = AVERROR(ENOMEM);", "goto fail;", "}", "pa_context_set_state_callback(pa_ctx, pa_state_cb, &VAR_4);", "if (pa_context_connect(pa_ctx, VAR_1, 0, NULL) < 0) {", "dev_list.error_code = AVERROR_EXTERNAL;", "goto fail;", "}", "while (VAR_4 == PULSE_CONTEXT_INITIALIZING)\npa_mainloop_iterate(pa_ml, 1, NULL);", "if (VAR_4 == PULSE_CONTEXT_FINISHED) {", "dev_list.error_code = AVERROR_EXTERNAL;", "goto fail;", "}", "if (VAR_2)\npa_op = pa_context_get_sink_info_list(pa_ctx, pulse_audio_sink_device_cb, &dev_list);", "else\npa_op = pa_context_get_source_info_list(pa_ctx, pulse_audio_source_device_cb, &dev_list);", "while ((VAR_3 = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING)\npa_mainloop_iterate(pa_ml, 1, NULL);", "if (VAR_3 != PA_OPERATION_DONE)\ndev_list.error_code = AVERROR_EXTERNAL;", "pa_operation_unref(pa_op);", "if (dev_list.error_code < 0)\ngoto fail;", "pa_op = pa_context_get_server_info(pa_ctx, pulse_server_info_cb, &dev_list);", "while ((VAR_3 = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING)\npa_mainloop_iterate(pa_ml, 1, NULL);", "if (VAR_3 != PA_OPERATION_DONE)\ndev_list.error_code = AVERROR_EXTERNAL;", "pa_operation_unref(pa_op);", "if (dev_list.error_code < 0)\ngoto fail;", "VAR_0->default_device = -1;", "for (VAR_5 = 0; VAR_5 < VAR_0->nb_devices; VAR_5++) {", "if (!strcmp(VAR_0->VAR_0[VAR_5]->device_name, dev_list.default_device)) {", "VAR_0->default_device = VAR_5;", "break;", "}", "}", "fail:\nav_free(dev_list.default_device);", "if(pa_ctx)\npa_context_disconnect(pa_ctx);", "if (pa_ctx)\npa_context_unref(pa_ctx);", "if (pa_ml)\npa_mainloop_free(pa_ml);", "return dev_list.error_code;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85, 87 ], [ 89, 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 143, 145 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157 ] ]
22,438
void virtio_scsi_dataplane_stop(VirtIOSCSI *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIODevice *vdev = VIRTIO_DEVICE(s); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); int i; if (!s->dataplane_started || s->dataplane_stopping) { return; } error_free(s->blocker); s->blocker = NULL; s->dataplane_stopping = true; assert(s->ctx == iothread_get_aio_context(vs->conf.iothread)); aio_context_acquire(s->ctx); aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier, NULL); aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier, NULL); for (i = 0; i < vs->conf.num_queues; i++) { aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier, NULL); } blk_drain_all(); /* ensure there are no in-flight requests */ aio_context_release(s->ctx); /* Sync vring state back to virtqueue so that non-dataplane request * processing can continue when we disable the host notifier below. */ vring_teardown(&s->ctrl_vring->vring, vdev, 0); vring_teardown(&s->event_vring->vring, vdev, 1); for (i = 0; i < vs->conf.num_queues; i++) { vring_teardown(&s->cmd_vrings[i]->vring, vdev, 2 + i); } for (i = 0; i < vs->conf.num_queues + 2; i++) { k->set_host_notifier(qbus->parent, i, false); } /* Clean up guest notifier (irq) */ k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false); s->dataplane_stopping = false; s->dataplane_started = false; }
true
qemu
361dcc790db8c87b2e46ab610739191ced894c44
void virtio_scsi_dataplane_stop(VirtIOSCSI *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIODevice *vdev = VIRTIO_DEVICE(s); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); int i; if (!s->dataplane_started || s->dataplane_stopping) { return; } error_free(s->blocker); s->blocker = NULL; s->dataplane_stopping = true; assert(s->ctx == iothread_get_aio_context(vs->conf.iothread)); aio_context_acquire(s->ctx); aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier, NULL); aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier, NULL); for (i = 0; i < vs->conf.num_queues; i++) { aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier, NULL); } blk_drain_all(); aio_context_release(s->ctx); vring_teardown(&s->ctrl_vring->vring, vdev, 0); vring_teardown(&s->event_vring->vring, vdev, 1); for (i = 0; i < vs->conf.num_queues; i++) { vring_teardown(&s->cmd_vrings[i]->vring, vdev, 2 + i); } for (i = 0; i < vs->conf.num_queues + 2; i++) { k->set_host_notifier(qbus->parent, i, false); } k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false); s->dataplane_stopping = false; s->dataplane_started = false; }
{ "code": [ " VirtIODevice *vdev = VIRTIO_DEVICE(s);", " vring_teardown(&s->ctrl_vring->vring, vdev, 0);", " vring_teardown(&s->event_vring->vring, vdev, 1);", " for (i = 0; i < vs->conf.num_queues; i++) {", " vring_teardown(&s->cmd_vrings[i]->vring, vdev, 2 + i);" ], "line_no": [ 9, 63, 65, 41, 69 ] }
void FUNC_0(VirtIOSCSI *VAR_0) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(VAR_0); int VAR_1; if (!VAR_0->dataplane_started || VAR_0->dataplane_stopping) { return; } error_free(VAR_0->blocker); VAR_0->blocker = NULL; VAR_0->dataplane_stopping = true; assert(VAR_0->ctx == iothread_get_aio_context(vs->conf.iothread)); aio_context_acquire(VAR_0->ctx); aio_set_event_notifier(VAR_0->ctx, &VAR_0->ctrl_vring->host_notifier, NULL); aio_set_event_notifier(VAR_0->ctx, &VAR_0->event_vring->host_notifier, NULL); for (VAR_1 = 0; VAR_1 < vs->conf.num_queues; VAR_1++) { aio_set_event_notifier(VAR_0->ctx, &VAR_0->cmd_vrings[VAR_1]->host_notifier, NULL); } blk_drain_all(); aio_context_release(VAR_0->ctx); vring_teardown(&VAR_0->ctrl_vring->vring, vdev, 0); vring_teardown(&VAR_0->event_vring->vring, vdev, 1); for (VAR_1 = 0; VAR_1 < vs->conf.num_queues; VAR_1++) { vring_teardown(&VAR_0->cmd_vrings[VAR_1]->vring, vdev, 2 + VAR_1); } for (VAR_1 = 0; VAR_1 < vs->conf.num_queues + 2; VAR_1++) { k->set_host_notifier(qbus->parent, VAR_1, false); } k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false); VAR_0->dataplane_stopping = false; VAR_0->dataplane_started = false; }
[ "void FUNC_0(VirtIOSCSI *VAR_0)\n{", "BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0)));", "VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(VAR_0);", "int VAR_1;", "if (!VAR_0->dataplane_started || VAR_0->dataplane_stopping) {", "return;", "}", "error_free(VAR_0->blocker);", "VAR_0->blocker = NULL;", "VAR_0->dataplane_stopping = true;", "assert(VAR_0->ctx == iothread_get_aio_context(vs->conf.iothread));", "aio_context_acquire(VAR_0->ctx);", "aio_set_event_notifier(VAR_0->ctx, &VAR_0->ctrl_vring->host_notifier, NULL);", "aio_set_event_notifier(VAR_0->ctx, &VAR_0->event_vring->host_notifier, NULL);", "for (VAR_1 = 0; VAR_1 < vs->conf.num_queues; VAR_1++) {", "aio_set_event_notifier(VAR_0->ctx, &VAR_0->cmd_vrings[VAR_1]->host_notifier, NULL);", "}", "blk_drain_all();", "aio_context_release(VAR_0->ctx);", "vring_teardown(&VAR_0->ctrl_vring->vring, vdev, 0);", "vring_teardown(&VAR_0->event_vring->vring, vdev, 1);", "for (VAR_1 = 0; VAR_1 < vs->conf.num_queues; VAR_1++) {", "vring_teardown(&VAR_0->cmd_vrings[VAR_1]->vring, vdev, 2 + VAR_1);", "}", "for (VAR_1 = 0; VAR_1 < vs->conf.num_queues + 2; VAR_1++) {", "k->set_host_notifier(qbus->parent, VAR_1, false);", "}", "k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false);", "VAR_0->dataplane_stopping = false;", "VAR_0->dataplane_started = false;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
22,439
static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); }
true
qemu
48779e501810c5046ff8af7b9cf9c99bec2928a1
static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); }
{ "code": [ " fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);", " fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);", " fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);", " fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);" ], "line_no": [ 7, 7, 7, 7 ] }
static void FUNC_0(void *VAR_0, const char *VAR_1, Error **VAR_2) { fw_cfg_add_i16(VAR_0, FW_CFG_BOOT_DEVICE, VAR_1[0]); }
[ "static void FUNC_0(void *VAR_0, const char *VAR_1,\nError **VAR_2)\n{", "fw_cfg_add_i16(VAR_0, FW_CFG_BOOT_DEVICE, VAR_1[0]);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
22,440
static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, MemoryRegionSection *section, hwaddr start_addr, hwaddr end_addr) { int i; if (!dev->log_enabled || !dev->started) { return 0; } for (i = 0; i < dev->mem->nregions; ++i) { struct vhost_memory_region *reg = dev->mem->regions + i; vhost_dev_sync_region(dev, section, start_addr, end_addr, reg->guest_phys_addr, range_get_last(reg->guest_phys_addr, reg->memory_size)); } for (i = 0; i < dev->nvqs; ++i) { struct vhost_virtqueue *vq = dev->vqs + i; vhost_dev_sync_region(dev, section, start_addr, end_addr, vq->used_phys, range_get_last(vq->used_phys, vq->used_size)); } return 0; }
true
qemu
6b37a23df98faa26391a93373930bfb15b943e00
static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, MemoryRegionSection *section, hwaddr start_addr, hwaddr end_addr) { int i; if (!dev->log_enabled || !dev->started) { return 0; } for (i = 0; i < dev->mem->nregions; ++i) { struct vhost_memory_region *reg = dev->mem->regions + i; vhost_dev_sync_region(dev, section, start_addr, end_addr, reg->guest_phys_addr, range_get_last(reg->guest_phys_addr, reg->memory_size)); } for (i = 0; i < dev->nvqs; ++i) { struct vhost_virtqueue *vq = dev->vqs + i; vhost_dev_sync_region(dev, section, start_addr, end_addr, vq->used_phys, range_get_last(vq->used_phys, vq->used_size)); } return 0; }
{ "code": [ " hwaddr start_addr,", " hwaddr end_addr)" ], "line_no": [ 5, 7 ] }
static int FUNC_0(struct vhost_dev *VAR_0, MemoryRegionSection *VAR_1, hwaddr VAR_2, hwaddr VAR_3) { int VAR_4; if (!VAR_0->log_enabled || !VAR_0->started) { return 0; } for (VAR_4 = 0; VAR_4 < VAR_0->mem->nregions; ++VAR_4) { struct vhost_memory_region *VAR_5 = VAR_0->mem->regions + VAR_4; vhost_dev_sync_region(VAR_0, VAR_1, VAR_2, VAR_3, VAR_5->guest_phys_addr, range_get_last(VAR_5->guest_phys_addr, VAR_5->memory_size)); } for (VAR_4 = 0; VAR_4 < VAR_0->nvqs; ++VAR_4) { struct vhost_virtqueue *VAR_6 = VAR_0->vqs + VAR_4; vhost_dev_sync_region(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6->used_phys, range_get_last(VAR_6->used_phys, VAR_6->used_size)); } return 0; }
[ "static int FUNC_0(struct vhost_dev *VAR_0,\nMemoryRegionSection *VAR_1,\nhwaddr VAR_2,\nhwaddr VAR_3)\n{", "int VAR_4;", "if (!VAR_0->log_enabled || !VAR_0->started) {", "return 0;", "}", "for (VAR_4 = 0; VAR_4 < VAR_0->mem->nregions; ++VAR_4) {", "struct vhost_memory_region *VAR_5 = VAR_0->mem->regions + VAR_4;", "vhost_dev_sync_region(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_5->guest_phys_addr,\nrange_get_last(VAR_5->guest_phys_addr,\nVAR_5->memory_size));", "}", "for (VAR_4 = 0; VAR_4 < VAR_0->nvqs; ++VAR_4) {", "struct vhost_virtqueue *VAR_6 = VAR_0->vqs + VAR_4;", "vhost_dev_sync_region(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6->used_phys,\nrange_get_last(VAR_6->used_phys, VAR_6->used_size));", "}", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ] ]
22,441
static void cris_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); CRISCPUClass *ccc = CRIS_CPU_CLASS(oc); ccc->parent_realize = dc->realize; dc->realize = cris_cpu_realizefn; ccc->parent_reset = cc->reset; cc->reset = cris_cpu_reset; cc->class_by_name = cris_cpu_class_by_name; cc->has_work = cris_cpu_has_work; cc->do_interrupt = cris_cpu_do_interrupt; cc->cpu_exec_interrupt = cris_cpu_exec_interrupt; cc->dump_state = cris_cpu_dump_state; cc->set_pc = cris_cpu_set_pc; cc->gdb_read_register = cris_cpu_gdb_read_register; cc->gdb_write_register = cris_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = cris_cpu_handle_mmu_fault; #else cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; dc->vmsd = &vmstate_cris_cpu; #endif cc->gdb_num_core_regs = 49; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = cris_disas_set_info; /* * Reason: cris_cpu_initfn() calls cpu_exec_init(), which saves * the object in cpus -> dangling pointer after final * object_unref(). */ dc->cannot_destroy_with_object_finalize_yet = true; }
true
qemu
ce5b1bbf624b977a55ff7f85bb3871682d03baff
static void cris_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); CRISCPUClass *ccc = CRIS_CPU_CLASS(oc); ccc->parent_realize = dc->realize; dc->realize = cris_cpu_realizefn; ccc->parent_reset = cc->reset; cc->reset = cris_cpu_reset; cc->class_by_name = cris_cpu_class_by_name; cc->has_work = cris_cpu_has_work; cc->do_interrupt = cris_cpu_do_interrupt; cc->cpu_exec_interrupt = cris_cpu_exec_interrupt; cc->dump_state = cris_cpu_dump_state; cc->set_pc = cris_cpu_set_pc; cc->gdb_read_register = cris_cpu_gdb_read_register; cc->gdb_write_register = cris_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = cris_cpu_handle_mmu_fault; #else cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; dc->vmsd = &vmstate_cris_cpu; #endif cc->gdb_num_core_regs = 49; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = cris_disas_set_info; dc->cannot_destroy_with_object_finalize_yet = true; }
{ "code": [ " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;" ], "line_no": [ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); CPUClass *cc = CPU_CLASS(VAR_0); CRISCPUClass *ccc = CRIS_CPU_CLASS(VAR_0); ccc->parent_realize = dc->realize; dc->realize = cris_cpu_realizefn; ccc->parent_reset = cc->reset; cc->reset = cris_cpu_reset; cc->class_by_name = cris_cpu_class_by_name; cc->has_work = cris_cpu_has_work; cc->do_interrupt = cris_cpu_do_interrupt; cc->cpu_exec_interrupt = cris_cpu_exec_interrupt; cc->dump_state = cris_cpu_dump_state; cc->set_pc = cris_cpu_set_pc; cc->gdb_read_register = cris_cpu_gdb_read_register; cc->gdb_write_register = cris_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = cris_cpu_handle_mmu_fault; #else cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; dc->vmsd = &vmstate_cris_cpu; #endif cc->gdb_num_core_regs = 49; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = cris_disas_set_info; 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);", "CPUClass *cc = CPU_CLASS(VAR_0);", "CRISCPUClass *ccc = CRIS_CPU_CLASS(VAR_0);", "ccc->parent_realize = dc->realize;", "dc->realize = cris_cpu_realizefn;", "ccc->parent_reset = cc->reset;", "cc->reset = cris_cpu_reset;", "cc->class_by_name = cris_cpu_class_by_name;", "cc->has_work = cris_cpu_has_work;", "cc->do_interrupt = cris_cpu_do_interrupt;", "cc->cpu_exec_interrupt = cris_cpu_exec_interrupt;", "cc->dump_state = cris_cpu_dump_state;", "cc->set_pc = cris_cpu_set_pc;", "cc->gdb_read_register = cris_cpu_gdb_read_register;", "cc->gdb_write_register = cris_cpu_gdb_write_register;", "#ifdef CONFIG_USER_ONLY\ncc->handle_mmu_fault = cris_cpu_handle_mmu_fault;", "#else\ncc->get_phys_page_debug = cris_cpu_get_phys_page_debug;", "dc->vmsd = &vmstate_cris_cpu;", "#endif\ncc->gdb_num_core_regs = 49;", "cc->gdb_stop_before_watchpoint = true;", "cc->disas_set_info = cris_disas_set_info;", "dc->cannot_destroy_with_object_finalize_yet = true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51, 55 ], [ 57 ], [ 61 ], [ 75 ], [ 77 ] ]
22,443
static void blk_mig_lock(void) { qemu_mutex_lock(&block_mig_state.lock); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void blk_mig_lock(void) { qemu_mutex_lock(&block_mig_state.lock); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { qemu_mutex_lock(&block_mig_state.lock); }
[ "static void FUNC_0(void)\n{", "qemu_mutex_lock(&block_mig_state.lock);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
22,444
bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path) { Object *mem_obj = object_resolve_path(obj_path, NULL); char *mempath = object_property_get_str(mem_obj, "mem-path", NULL); long pagesize; if (mempath) { pagesize = qemu_mempath_getpagesize(mempath); } else { pagesize = getpagesize(); } return pagesize >= max_cpu_page_size; }
true
qemu
2d3e302ec2246d703ffa8d8f8769a3fa448d8145
bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path) { Object *mem_obj = object_resolve_path(obj_path, NULL); char *mempath = object_property_get_str(mem_obj, "mem-path", NULL); long pagesize; if (mempath) { pagesize = qemu_mempath_getpagesize(mempath); } else { pagesize = getpagesize(); } return pagesize >= max_cpu_page_size; }
{ "code": [], "line_no": [] }
bool FUNC_0(const char *obj_path) { Object *mem_obj = object_resolve_path(obj_path, NULL); char *VAR_0 = object_property_get_str(mem_obj, "mem-path", NULL); long VAR_1; if (VAR_0) { VAR_1 = qemu_mempath_getpagesize(VAR_0); } else { VAR_1 = getpagesize(); } return VAR_1 >= max_cpu_page_size; }
[ "bool FUNC_0(const char *obj_path)\n{", "Object *mem_obj = object_resolve_path(obj_path, NULL);", "char *VAR_0 = object_property_get_str(mem_obj, \"mem-path\", NULL);", "long VAR_1;", "if (VAR_0) {", "VAR_1 = qemu_mempath_getpagesize(VAR_0);", "} else {", "VAR_1 = getpagesize();", "}", "return VAR_1 >= max_cpu_page_size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 18 ], [ 20 ], [ 22 ], [ 26 ], [ 28 ] ]
22,446
void helper_ldqf(CPUSPARCState *env, target_ulong addr, int mem_idx) { /* XXX add 128 bit load */ CPU_QuadU u; helper_check_align(env, addr, 7); #if !defined(CONFIG_USER_ONLY) switch (mem_idx) { case MMU_USER_IDX: u.ll.upper = cpu_ldq_user(env, addr); u.ll.lower = cpu_ldq_user(env, addr + 8); QT0 = u.q; break; case MMU_KERNEL_IDX: u.ll.upper = cpu_ldq_kernel(env, addr); u.ll.lower = cpu_ldq_kernel(env, addr + 8); QT0 = u.q; break; #ifdef TARGET_SPARC64 case MMU_HYPV_IDX: u.ll.upper = cpu_ldq_hypv(env, addr); u.ll.lower = cpu_ldq_hypv(env, addr + 8); QT0 = u.q; break; #endif default: DPRINTF_MMU("helper_ldqf: need to check MMU idx %d\n", mem_idx); break; } #else u.ll.upper = ldq_raw(address_mask(env, addr)); u.ll.lower = ldq_raw(address_mask(env, addr + 8)); QT0 = u.q; #endif }
true
qemu
eb513f82f04fab442cdef9db698dafc852275f7f
void helper_ldqf(CPUSPARCState *env, target_ulong addr, int mem_idx) { CPU_QuadU u; helper_check_align(env, addr, 7); #if !defined(CONFIG_USER_ONLY) switch (mem_idx) { case MMU_USER_IDX: u.ll.upper = cpu_ldq_user(env, addr); u.ll.lower = cpu_ldq_user(env, addr + 8); QT0 = u.q; break; case MMU_KERNEL_IDX: u.ll.upper = cpu_ldq_kernel(env, addr); u.ll.lower = cpu_ldq_kernel(env, addr + 8); QT0 = u.q; break; #ifdef TARGET_SPARC64 case MMU_HYPV_IDX: u.ll.upper = cpu_ldq_hypv(env, addr); u.ll.lower = cpu_ldq_hypv(env, addr + 8); QT0 = u.q; break; #endif default: DPRINTF_MMU("helper_ldqf: need to check MMU idx %d\n", mem_idx); break; } #else u.ll.upper = ldq_raw(address_mask(env, addr)); u.ll.lower = ldq_raw(address_mask(env, addr + 8)); QT0 = u.q; #endif }
{ "code": [ " u.ll.upper = ldq_raw(address_mask(env, addr));", " u.ll.lower = ldq_raw(address_mask(env, addr + 8));" ], "line_no": [ 61, 63 ] }
void FUNC_0(CPUSPARCState *VAR_0, target_ulong VAR_1, int VAR_2) { CPU_QuadU u; helper_check_align(VAR_0, VAR_1, 7); #if !defined(CONFIG_USER_ONLY) switch (VAR_2) { case MMU_USER_IDX: u.ll.upper = cpu_ldq_user(VAR_0, VAR_1); u.ll.lower = cpu_ldq_user(VAR_0, VAR_1 + 8); QT0 = u.q; break; case MMU_KERNEL_IDX: u.ll.upper = cpu_ldq_kernel(VAR_0, VAR_1); u.ll.lower = cpu_ldq_kernel(VAR_0, VAR_1 + 8); QT0 = u.q; break; #ifdef TARGET_SPARC64 case MMU_HYPV_IDX: u.ll.upper = cpu_ldq_hypv(VAR_0, VAR_1); u.ll.lower = cpu_ldq_hypv(VAR_0, VAR_1 + 8); QT0 = u.q; break; #endif default: DPRINTF_MMU("FUNC_0: need to check MMU idx %d\n", VAR_2); break; } #else u.ll.upper = ldq_raw(address_mask(VAR_0, VAR_1)); u.ll.lower = ldq_raw(address_mask(VAR_0, VAR_1 + 8)); QT0 = u.q; #endif }
[ "void FUNC_0(CPUSPARCState *VAR_0, target_ulong VAR_1, int VAR_2)\n{", "CPU_QuadU u;", "helper_check_align(VAR_0, VAR_1, 7);", "#if !defined(CONFIG_USER_ONLY)\nswitch (VAR_2) {", "case MMU_USER_IDX:\nu.ll.upper = cpu_ldq_user(VAR_0, VAR_1);", "u.ll.lower = cpu_ldq_user(VAR_0, VAR_1 + 8);", "QT0 = u.q;", "break;", "case MMU_KERNEL_IDX:\nu.ll.upper = cpu_ldq_kernel(VAR_0, VAR_1);", "u.ll.lower = cpu_ldq_kernel(VAR_0, VAR_1 + 8);", "QT0 = u.q;", "break;", "#ifdef TARGET_SPARC64\ncase MMU_HYPV_IDX:\nu.ll.upper = cpu_ldq_hypv(VAR_0, VAR_1);", "u.ll.lower = cpu_ldq_hypv(VAR_0, VAR_1 + 8);", "QT0 = u.q;", "break;", "#endif\ndefault:\nDPRINTF_MMU(\"FUNC_0: need to check MMU idx %d\\n\", VAR_2);", "break;", "}", "#else\nu.ll.upper = ldq_raw(address_mask(VAR_0, VAR_1));", "u.ll.lower = ldq_raw(address_mask(VAR_0, VAR_1 + 8));", "QT0 = u.q;", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ] ]
22,447
static void allocate_buffers(ALACContext *alac) { int chan; for (chan = 0; chan < alac->numchannels; chan++) { alac->predicterror_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4); alac->outputsamples_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4); alac->wasted_bits_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4); } }
true
FFmpeg
53df079a730043cd0aa330c9aba7950034b1424f
static void allocate_buffers(ALACContext *alac) { int chan; for (chan = 0; chan < alac->numchannels; chan++) { alac->predicterror_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4); alac->outputsamples_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4); alac->wasted_bits_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4); } }
{ "code": [ "static void allocate_buffers(ALACContext *alac)", " int chan;", " for (chan = 0; chan < alac->numchannels; chan++) {", " alac->predicterror_buffer[chan] =", " av_malloc(alac->setinfo_max_samples_per_frame * 4);", " alac->outputsamples_buffer[chan] =", " av_malloc(alac->setinfo_max_samples_per_frame * 4);", " alac->wasted_bits_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4);", " int chan;", " for (chan = 0; chan < alac->numchannels; chan++) {" ], "line_no": [ 1, 5, 7, 9, 11, 15, 11, 21, 5, 7 ] }
static void FUNC_0(ALACContext *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < VAR_0->numchannels; VAR_1++) { VAR_0->predicterror_buffer[VAR_1] = av_malloc(VAR_0->setinfo_max_samples_per_frame * 4); VAR_0->outputsamples_buffer[VAR_1] = av_malloc(VAR_0->setinfo_max_samples_per_frame * 4); VAR_0->wasted_bits_buffer[VAR_1] = av_malloc(VAR_0->setinfo_max_samples_per_frame * 4); } }
[ "static void FUNC_0(ALACContext *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < VAR_0->numchannels; VAR_1++) {", "VAR_0->predicterror_buffer[VAR_1] =\nav_malloc(VAR_0->setinfo_max_samples_per_frame * 4);", "VAR_0->outputsamples_buffer[VAR_1] =\nav_malloc(VAR_0->setinfo_max_samples_per_frame * 4);", "VAR_0->wasted_bits_buffer[VAR_1] = av_malloc(VAR_0->setinfo_max_samples_per_frame * 4);", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ] ]
22,448
static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride) { int x,y; dst[0]= src[0]; // first line for(x=0; x<srcWidth-1; x++){ dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; dst+= dstStride; for(y=1; y<srcHeight; y++){ #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) const long mmxSize= srcWidth&~15; asm volatile( "mov %4, %%"REG_a" \n\t" "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" "movq 1(%0, %%"REG_a"), %%mm2 \n\t" "movq 1(%1, %%"REG_a"), %%mm3 \n\t" "movq -1(%0, %%"REG_a"), %%mm4 \n\t" "movq -1(%1, %%"REG_a"), %%mm5 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" "movq %%mm5, %%mm7 \n\t" "movq %%mm4, %%mm6 \n\t" "punpcklbw %%mm3, %%mm5 \n\t" "punpckhbw %%mm3, %%mm7 \n\t" "punpcklbw %%mm2, %%mm4 \n\t" "punpckhbw %%mm2, %%mm6 \n\t" #if 1 MOVNTQ" %%mm5, (%2, %%"REG_a", 2)\n\t" MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2)\n\t" MOVNTQ" %%mm4, (%3, %%"REG_a", 2)\n\t" MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2)\n\t" #else "movq %%mm5, (%2, %%"REG_a", 2) \n\t" "movq %%mm7, 8(%2, %%"REG_a", 2)\n\t" "movq %%mm4, (%3, %%"REG_a", 2) \n\t" "movq %%mm6, 8(%3, %%"REG_a", 2)\n\t" #endif "add $8, %%"REG_a" \n\t" " js 1b \n\t" :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ), "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2), "g" (-mmxSize) : "%"REG_a ); #else const int mmxSize=1; #endif dst[0 ]= (3*src[0] + src[srcStride])>>2; dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; for(x=mmxSize-1; x<srcWidth-1; x++){ dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2; dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2; dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2; dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2; } dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2; dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2; dst+=dstStride*2; src+=srcStride; } // last line #if 1 dst[0]= src[0]; for(x=0; x<srcWidth-1; x++){ dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; #else for(x=0; x<srcWidth; x++){ dst[2*x+0]= dst[2*x+1]= src[x]; } #endif #ifdef HAVE_MMX asm volatile( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride) { int x,y; dst[0]= src[0]; for(x=0; x<srcWidth-1; x++){ dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; dst+= dstStride; for(y=1; y<srcHeight; y++){ #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) const long mmxSize= srcWidth&~15; asm volatile( "mov %4, %%"REG_a" \n\t" "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" "movq 1(%0, %%"REG_a"), %%mm2 \n\t" "movq 1(%1, %%"REG_a"), %%mm3 \n\t" "movq -1(%0, %%"REG_a"), %%mm4 \n\t" "movq -1(%1, %%"REG_a"), %%mm5 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" "movq %%mm5, %%mm7 \n\t" "movq %%mm4, %%mm6 \n\t" "punpcklbw %%mm3, %%mm5 \n\t" "punpckhbw %%mm3, %%mm7 \n\t" "punpcklbw %%mm2, %%mm4 \n\t" "punpckhbw %%mm2, %%mm6 \n\t" #if 1 MOVNTQ" %%mm5, (%2, %%"REG_a", 2)\n\t" MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2)\n\t" MOVNTQ" %%mm4, (%3, %%"REG_a", 2)\n\t" MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2)\n\t" #else "movq %%mm5, (%2, %%"REG_a", 2) \n\t" "movq %%mm7, 8(%2, %%"REG_a", 2)\n\t" "movq %%mm4, (%3, %%"REG_a", 2) \n\t" "movq %%mm6, 8(%3, %%"REG_a", 2)\n\t" #endif "add $8, %%"REG_a" \n\t" " js 1b \n\t" :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ), "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2), "g" (-mmxSize) : "%"REG_a ); #else const int mmxSize=1; #endif dst[0 ]= (3*src[0] + src[srcStride])>>2; dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; for(x=mmxSize-1; x<srcWidth-1; x++){ dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2; dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2; dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2; dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2; } dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2; dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2; dst+=dstStride*2; src+=srcStride; } #if 1 dst[0]= src[0]; for(x=0; x<srcWidth-1; x++){ dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; #else for(x=0; x<srcWidth; x++){ dst[2*x+0]= dst[2*x+1]= src[x]; } #endif #ifdef HAVE_MMX asm volatile( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
{ "code": [ "static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride)", "\tint x,y;", "\t\tconst int mmxSize=1;" ], "line_no": [ 1, 5, 123 ] }
static inline void FUNC_0(planar2x)(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride) { int VAR_0,VAR_1; dst[0]= src[0]; for(VAR_0=0; VAR_0<srcWidth-1; VAR_0++){ dst[2*VAR_0+1]= (3*src[VAR_0] + src[VAR_0+1])>>2; dst[2*VAR_0+2]= ( src[VAR_0] + 3*src[VAR_0+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; dst+= dstStride; for(VAR_1=1; VAR_1<srcHeight; VAR_1++){ #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) const long mmxSize= srcWidth&~15; asm volatile( "mov %4, %%"REG_a" \n\t" "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" "movq 1(%0, %%"REG_a"), %%mm2 \n\t" "movq 1(%1, %%"REG_a"), %%mm3 \n\t" "movq -1(%0, %%"REG_a"), %%mm4 \n\t" "movq -1(%1, %%"REG_a"), %%mm5 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" "movq %%mm5, %%mm7 \n\t" "movq %%mm4, %%mm6 \n\t" "punpcklbw %%mm3, %%mm5 \n\t" "punpckhbw %%mm3, %%mm7 \n\t" "punpcklbw %%mm2, %%mm4 \n\t" "punpckhbw %%mm2, %%mm6 \n\t" #if 1 MOVNTQ" %%mm5, (%2, %%"REG_a", 2)\n\t" MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2)\n\t" MOVNTQ" %%mm4, (%3, %%"REG_a", 2)\n\t" MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2)\n\t" #else "movq %%mm5, (%2, %%"REG_a", 2) \n\t" "movq %%mm7, 8(%2, %%"REG_a", 2)\n\t" "movq %%mm4, (%3, %%"REG_a", 2) \n\t" "movq %%mm6, 8(%3, %%"REG_a", 2)\n\t" #endif "add $8, %%"REG_a" \n\t" " js 1b \n\t" :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ), "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2), "g" (-mmxSize) : "%"REG_a ); #else const int mmxSize=1; #endif dst[0 ]= (3*src[0] + src[srcStride])>>2; dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; for(VAR_0=mmxSize-1; VAR_0<srcWidth-1; VAR_0++){ dst[2*VAR_0 +1]= (3*src[VAR_0+0] + src[VAR_0+srcStride+1])>>2; dst[2*VAR_0+dstStride+2]= ( src[VAR_0+0] + 3*src[VAR_0+srcStride+1])>>2; dst[2*VAR_0+dstStride+1]= ( src[VAR_0+1] + 3*src[VAR_0+srcStride ])>>2; dst[2*VAR_0 +2]= (3*src[VAR_0+1] + src[VAR_0+srcStride ])>>2; } dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2; dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2; dst+=dstStride*2; src+=srcStride; } #if 1 dst[0]= src[0]; for(VAR_0=0; VAR_0<srcWidth-1; VAR_0++){ dst[2*VAR_0+1]= (3*src[VAR_0] + src[VAR_0+1])>>2; dst[2*VAR_0+2]= ( src[VAR_0] + 3*src[VAR_0+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; #else for(VAR_0=0; VAR_0<srcWidth; VAR_0++){ dst[2*VAR_0+0]= dst[2*VAR_0+1]= src[VAR_0]; } #endif #ifdef HAVE_MMX asm volatile( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
[ "static inline void FUNC_0(planar2x)(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride)\n{", "int VAR_0,VAR_1;", "dst[0]= src[0];", "for(VAR_0=0; VAR_0<srcWidth-1; VAR_0++){", "dst[2*VAR_0+1]= (3*src[VAR_0] + src[VAR_0+1])>>2;", "dst[2*VAR_0+2]= ( src[VAR_0] + 3*src[VAR_0+1])>>2;", "}", "dst[2*srcWidth-1]= src[srcWidth-1];", "dst+= dstStride;", "for(VAR_1=1; VAR_1<srcHeight; VAR_1++){", "#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)\nconst long mmxSize= srcWidth&~15;", "asm volatile(\n\"mov %4, %%\"REG_a\"\t\t\\n\\t\"\n\"1:\t\t\t\t\\n\\t\"\n\"movq (%0, %%\"REG_a\"), %%mm0\t\\n\\t\"\n\"movq (%1, %%\"REG_a\"), %%mm1\t\\n\\t\"\n\"movq 1(%0, %%\"REG_a\"), %%mm2\t\\n\\t\"\n\"movq 1(%1, %%\"REG_a\"), %%mm3\t\\n\\t\"\n\"movq -1(%0, %%\"REG_a\"), %%mm4\t\\n\\t\"\n\"movq -1(%1, %%\"REG_a\"), %%mm5\t\\n\\t\"\nPAVGB\" %%mm0, %%mm5\t\t\\n\\t\"\nPAVGB\" %%mm0, %%mm3\t\t\\n\\t\"\nPAVGB\" %%mm0, %%mm5\t\t\\n\\t\"\nPAVGB\" %%mm0, %%mm3\t\t\\n\\t\"\nPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"\nPAVGB\" %%mm1, %%mm2\t\t\\n\\t\"\nPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"\nPAVGB\" %%mm1, %%mm2\t\t\\n\\t\"\n\"movq %%mm5, %%mm7\t\t\\n\\t\"\n\"movq %%mm4, %%mm6\t\t\\n\\t\"\n\"punpcklbw %%mm3, %%mm5\t\t\\n\\t\"\n\"punpckhbw %%mm3, %%mm7\t\t\\n\\t\"\n\"punpcklbw %%mm2, %%mm4\t\t\\n\\t\"\n\"punpckhbw %%mm2, %%mm6\t\t\\n\\t\"\n#if 1\nMOVNTQ\" %%mm5, (%2, %%\"REG_a\", 2)\\n\\t\"\nMOVNTQ\" %%mm7, 8(%2, %%\"REG_a\", 2)\\n\\t\"\nMOVNTQ\" %%mm4, (%3, %%\"REG_a\", 2)\\n\\t\"\nMOVNTQ\" %%mm6, 8(%3, %%\"REG_a\", 2)\\n\\t\"\n#else\n\"movq %%mm5, (%2, %%\"REG_a\", 2)\t\\n\\t\"\n\"movq %%mm7, 8(%2, %%\"REG_a\", 2)\\n\\t\"\n\"movq %%mm4, (%3, %%\"REG_a\", 2)\t\\n\\t\"\n\"movq %%mm6, 8(%3, %%\"REG_a\", 2)\\n\\t\"\n#endif\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n:: \"r\" (src + mmxSize ), \"r\" (src + srcStride + mmxSize ),\n\"r\" (dst + mmxSize*2), \"r\" (dst + dstStride + mmxSize*2),\n\"g\" (-mmxSize)\n: \"%\"REG_a\n);", "#else\nconst int mmxSize=1;", "#endif\ndst[0 ]= (3*src[0] + src[srcStride])>>2;", "dst[dstStride]= ( src[0] + 3*src[srcStride])>>2;", "for(VAR_0=mmxSize-1; VAR_0<srcWidth-1; VAR_0++){", "dst[2*VAR_0 +1]= (3*src[VAR_0+0] + src[VAR_0+srcStride+1])>>2;", "dst[2*VAR_0+dstStride+2]= ( src[VAR_0+0] + 3*src[VAR_0+srcStride+1])>>2;", "dst[2*VAR_0+dstStride+1]= ( src[VAR_0+1] + 3*src[VAR_0+srcStride ])>>2;", "dst[2*VAR_0 +2]= (3*src[VAR_0+1] + src[VAR_0+srcStride ])>>2;", "}", "dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2;", "dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2;", "dst+=dstStride*2;", "src+=srcStride;", "}", "#if 1\ndst[0]= src[0];", "for(VAR_0=0; VAR_0<srcWidth-1; VAR_0++){", "dst[2*VAR_0+1]= (3*src[VAR_0] + src[VAR_0+1])>>2;", "dst[2*VAR_0+2]= ( src[VAR_0] + 3*src[VAR_0+1])>>2;", "}", "dst[2*srcWidth-1]= src[srcWidth-1];", "#else\nfor(VAR_0=0; VAR_0<srcWidth; VAR_0++){", "dst[2*VAR_0+0]=\ndst[2*VAR_0+1]= src[VAR_0];", "}", "#endif\n#ifdef HAVE_MMX\nasm volatile( EMMS\" \\n\\t\"\nSFENCE\" \\n\\t\"\n:::\"memory\");", "#endif\n}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 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, 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 161, 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181, 183 ], [ 185 ], [ 187, 191, 193, 195, 197 ], [ 199, 201 ] ]
22,449
static MemTxResult memory_region_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask, MemTxAttrs attrs) { uint64_t tmp; tmp = (*value >> shift) & mask; if (mr->subpage) { trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size); } else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) { hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr); trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size); } mr->ops->write(mr->opaque, addr, tmp, size); return MEMTX_OK; }
true
qemu
f2d089425d43735b5369f70f3a36b712440578e5
static MemTxResult memory_region_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask, MemTxAttrs attrs) { uint64_t tmp; tmp = (*value >> shift) & mask; if (mr->subpage) { trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size); } else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) { hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr); trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size); } mr->ops->write(mr->opaque, addr, tmp, size); return MEMTX_OK; }
{ "code": [], "line_no": [] }
static MemTxResult FUNC_0(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask, MemTxAttrs attrs) { uint64_t tmp; tmp = (*value >> shift) & mask; if (mr->subpage) { trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size); } else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) { hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr); trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size); } mr->ops->write(mr->opaque, addr, tmp, size); return MEMTX_OK; }
[ "static MemTxResult FUNC_0(MemoryRegion *mr,\nhwaddr addr,\nuint64_t *value,\nunsigned size,\nunsigned shift,\nuint64_t mask,\nMemTxAttrs attrs)\n{", "uint64_t tmp;", "tmp = (*value >> shift) & mask;", "if (mr->subpage) {", "trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);", "} else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) {", "hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);", "trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);", "}", "mr->ops->write(mr->opaque, addr, tmp, size);", "return MEMTX_OK;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ] ]
22,450
void qemu_del_vlan_client(VLANClientState *vc) { if (vc->vlan) { QTAILQ_REMOVE(&vc->vlan->clients, vc, next); } else { if (vc->send_queue) { qemu_del_net_queue(vc->send_queue); } QTAILQ_REMOVE(&non_vlan_clients, vc, next); if (vc->peer) { vc->peer->peer = NULL; } } if (vc->info->cleanup) { vc->info->cleanup(vc); } qemu_free(vc->name); qemu_free(vc->model); qemu_free(vc); }
true
qemu
a083a89d7277f3268a251ce635d9aae5559242bd
void qemu_del_vlan_client(VLANClientState *vc) { if (vc->vlan) { QTAILQ_REMOVE(&vc->vlan->clients, vc, next); } else { if (vc->send_queue) { qemu_del_net_queue(vc->send_queue); } QTAILQ_REMOVE(&non_vlan_clients, vc, next); if (vc->peer) { vc->peer->peer = NULL; } } if (vc->info->cleanup) { vc->info->cleanup(vc); } qemu_free(vc->name); qemu_free(vc->model); qemu_free(vc); }
{ "code": [ "void qemu_del_vlan_client(VLANClientState *vc)", " if (vc->send_queue) {", " qemu_del_net_queue(vc->send_queue);", " if (vc->peer) {", " vc->peer->peer = NULL;" ], "line_no": [ 1, 11, 13, 19, 21 ] }
void FUNC_0(VLANClientState *VAR_0) { if (VAR_0->vlan) { QTAILQ_REMOVE(&VAR_0->vlan->clients, VAR_0, next); } else { if (VAR_0->send_queue) { qemu_del_net_queue(VAR_0->send_queue); } QTAILQ_REMOVE(&non_vlan_clients, VAR_0, next); if (VAR_0->peer) { VAR_0->peer->peer = NULL; } } if (VAR_0->info->cleanup) { VAR_0->info->cleanup(VAR_0); } qemu_free(VAR_0->name); qemu_free(VAR_0->model); qemu_free(VAR_0); }
[ "void FUNC_0(VLANClientState *VAR_0)\n{", "if (VAR_0->vlan) {", "QTAILQ_REMOVE(&VAR_0->vlan->clients, VAR_0, next);", "} else {", "if (VAR_0->send_queue) {", "qemu_del_net_queue(VAR_0->send_queue);", "}", "QTAILQ_REMOVE(&non_vlan_clients, VAR_0, next);", "if (VAR_0->peer) {", "VAR_0->peer->peer = NULL;", "}", "}", "if (VAR_0->info->cleanup) {", "VAR_0->info->cleanup(VAR_0);", "}", "qemu_free(VAR_0->name);", "qemu_free(VAR_0->model);", "qemu_free(VAR_0);", "}" ]
[ 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
22,451
static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_track, AVStream *st) { MXFPackage *temp_package = NULL; MXFPackage *physical_package = NULL; MXFTrack *physical_track = NULL; MXFStructuralComponent *component = NULL; MXFStructuralComponent *sourceclip = NULL; MXFTimecodeComponent *mxf_tc = NULL; MXFPulldownComponent *mxf_pulldown = NULL; int i, j, k; AVTimecode tc; int flags; int64_t start_position; for (i = 0; i < source_track->sequence->structural_components_count; i++) { component = mxf_resolve_strong_ref(mxf, &source_track->sequence->structural_components_refs[i], SourceClip); if (!component) continue; for (j = 0; j < mxf->packages_count; j++) { temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[j], SourcePackage); if (!temp_package) continue; if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)){ physical_package = temp_package; sourceclip = component; break; } } if (!physical_package) break; /* the name of physical source package is name of the reel or tape */ if (physical_package->name[0]) av_dict_set(&st->metadata, "reel_name", physical_package->name, 0); /* the source timecode is calculated by adding the start_position of the sourceclip from the file source package track * to the start_frame of the timecode component located on one of the tracks of the physical source package. */ for (j = 0; j < physical_package->tracks_count; j++) { if (!(physical_track = mxf_resolve_strong_ref(mxf, &physical_package->tracks_refs[j], Track))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n"); continue; } if (!(physical_track->sequence = mxf_resolve_strong_ref(mxf, &physical_track->sequence_ref, Sequence))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); continue; } for (k = 0; k < physical_track->sequence->structural_components_count; k++) { component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], TimecodeComponent); if (!component){ /* timcode component may be located on a pulldown component */ component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], PulldownComponent); if (!component) continue; mxf_pulldown = (MXFPulldownComponent*)component; component = mxf_resolve_strong_ref(mxf, &mxf_pulldown->input_segment_ref, TimecodeComponent); if (!component) continue; } mxf_tc = (MXFTimecodeComponent*)component; flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0; /* scale sourceclip start_position to match physical track edit rate */ start_position = av_rescale_q(sourceclip->start_position, physical_track->edit_rate, source_track->edit_rate); if (av_timecode_init(&tc, mxf_tc->rate, flags, start_position + mxf_tc->start_frame, mxf->fc) == 0) { mxf_add_timecode_metadata(&st->metadata, "timecode", &tc); return 0; } } } } return 0; }
true
FFmpeg
c1e035ea89c16b8da91fae6983973a7186e138f6
static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_track, AVStream *st) { MXFPackage *temp_package = NULL; MXFPackage *physical_package = NULL; MXFTrack *physical_track = NULL; MXFStructuralComponent *component = NULL; MXFStructuralComponent *sourceclip = NULL; MXFTimecodeComponent *mxf_tc = NULL; MXFPulldownComponent *mxf_pulldown = NULL; int i, j, k; AVTimecode tc; int flags; int64_t start_position; for (i = 0; i < source_track->sequence->structural_components_count; i++) { component = mxf_resolve_strong_ref(mxf, &source_track->sequence->structural_components_refs[i], SourceClip); if (!component) continue; for (j = 0; j < mxf->packages_count; j++) { temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[j], SourcePackage); if (!temp_package) continue; if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)){ physical_package = temp_package; sourceclip = component; break; } } if (!physical_package) break; if (physical_package->name[0]) av_dict_set(&st->metadata, "reel_name", physical_package->name, 0); for (j = 0; j < physical_package->tracks_count; j++) { if (!(physical_track = mxf_resolve_strong_ref(mxf, &physical_package->tracks_refs[j], Track))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n"); continue; } if (!(physical_track->sequence = mxf_resolve_strong_ref(mxf, &physical_track->sequence_ref, Sequence))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); continue; } for (k = 0; k < physical_track->sequence->structural_components_count; k++) { component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], TimecodeComponent); if (!component){ component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], PulldownComponent); if (!component) continue; mxf_pulldown = (MXFPulldownComponent*)component; component = mxf_resolve_strong_ref(mxf, &mxf_pulldown->input_segment_ref, TimecodeComponent); if (!component) continue; } mxf_tc = (MXFTimecodeComponent*)component; flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0; start_position = av_rescale_q(sourceclip->start_position, physical_track->edit_rate, source_track->edit_rate); if (av_timecode_init(&tc, mxf_tc->rate, flags, start_position + mxf_tc->start_frame, mxf->fc) == 0) { mxf_add_timecode_metadata(&st->metadata, "timecode", &tc); return 0; } } } } return 0; }
{ "code": [ " if (physical_package->name[0])" ], "line_no": [ 67 ] }
static int FUNC_0(MXFContext *VAR_0, MXFTrack *VAR_1, AVStream *VAR_2) { MXFPackage *temp_package = NULL; MXFPackage *physical_package = NULL; MXFTrack *physical_track = NULL; MXFStructuralComponent *component = NULL; MXFStructuralComponent *sourceclip = NULL; MXFTimecodeComponent *mxf_tc = NULL; MXFPulldownComponent *mxf_pulldown = NULL; int VAR_3, VAR_4, VAR_5; AVTimecode tc; int VAR_6; int64_t start_position; for (VAR_3 = 0; VAR_3 < VAR_1->sequence->structural_components_count; VAR_3++) { component = mxf_resolve_strong_ref(VAR_0, &VAR_1->sequence->structural_components_refs[VAR_3], SourceClip); if (!component) continue; for (VAR_4 = 0; VAR_4 < VAR_0->packages_count; VAR_4++) { temp_package = mxf_resolve_strong_ref(VAR_0, &VAR_0->packages_refs[VAR_4], SourcePackage); if (!temp_package) continue; if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)){ physical_package = temp_package; sourceclip = component; break; } } if (!physical_package) break; if (physical_package->name[0]) av_dict_set(&VAR_2->metadata, "reel_name", physical_package->name, 0); for (VAR_4 = 0; VAR_4 < physical_package->tracks_count; VAR_4++) { if (!(physical_track = mxf_resolve_strong_ref(VAR_0, &physical_package->tracks_refs[VAR_4], Track))) { av_log(VAR_0->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n"); continue; } if (!(physical_track->sequence = mxf_resolve_strong_ref(VAR_0, &physical_track->sequence_ref, Sequence))) { av_log(VAR_0->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); continue; } for (VAR_5 = 0; VAR_5 < physical_track->sequence->structural_components_count; VAR_5++) { component = mxf_resolve_strong_ref(VAR_0, &physical_track->sequence->structural_components_refs[VAR_5], TimecodeComponent); if (!component){ component = mxf_resolve_strong_ref(VAR_0, &physical_track->sequence->structural_components_refs[VAR_5], PulldownComponent); if (!component) continue; mxf_pulldown = (MXFPulldownComponent*)component; component = mxf_resolve_strong_ref(VAR_0, &mxf_pulldown->input_segment_ref, TimecodeComponent); if (!component) continue; } mxf_tc = (MXFTimecodeComponent*)component; VAR_6 = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0; start_position = av_rescale_q(sourceclip->start_position, physical_track->edit_rate, VAR_1->edit_rate); if (av_timecode_init(&tc, mxf_tc->rate, VAR_6, start_position + mxf_tc->start_frame, VAR_0->fc) == 0) { mxf_add_timecode_metadata(&VAR_2->metadata, "timecode", &tc); return 0; } } } } return 0; }
[ "static int FUNC_0(MXFContext *VAR_0, MXFTrack *VAR_1, AVStream *VAR_2)\n{", "MXFPackage *temp_package = NULL;", "MXFPackage *physical_package = NULL;", "MXFTrack *physical_track = NULL;", "MXFStructuralComponent *component = NULL;", "MXFStructuralComponent *sourceclip = NULL;", "MXFTimecodeComponent *mxf_tc = NULL;", "MXFPulldownComponent *mxf_pulldown = NULL;", "int VAR_3, VAR_4, VAR_5;", "AVTimecode tc;", "int VAR_6;", "int64_t start_position;", "for (VAR_3 = 0; VAR_3 < VAR_1->sequence->structural_components_count; VAR_3++) {", "component = mxf_resolve_strong_ref(VAR_0, &VAR_1->sequence->structural_components_refs[VAR_3], SourceClip);", "if (!component)\ncontinue;", "for (VAR_4 = 0; VAR_4 < VAR_0->packages_count; VAR_4++) {", "temp_package = mxf_resolve_strong_ref(VAR_0, &VAR_0->packages_refs[VAR_4], SourcePackage);", "if (!temp_package)\ncontinue;", "if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)){", "physical_package = temp_package;", "sourceclip = component;", "break;", "}", "}", "if (!physical_package)\nbreak;", "if (physical_package->name[0])\nav_dict_set(&VAR_2->metadata, \"reel_name\", physical_package->name, 0);", "for (VAR_4 = 0; VAR_4 < physical_package->tracks_count; VAR_4++) {", "if (!(physical_track = mxf_resolve_strong_ref(VAR_0, &physical_package->tracks_refs[VAR_4], Track))) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"could not resolve source track strong ref\\n\");", "continue;", "}", "if (!(physical_track->sequence = mxf_resolve_strong_ref(VAR_0, &physical_track->sequence_ref, Sequence))) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"could not resolve source track sequence strong ref\\n\");", "continue;", "}", "for (VAR_5 = 0; VAR_5 < physical_track->sequence->structural_components_count; VAR_5++) {", "component = mxf_resolve_strong_ref(VAR_0, &physical_track->sequence->structural_components_refs[VAR_5], TimecodeComponent);", "if (!component){", "component = mxf_resolve_strong_ref(VAR_0, &physical_track->sequence->structural_components_refs[VAR_5], PulldownComponent);", "if (!component)\ncontinue;", "mxf_pulldown = (MXFPulldownComponent*)component;", "component = mxf_resolve_strong_ref(VAR_0, &mxf_pulldown->input_segment_ref, TimecodeComponent);", "if (!component)\ncontinue;", "}", "mxf_tc = (MXFTimecodeComponent*)component;", "VAR_6 = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;", "start_position = av_rescale_q(sourceclip->start_position,\nphysical_track->edit_rate,\nVAR_1->edit_rate);", "if (av_timecode_init(&tc, mxf_tc->rate, VAR_6, start_position + mxf_tc->start_frame, VAR_0->fc) == 0) {", "mxf_add_timecode_metadata(&VAR_2->metadata, \"timecode\", &tc);", "return 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 67, 69 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133, 135, 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ] ]
22,452
static void user_monitor_complete(void *opaque, QObject *ret_data) { MonitorCompletionData *data = (MonitorCompletionData *)opaque; if (ret_data) { data->user_print(data->mon, ret_data); } monitor_resume(data->mon); g_free(data); }
true
qemu
65207c59d99f2260c5f1d3b9c491146616a522aa
static void user_monitor_complete(void *opaque, QObject *ret_data) { MonitorCompletionData *data = (MonitorCompletionData *)opaque; if (ret_data) { data->user_print(data->mon, ret_data); } monitor_resume(data->mon); g_free(data); }
{ "code": [ "static void user_monitor_complete(void *opaque, QObject *ret_data)", " MonitorCompletionData *data = (MonitorCompletionData *)opaque; ", " if (ret_data) {", " data->user_print(data->mon, ret_data);", " monitor_resume(data->mon);", " g_free(data);" ], "line_no": [ 1, 5, 9, 11, 15, 17 ] }
static void FUNC_0(void *VAR_0, QObject *VAR_1) { MonitorCompletionData *data = (MonitorCompletionData *)VAR_0; if (VAR_1) { data->user_print(data->mon, VAR_1); } monitor_resume(data->mon); g_free(data); }
[ "static void FUNC_0(void *VAR_0, QObject *VAR_1)\n{", "MonitorCompletionData *data = (MonitorCompletionData *)VAR_0;", "if (VAR_1) {", "data->user_print(data->mon, VAR_1);", "}", "monitor_resume(data->mon);", "g_free(data);", "}" ]
[ 1, 1, 1, 1, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
22,454
static int set_string_number(void *obj, const AVOption *o, const char *val, void *dst) { int ret = 0, notfirst = 0; for (;;) { int i, den = 1; char buf[256]; int cmd = 0; double d, num = 1; int64_t intnum = 1; if (*val == '+' || *val == '-') cmd = *(val++); for (i = 0; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++) buf[i] = val[i]; buf[i] = 0; { const AVOption *o_named = av_opt_find(obj, buf, o->unit, 0, 0); if (o_named && o_named->type == AV_OPT_TYPE_CONST) d = DEFAULT_NUMVAL(o_named); else if (!strcmp(buf, "default")) d = DEFAULT_NUMVAL(o); else if (!strcmp(buf, "max" )) d = o->max; else if (!strcmp(buf, "min" )) d = o->min; else if (!strcmp(buf, "none" )) d = 0; else if (!strcmp(buf, "all" )) d = ~0; else { int res = av_expr_parse_and_eval(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj); if (res < 0) { av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val); return res; } } } if (o->type == AV_OPT_TYPE_FLAGS) { read_number(o, dst, NULL, NULL, &intnum); if (cmd == '+') d = intnum | (int64_t)d; else if (cmd == '-') d = intnum &~(int64_t)d; } else { read_number(o, dst, &num, &den, &intnum); if (cmd == '+') d = notfirst*num*intnum/den + d; else if (cmd == '-') d = notfirst*num*intnum/den - d; } if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0) return ret; val += i; if (!*val) return 0; notfirst = 1; } return 0; }
false
FFmpeg
9d5c62ba5b586c80af508b5914934b1c439f6652
static int set_string_number(void *obj, const AVOption *o, const char *val, void *dst) { int ret = 0, notfirst = 0; for (;;) { int i, den = 1; char buf[256]; int cmd = 0; double d, num = 1; int64_t intnum = 1; if (*val == '+' || *val == '-') cmd = *(val++); for (i = 0; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++) buf[i] = val[i]; buf[i] = 0; { const AVOption *o_named = av_opt_find(obj, buf, o->unit, 0, 0); if (o_named && o_named->type == AV_OPT_TYPE_CONST) d = DEFAULT_NUMVAL(o_named); else if (!strcmp(buf, "default")) d = DEFAULT_NUMVAL(o); else if (!strcmp(buf, "max" )) d = o->max; else if (!strcmp(buf, "min" )) d = o->min; else if (!strcmp(buf, "none" )) d = 0; else if (!strcmp(buf, "all" )) d = ~0; else { int res = av_expr_parse_and_eval(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj); if (res < 0) { av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val); return res; } } } if (o->type == AV_OPT_TYPE_FLAGS) { read_number(o, dst, NULL, NULL, &intnum); if (cmd == '+') d = intnum | (int64_t)d; else if (cmd == '-') d = intnum &~(int64_t)d; } else { read_number(o, dst, &num, &den, &intnum); if (cmd == '+') d = notfirst*num*intnum/den + d; else if (cmd == '-') d = notfirst*num*intnum/den - d; } if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0) return ret; val += i; if (!*val) return 0; notfirst = 1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, const AVOption *VAR_1, const char *VAR_2, void *VAR_3) { int VAR_4 = 0, VAR_5 = 0; for (;;) { int VAR_6, VAR_7 = 1; char VAR_8[256]; int VAR_9 = 0; double VAR_10, VAR_11 = 1; int64_t intnum = 1; if (*VAR_2 == '+' || *VAR_2 == '-') VAR_9 = *(VAR_2++); for (VAR_6 = 0; VAR_6 < sizeof(VAR_8) - 1 && VAR_2[VAR_6] && VAR_2[VAR_6] != '+' && VAR_2[VAR_6] != '-'; VAR_6++) VAR_8[VAR_6] = VAR_2[VAR_6]; VAR_8[VAR_6] = 0; { const AVOption *VAR_12 = av_opt_find(VAR_0, VAR_8, VAR_1->unit, 0, 0); if (VAR_12 && VAR_12->type == AV_OPT_TYPE_CONST) VAR_10 = DEFAULT_NUMVAL(VAR_12); else if (!strcmp(VAR_8, "default")) VAR_10 = DEFAULT_NUMVAL(VAR_1); else if (!strcmp(VAR_8, "max" )) VAR_10 = VAR_1->max; else if (!strcmp(VAR_8, "min" )) VAR_10 = VAR_1->min; else if (!strcmp(VAR_8, "none" )) VAR_10 = 0; else if (!strcmp(VAR_8, "all" )) VAR_10 = ~0; else { int VAR_13 = av_expr_parse_and_eval(&VAR_10, VAR_8, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, VAR_0); if (VAR_13 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", VAR_2); return VAR_13; } } } if (VAR_1->type == AV_OPT_TYPE_FLAGS) { read_number(VAR_1, VAR_3, NULL, NULL, &intnum); if (VAR_9 == '+') VAR_10 = intnum | (int64_t)VAR_10; else if (VAR_9 == '-') VAR_10 = intnum &~(int64_t)VAR_10; } else { read_number(VAR_1, VAR_3, &VAR_11, &VAR_7, &intnum); if (VAR_9 == '+') VAR_10 = VAR_5*VAR_11*intnum/VAR_7 + VAR_10; else if (VAR_9 == '-') VAR_10 = VAR_5*VAR_11*intnum/VAR_7 - VAR_10; } if ((VAR_4 = write_number(VAR_0, VAR_1, VAR_3, VAR_10, 1, 1)) < 0) return VAR_4; VAR_2 += VAR_6; if (!*VAR_2) return 0; VAR_5 = 1; } return 0; }
[ "static int FUNC_0(void *VAR_0, const AVOption *VAR_1, const char *VAR_2, void *VAR_3)\n{", "int VAR_4 = 0, VAR_5 = 0;", "for (;;) {", "int VAR_6, VAR_7 = 1;", "char VAR_8[256];", "int VAR_9 = 0;", "double VAR_10, VAR_11 = 1;", "int64_t intnum = 1;", "if (*VAR_2 == '+' || *VAR_2 == '-')\nVAR_9 = *(VAR_2++);", "for (VAR_6 = 0; VAR_6 < sizeof(VAR_8) - 1 && VAR_2[VAR_6] && VAR_2[VAR_6] != '+' && VAR_2[VAR_6] != '-'; VAR_6++)", "VAR_8[VAR_6] = VAR_2[VAR_6];", "VAR_8[VAR_6] = 0;", "{", "const AVOption *VAR_12 = av_opt_find(VAR_0, VAR_8, VAR_1->unit, 0, 0);", "if (VAR_12 && VAR_12->type == AV_OPT_TYPE_CONST)\nVAR_10 = DEFAULT_NUMVAL(VAR_12);", "else if (!strcmp(VAR_8, \"default\")) VAR_10 = DEFAULT_NUMVAL(VAR_1);", "else if (!strcmp(VAR_8, \"max\" )) VAR_10 = VAR_1->max;", "else if (!strcmp(VAR_8, \"min\" )) VAR_10 = VAR_1->min;", "else if (!strcmp(VAR_8, \"none\" )) VAR_10 = 0;", "else if (!strcmp(VAR_8, \"all\" )) VAR_10 = ~0;", "else {", "int VAR_13 = av_expr_parse_and_eval(&VAR_10, VAR_8, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, VAR_0);", "if (VAR_13 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to parse option value \\\"%s\\\"\\n\", VAR_2);", "return VAR_13;", "}", "}", "}", "if (VAR_1->type == AV_OPT_TYPE_FLAGS) {", "read_number(VAR_1, VAR_3, NULL, NULL, &intnum);", "if (VAR_9 == '+') VAR_10 = intnum | (int64_t)VAR_10;", "else if (VAR_9 == '-') VAR_10 = intnum &~(int64_t)VAR_10;", "} else {", "read_number(VAR_1, VAR_3, &VAR_11, &VAR_7, &intnum);", "if (VAR_9 == '+') VAR_10 = VAR_5*VAR_11*intnum/VAR_7 + VAR_10;", "else if (VAR_9 == '-') VAR_10 = VAR_5*VAR_11*intnum/VAR_7 - VAR_10;", "}", "if ((VAR_4 = write_number(VAR_0, VAR_1, VAR_3, VAR_10, 1, 1)) < 0)\nreturn VAR_4;", "VAR_2 += VAR_6;", "if (!*VAR_2)\nreturn 0;", "VAR_5 = 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
22,455
static int amr_wb_encode_frame(AVCodecContext *avctx, unsigned char *frame/*out*/, int buf_size, void *data/*in*/) { AMRWBContext *s; int size; s = (AMRWBContext*) avctx->priv_data; s->mode=getWBBitrateMode(avctx->bit_rate); size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx); return size; }
false
FFmpeg
e7a5854d23e139f5352b59e094387823dbf82522
static int amr_wb_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { AMRWBContext *s; int size; s = (AMRWBContext*) avctx->priv_data; s->mode=getWBBitrateMode(avctx->bit_rate); size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx); return size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3) { AMRWBContext *s; int VAR_4; s = (AMRWBContext*) VAR_0->priv_data; s->mode=getWBBitrateMode(VAR_0->bit_rate); VAR_4 = E_IF_encode(s->state, s->mode, VAR_3, VAR_1, s->allow_dtx); return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nunsigned char *VAR_1, int VAR_2, void *VAR_3)\n{", "AMRWBContext *s;", "int VAR_4;", "s = (AMRWBContext*) VAR_0->priv_data;", "s->mode=getWBBitrateMode(VAR_0->bit_rate);", "VAR_4 = E_IF_encode(s->state, s->mode, VAR_3, VAR_1, s->allow_dtx);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
22,457
static void lag_pred_line(LagarithContext *l, uint8_t *buf, int width, int stride, int line) { int L, TL; /* Left pixel is actually prev_row[width] */ L = buf[width - stride - 1]; if (!line) { /* Left prediction only for first line */ L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1, width - 1, buf[0]); return; } else if (line == 1) { /* Second line, left predict first pixel, the rest of the line is median predicted * NOTE: In the case of RGB this pixel is top predicted */ TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L; } else { /* Top left is 2 rows back, last pixel */ TL = buf[width - (2 * stride) - 1]; } add_lag_median_prediction(buf, buf - stride, buf, width, &L, &TL); }
false
FFmpeg
69494fd5c50742cb7d9ad9ca45b154ab9c33fa19
static void lag_pred_line(LagarithContext *l, uint8_t *buf, int width, int stride, int line) { int L, TL; L = buf[width - stride - 1]; if (!line) { L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1, width - 1, buf[0]); return; } else if (line == 1) { TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L; } else { TL = buf[width - (2 * stride) - 1]; } add_lag_median_prediction(buf, buf - stride, buf, width, &L, &TL); }
{ "code": [], "line_no": [] }
static void FUNC_0(LagarithContext *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6; VAR_5 = VAR_1[VAR_2 - VAR_3 - 1]; if (!VAR_4) { VAR_5 = VAR_0->dsp.add_hfyu_left_prediction(VAR_1 + 1, VAR_1 + 1, VAR_2 - 1, VAR_1[0]); return; } else if (VAR_4 == 1) { VAR_6 = VAR_0->avctx->pix_fmt == PIX_FMT_YUV420P ? VAR_1[-VAR_3] : VAR_5; } else { VAR_6 = VAR_1[VAR_2 - (2 * VAR_3) - 1]; } add_lag_median_prediction(VAR_1, VAR_1 - VAR_3, VAR_1, VAR_2, &VAR_5, &VAR_6); }
[ "static void FUNC_0(LagarithContext *VAR_0, uint8_t *VAR_1,\nint VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6;", "VAR_5 = VAR_1[VAR_2 - VAR_3 - 1];", "if (!VAR_4) {", "VAR_5 = VAR_0->dsp.add_hfyu_left_prediction(VAR_1 + 1, VAR_1 + 1,\nVAR_2 - 1, VAR_1[0]);", "return;", "} else if (VAR_4 == 1) {", "VAR_6 = VAR_0->avctx->pix_fmt == PIX_FMT_YUV420P ? VAR_1[-VAR_3] : VAR_5;", "} else {", "VAR_6 = VAR_1[VAR_2 - (2 * VAR_3) - 1];", "}", "add_lag_median_prediction(VAR_1, VAR_1 - VAR_3, VAR_1,\nVAR_2, &VAR_5, &VAR_6);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47 ] ]
22,460
static void fill_tone_level_array (QDM2Context *q, int flag) { int i, sb, ch, sb_used; int tmp, tab; // This should never happen if (q->nb_channels <= 0) return; for (ch = 0; ch < q->nb_channels; ch++) for (sb = 0; sb < 30; sb++) for (i = 0; i < 8; i++) { if ((tab=coeff_per_sb_for_dequant[q->coeff_per_sb_select][sb]) < (last_coeff[q->coeff_per_sb_select] - 1)) tmp = q->quantized_coeffs[ch][tab + 1][i] * dequant_table[q->coeff_per_sb_select][tab + 1][sb]+ q->quantized_coeffs[ch][tab][i] * dequant_table[q->coeff_per_sb_select][tab][sb]; else tmp = q->quantized_coeffs[ch][tab][i] * dequant_table[q->coeff_per_sb_select][tab][sb]; if(tmp < 0) tmp += 0xff; q->tone_level_idx_base[ch][sb][i] = (tmp / 256) & 0xff; } sb_used = QDM2_SB_USED(q->sub_sampling); if ((q->superblocktype_2_3 != 0) && !flag) { for (sb = 0; sb < sb_used; sb++) for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { q->tone_level_idx[ch][sb][i] = q->tone_level_idx_base[ch][sb][i / 8]; if (q->tone_level_idx[ch][sb][i] < 0) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[0][q->tone_level_idx[ch][sb][i] & 0x3f]; } } else { tab = q->superblocktype_2_3 ? 0 : 1; for (sb = 0; sb < sb_used; sb++) { if ((sb >= 4) && (sb <= 23)) { for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { tmp = q->tone_level_idx_base[ch][sb][i / 8] - q->tone_level_idx_hi1[ch][sb / 8][i / 8][i % 8] - q->tone_level_idx_mid[ch][sb - 4][i / 8] - q->tone_level_idx_hi2[ch][sb - 4]; q->tone_level_idx[ch][sb][i] = tmp & 0xff; if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp)) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; } } else { if (sb > 4) { for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { tmp = q->tone_level_idx_base[ch][sb][i / 8] - q->tone_level_idx_hi1[ch][2][i / 8][i % 8] - q->tone_level_idx_hi2[ch][sb - 4]; q->tone_level_idx[ch][sb][i] = tmp & 0xff; if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp)) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; } } else { for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { tmp = q->tone_level_idx[ch][sb][i] = q->tone_level_idx_base[ch][sb][i / 8]; if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp)) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; } } } } } return; }
false
FFmpeg
eb38d8fe926bdce8110fa4be4fddf6598a079a20
static void fill_tone_level_array (QDM2Context *q, int flag) { int i, sb, ch, sb_used; int tmp, tab; if (q->nb_channels <= 0) return; for (ch = 0; ch < q->nb_channels; ch++) for (sb = 0; sb < 30; sb++) for (i = 0; i < 8; i++) { if ((tab=coeff_per_sb_for_dequant[q->coeff_per_sb_select][sb]) < (last_coeff[q->coeff_per_sb_select] - 1)) tmp = q->quantized_coeffs[ch][tab + 1][i] * dequant_table[q->coeff_per_sb_select][tab + 1][sb]+ q->quantized_coeffs[ch][tab][i] * dequant_table[q->coeff_per_sb_select][tab][sb]; else tmp = q->quantized_coeffs[ch][tab][i] * dequant_table[q->coeff_per_sb_select][tab][sb]; if(tmp < 0) tmp += 0xff; q->tone_level_idx_base[ch][sb][i] = (tmp / 256) & 0xff; } sb_used = QDM2_SB_USED(q->sub_sampling); if ((q->superblocktype_2_3 != 0) && !flag) { for (sb = 0; sb < sb_used; sb++) for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { q->tone_level_idx[ch][sb][i] = q->tone_level_idx_base[ch][sb][i / 8]; if (q->tone_level_idx[ch][sb][i] < 0) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[0][q->tone_level_idx[ch][sb][i] & 0x3f]; } } else { tab = q->superblocktype_2_3 ? 0 : 1; for (sb = 0; sb < sb_used; sb++) { if ((sb >= 4) && (sb <= 23)) { for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { tmp = q->tone_level_idx_base[ch][sb][i / 8] - q->tone_level_idx_hi1[ch][sb / 8][i / 8][i % 8] - q->tone_level_idx_mid[ch][sb - 4][i / 8] - q->tone_level_idx_hi2[ch][sb - 4]; q->tone_level_idx[ch][sb][i] = tmp & 0xff; if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp)) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; } } else { if (sb > 4) { for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { tmp = q->tone_level_idx_base[ch][sb][i / 8] - q->tone_level_idx_hi1[ch][2][i / 8][i % 8] - q->tone_level_idx_hi2[ch][sb - 4]; q->tone_level_idx[ch][sb][i] = tmp & 0xff; if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp)) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; } } else { for (ch = 0; ch < q->nb_channels; ch++) for (i = 0; i < 64; i++) { tmp = q->tone_level_idx[ch][sb][i] = q->tone_level_idx_base[ch][sb][i / 8]; if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp)) q->tone_level[ch][sb][i] = 0; else q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f]; } } } } } return; }
{ "code": [], "line_no": [] }
static void FUNC_0 (QDM2Context *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7; if (VAR_0->nb_channels <= 0) return; for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++) for (VAR_3 = 0; VAR_3 < 30; VAR_3++) for (VAR_2 = 0; VAR_2 < 8; VAR_2++) { if ((VAR_7=coeff_per_sb_for_dequant[VAR_0->coeff_per_sb_select][VAR_3]) < (last_coeff[VAR_0->coeff_per_sb_select] - 1)) VAR_6 = VAR_0->quantized_coeffs[VAR_4][VAR_7 + 1][VAR_2] * dequant_table[VAR_0->coeff_per_sb_select][VAR_7 + 1][VAR_3]+ VAR_0->quantized_coeffs[VAR_4][VAR_7][VAR_2] * dequant_table[VAR_0->coeff_per_sb_select][VAR_7][VAR_3]; else VAR_6 = VAR_0->quantized_coeffs[VAR_4][VAR_7][VAR_2] * dequant_table[VAR_0->coeff_per_sb_select][VAR_7][VAR_3]; if(VAR_6 < 0) VAR_6 += 0xff; VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2] = (VAR_6 / 256) & 0xff; } VAR_5 = QDM2_SB_USED(VAR_0->sub_sampling); if ((VAR_0->superblocktype_2_3 != 0) && !VAR_1) { for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++) for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++) for (VAR_2 = 0; VAR_2 < 64; VAR_2++) { VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8]; if (VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] < 0) VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0; else VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[0][VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] & 0x3f]; } } else { VAR_7 = VAR_0->superblocktype_2_3 ? 0 : 1; for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++) { if ((VAR_3 >= 4) && (VAR_3 <= 23)) { for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++) for (VAR_2 = 0; VAR_2 < 64; VAR_2++) { VAR_6 = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8] - VAR_0->tone_level_idx_hi1[VAR_4][VAR_3 / 8][VAR_2 / 8][VAR_2 % 8] - VAR_0->tone_level_idx_mid[VAR_4][VAR_3 - 4][VAR_2 / 8] - VAR_0->tone_level_idx_hi2[VAR_4][VAR_3 - 4]; VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_6 & 0xff; if ((VAR_6 < 0) || (!VAR_0->superblocktype_2_3 && !VAR_6)) VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0; else VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[VAR_7][VAR_6 & 0x3f]; } } else { if (VAR_3 > 4) { for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++) for (VAR_2 = 0; VAR_2 < 64; VAR_2++) { VAR_6 = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8] - VAR_0->tone_level_idx_hi1[VAR_4][2][VAR_2 / 8][VAR_2 % 8] - VAR_0->tone_level_idx_hi2[VAR_4][VAR_3 - 4]; VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_6 & 0xff; if ((VAR_6 < 0) || (!VAR_0->superblocktype_2_3 && !VAR_6)) VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0; else VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[VAR_7][VAR_6 & 0x3f]; } } else { for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++) for (VAR_2 = 0; VAR_2 < 64; VAR_2++) { VAR_6 = VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8]; if ((VAR_6 < 0) || (!VAR_0->superblocktype_2_3 && !VAR_6)) VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0; else VAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[VAR_7][VAR_6 & 0x3f]; } } } } } return; }
[ "static void FUNC_0 (QDM2Context *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5;", "int VAR_6, VAR_7;", "if (VAR_0->nb_channels <= 0)\nreturn;", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++)", "for (VAR_3 = 0; VAR_3 < 30; VAR_3++)", "for (VAR_2 = 0; VAR_2 < 8; VAR_2++) {", "if ((VAR_7=coeff_per_sb_for_dequant[VAR_0->coeff_per_sb_select][VAR_3]) < (last_coeff[VAR_0->coeff_per_sb_select] - 1))\nVAR_6 = VAR_0->quantized_coeffs[VAR_4][VAR_7 + 1][VAR_2] * dequant_table[VAR_0->coeff_per_sb_select][VAR_7 + 1][VAR_3]+\nVAR_0->quantized_coeffs[VAR_4][VAR_7][VAR_2] * dequant_table[VAR_0->coeff_per_sb_select][VAR_7][VAR_3];", "else\nVAR_6 = VAR_0->quantized_coeffs[VAR_4][VAR_7][VAR_2] * dequant_table[VAR_0->coeff_per_sb_select][VAR_7][VAR_3];", "if(VAR_6 < 0)\nVAR_6 += 0xff;", "VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2] = (VAR_6 / 256) & 0xff;", "}", "VAR_5 = QDM2_SB_USED(VAR_0->sub_sampling);", "if ((VAR_0->superblocktype_2_3 != 0) && !VAR_1) {", "for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++)", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++)", "for (VAR_2 = 0; VAR_2 < 64; VAR_2++) {", "VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8];", "if (VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] < 0)\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0;", "else\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[0][VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] & 0x3f];", "}", "} else {", "VAR_7 = VAR_0->superblocktype_2_3 ? 0 : 1;", "for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++) {", "if ((VAR_3 >= 4) && (VAR_3 <= 23)) {", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++)", "for (VAR_2 = 0; VAR_2 < 64; VAR_2++) {", "VAR_6 = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8] -\nVAR_0->tone_level_idx_hi1[VAR_4][VAR_3 / 8][VAR_2 / 8][VAR_2 % 8] -\nVAR_0->tone_level_idx_mid[VAR_4][VAR_3 - 4][VAR_2 / 8] -\nVAR_0->tone_level_idx_hi2[VAR_4][VAR_3 - 4];", "VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_6 & 0xff;", "if ((VAR_6 < 0) || (!VAR_0->superblocktype_2_3 && !VAR_6))\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0;", "else\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[VAR_7][VAR_6 & 0x3f];", "}", "} else {", "if (VAR_3 > 4) {", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++)", "for (VAR_2 = 0; VAR_2 < 64; VAR_2++) {", "VAR_6 = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8] -\nVAR_0->tone_level_idx_hi1[VAR_4][2][VAR_2 / 8][VAR_2 % 8] -\nVAR_0->tone_level_idx_hi2[VAR_4][VAR_3 - 4];", "VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_6 & 0xff;", "if ((VAR_6 < 0) || (!VAR_0->superblocktype_2_3 && !VAR_6))\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0;", "else\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[VAR_7][VAR_6 & 0x3f];", "}", "} else {", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_channels; VAR_4++)", "for (VAR_2 = 0; VAR_2 < 64; VAR_2++) {", "VAR_6 = VAR_0->tone_level_idx[VAR_4][VAR_3][VAR_2] = VAR_0->tone_level_idx_base[VAR_4][VAR_3][VAR_2 / 8];", "if ((VAR_6 < 0) || (!VAR_0->superblocktype_2_3 && !VAR_6))\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = 0;", "else\nVAR_0->tone_level[VAR_4][VAR_3][VAR_2] = fft_tone_level_table[VAR_7][VAR_6 & 0x3f];", "}", "}", "}", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83, 85, 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117, 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ] ]
22,461
static int filter_frame(AVFilterLink *inlink, AVFrame *src_buffer) { AVFilterContext *ctx = inlink->dst; ATempoContext *atempo = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; int ret = 0; int n_in = src_buffer->nb_samples; int n_out = (int)(0.5 + ((double)n_in) / atempo->tempo); const uint8_t *src = src_buffer->data[0]; const uint8_t *src_end = src + n_in * atempo->stride; while (src < src_end) { if (!atempo->dst_buffer) { atempo->dst_buffer = ff_get_audio_buffer(outlink, n_out); av_frame_copy_props(atempo->dst_buffer, src_buffer); atempo->dst = atempo->dst_buffer->data[0]; atempo->dst_end = atempo->dst + n_out * atempo->stride; } yae_apply(atempo, &src, src_end, &atempo->dst, atempo->dst_end); if (atempo->dst == atempo->dst_end) { ret = push_samples(atempo, outlink, n_out); if (ret < 0) goto end; atempo->request_fulfilled = 1; } } atempo->nsamples_in += n_in; end: av_frame_free(&src_buffer); return ret; }
false
FFmpeg
d38c173dfb4bbee19ec341202c6c79bb0aa2cdad
static int filter_frame(AVFilterLink *inlink, AVFrame *src_buffer) { AVFilterContext *ctx = inlink->dst; ATempoContext *atempo = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; int ret = 0; int n_in = src_buffer->nb_samples; int n_out = (int)(0.5 + ((double)n_in) / atempo->tempo); const uint8_t *src = src_buffer->data[0]; const uint8_t *src_end = src + n_in * atempo->stride; while (src < src_end) { if (!atempo->dst_buffer) { atempo->dst_buffer = ff_get_audio_buffer(outlink, n_out); av_frame_copy_props(atempo->dst_buffer, src_buffer); atempo->dst = atempo->dst_buffer->data[0]; atempo->dst_end = atempo->dst + n_out * atempo->stride; } yae_apply(atempo, &src, src_end, &atempo->dst, atempo->dst_end); if (atempo->dst == atempo->dst_end) { ret = push_samples(atempo, outlink, n_out); if (ret < 0) goto end; atempo->request_fulfilled = 1; } } atempo->nsamples_in += n_in; end: av_frame_free(&src_buffer); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1) { AVFilterContext *ctx = VAR_0->dst; ATempoContext *atempo = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; int VAR_2 = 0; int VAR_3 = VAR_1->nb_samples; int VAR_4 = (int)(0.5 + ((double)VAR_3) / atempo->tempo); const uint8_t *VAR_5 = VAR_1->data[0]; const uint8_t *VAR_6 = VAR_5 + VAR_3 * atempo->stride; while (VAR_5 < VAR_6) { if (!atempo->dst_buffer) { atempo->dst_buffer = ff_get_audio_buffer(outlink, VAR_4); av_frame_copy_props(atempo->dst_buffer, VAR_1); atempo->dst = atempo->dst_buffer->data[0]; atempo->dst_end = atempo->dst + VAR_4 * atempo->stride; } yae_apply(atempo, &VAR_5, VAR_6, &atempo->dst, atempo->dst_end); if (atempo->dst == atempo->dst_end) { VAR_2 = push_samples(atempo, outlink, VAR_4); if (VAR_2 < 0) goto end; atempo->request_fulfilled = 1; } } atempo->nsamples_in += VAR_3; end: av_frame_free(&VAR_1); return VAR_2; }
[ "static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)\n{", "AVFilterContext *ctx = VAR_0->dst;", "ATempoContext *atempo = ctx->priv;", "AVFilterLink *outlink = ctx->outputs[0];", "int VAR_2 = 0;", "int VAR_3 = VAR_1->nb_samples;", "int VAR_4 = (int)(0.5 + ((double)VAR_3) / atempo->tempo);", "const uint8_t *VAR_5 = VAR_1->data[0];", "const uint8_t *VAR_6 = VAR_5 + VAR_3 * atempo->stride;", "while (VAR_5 < VAR_6) {", "if (!atempo->dst_buffer) {", "atempo->dst_buffer = ff_get_audio_buffer(outlink, VAR_4);", "av_frame_copy_props(atempo->dst_buffer, VAR_1);", "atempo->dst = atempo->dst_buffer->data[0];", "atempo->dst_end = atempo->dst + VAR_4 * atempo->stride;", "}", "yae_apply(atempo, &VAR_5, VAR_6, &atempo->dst, atempo->dst_end);", "if (atempo->dst == atempo->dst_end) {", "VAR_2 = push_samples(atempo, outlink, VAR_4);", "if (VAR_2 < 0)\ngoto end;", "atempo->request_fulfilled = 1;", "}", "}", "atempo->nsamples_in += VAR_3;", "end:\nav_frame_free(&VAR_1);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ] ]
22,463
static void put_buffer(GDBState *s, const uint8_t *buf, int len) { #ifdef CONFIG_USER_ONLY int ret; while (len > 0) { ret = send(s->fd, buf, len, 0); if (ret < 0) { if (errno != EINTR && errno != EAGAIN) return; } else { buf += ret; len -= ret; } } #else qemu_chr_fe_write(s->chr, buf, len); #endif }
false
qemu
5819e3e072f41cbf81ad80d822a5c468a91f54e0
static void put_buffer(GDBState *s, const uint8_t *buf, int len) { #ifdef CONFIG_USER_ONLY int ret; while (len > 0) { ret = send(s->fd, buf, len, 0); if (ret < 0) { if (errno != EINTR && errno != EAGAIN) return; } else { buf += ret; len -= ret; } } #else qemu_chr_fe_write(s->chr, buf, len); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(GDBState *VAR_0, const uint8_t *VAR_1, int VAR_2) { #ifdef CONFIG_USER_ONLY int ret; while (VAR_2 > 0) { ret = send(VAR_0->fd, VAR_1, VAR_2, 0); if (ret < 0) { if (errno != EINTR && errno != EAGAIN) return; } else { VAR_1 += ret; VAR_2 -= ret; } } #else qemu_chr_fe_write(VAR_0->chr, VAR_1, VAR_2); #endif }
[ "static void FUNC_0(GDBState *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "#ifdef CONFIG_USER_ONLY\nint ret;", "while (VAR_2 > 0) {", "ret = send(VAR_0->fd, VAR_1, VAR_2, 0);", "if (ret < 0) {", "if (errno != EINTR && errno != EAGAIN)\nreturn;", "} else {", "VAR_1 += ret;", "VAR_2 -= ret;", "}", "}", "#else\nqemu_chr_fe_write(VAR_0->chr, VAR_1, VAR_2);", "#endif\n}" ]
[ 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 ] ]
22,464
static Suite *qdict_suite(void) { Suite *s; TCase *qdict_public_tcase; TCase *qdict_public2_tcase; TCase *qdict_stress_tcase; TCase *qdict_errors_tcase; s = suite_create("QDict test-suite"); qdict_public_tcase = tcase_create("Public Interface"); suite_add_tcase(s, qdict_public_tcase); tcase_add_test(qdict_public_tcase, qdict_new_test); tcase_add_test(qdict_public_tcase, qdict_put_obj_test); tcase_add_test(qdict_public_tcase, qdict_destroy_simple_test); /* Continue, but now with fixtures */ qdict_public2_tcase = tcase_create("Public Interface (2)"); suite_add_tcase(s, qdict_public2_tcase); tcase_add_checked_fixture(qdict_public2_tcase, qdict_setup, qdict_teardown); tcase_add_test(qdict_public2_tcase, qdict_get_test); tcase_add_test(qdict_public2_tcase, qdict_get_int_test); tcase_add_test(qdict_public2_tcase, qdict_get_try_int_test); tcase_add_test(qdict_public2_tcase, qdict_get_str_test); tcase_add_test(qdict_public2_tcase, qdict_get_try_str_test); tcase_add_test(qdict_public2_tcase, qdict_haskey_not_test); tcase_add_test(qdict_public2_tcase, qdict_haskey_test); tcase_add_test(qdict_public2_tcase, qdict_del_test); tcase_add_test(qdict_public2_tcase, qobject_to_qdict_test); tcase_add_test(qdict_public2_tcase, qdict_iterapi_test); qdict_errors_tcase = tcase_create("Errors"); suite_add_tcase(s, qdict_errors_tcase); tcase_add_checked_fixture(qdict_errors_tcase, qdict_setup, qdict_teardown); tcase_add_test(qdict_errors_tcase, qdict_put_exists_test); tcase_add_test(qdict_errors_tcase, qdict_get_not_exists_test); /* The Big one */ qdict_stress_tcase = tcase_create("Stress Test"); suite_add_tcase(s, qdict_stress_tcase); tcase_add_test(qdict_stress_tcase, qdict_stress_test); return s; }
false
qemu
ac531cb6e542b1e61d668604adf9dc5306a948c0
static Suite *qdict_suite(void) { Suite *s; TCase *qdict_public_tcase; TCase *qdict_public2_tcase; TCase *qdict_stress_tcase; TCase *qdict_errors_tcase; s = suite_create("QDict test-suite"); qdict_public_tcase = tcase_create("Public Interface"); suite_add_tcase(s, qdict_public_tcase); tcase_add_test(qdict_public_tcase, qdict_new_test); tcase_add_test(qdict_public_tcase, qdict_put_obj_test); tcase_add_test(qdict_public_tcase, qdict_destroy_simple_test); qdict_public2_tcase = tcase_create("Public Interface (2)"); suite_add_tcase(s, qdict_public2_tcase); tcase_add_checked_fixture(qdict_public2_tcase, qdict_setup, qdict_teardown); tcase_add_test(qdict_public2_tcase, qdict_get_test); tcase_add_test(qdict_public2_tcase, qdict_get_int_test); tcase_add_test(qdict_public2_tcase, qdict_get_try_int_test); tcase_add_test(qdict_public2_tcase, qdict_get_str_test); tcase_add_test(qdict_public2_tcase, qdict_get_try_str_test); tcase_add_test(qdict_public2_tcase, qdict_haskey_not_test); tcase_add_test(qdict_public2_tcase, qdict_haskey_test); tcase_add_test(qdict_public2_tcase, qdict_del_test); tcase_add_test(qdict_public2_tcase, qobject_to_qdict_test); tcase_add_test(qdict_public2_tcase, qdict_iterapi_test); qdict_errors_tcase = tcase_create("Errors"); suite_add_tcase(s, qdict_errors_tcase); tcase_add_checked_fixture(qdict_errors_tcase, qdict_setup, qdict_teardown); tcase_add_test(qdict_errors_tcase, qdict_put_exists_test); tcase_add_test(qdict_errors_tcase, qdict_get_not_exists_test); qdict_stress_tcase = tcase_create("Stress Test"); suite_add_tcase(s, qdict_stress_tcase); tcase_add_test(qdict_stress_tcase, qdict_stress_test); return s; }
{ "code": [], "line_no": [] }
static Suite *FUNC_0(void) { Suite *s; TCase *qdict_public_tcase; TCase *qdict_public2_tcase; TCase *qdict_stress_tcase; TCase *qdict_errors_tcase; s = suite_create("QDict test-suite"); qdict_public_tcase = tcase_create("Public Interface"); suite_add_tcase(s, qdict_public_tcase); tcase_add_test(qdict_public_tcase, qdict_new_test); tcase_add_test(qdict_public_tcase, qdict_put_obj_test); tcase_add_test(qdict_public_tcase, qdict_destroy_simple_test); qdict_public2_tcase = tcase_create("Public Interface (2)"); suite_add_tcase(s, qdict_public2_tcase); tcase_add_checked_fixture(qdict_public2_tcase, qdict_setup, qdict_teardown); tcase_add_test(qdict_public2_tcase, qdict_get_test); tcase_add_test(qdict_public2_tcase, qdict_get_int_test); tcase_add_test(qdict_public2_tcase, qdict_get_try_int_test); tcase_add_test(qdict_public2_tcase, qdict_get_str_test); tcase_add_test(qdict_public2_tcase, qdict_get_try_str_test); tcase_add_test(qdict_public2_tcase, qdict_haskey_not_test); tcase_add_test(qdict_public2_tcase, qdict_haskey_test); tcase_add_test(qdict_public2_tcase, qdict_del_test); tcase_add_test(qdict_public2_tcase, qobject_to_qdict_test); tcase_add_test(qdict_public2_tcase, qdict_iterapi_test); qdict_errors_tcase = tcase_create("Errors"); suite_add_tcase(s, qdict_errors_tcase); tcase_add_checked_fixture(qdict_errors_tcase, qdict_setup, qdict_teardown); tcase_add_test(qdict_errors_tcase, qdict_put_exists_test); tcase_add_test(qdict_errors_tcase, qdict_get_not_exists_test); qdict_stress_tcase = tcase_create("Stress Test"); suite_add_tcase(s, qdict_stress_tcase); tcase_add_test(qdict_stress_tcase, qdict_stress_test); return s; }
[ "static Suite *FUNC_0(void)\n{", "Suite *s;", "TCase *qdict_public_tcase;", "TCase *qdict_public2_tcase;", "TCase *qdict_stress_tcase;", "TCase *qdict_errors_tcase;", "s = suite_create(\"QDict test-suite\");", "qdict_public_tcase = tcase_create(\"Public Interface\");", "suite_add_tcase(s, qdict_public_tcase);", "tcase_add_test(qdict_public_tcase, qdict_new_test);", "tcase_add_test(qdict_public_tcase, qdict_put_obj_test);", "tcase_add_test(qdict_public_tcase, qdict_destroy_simple_test);", "qdict_public2_tcase = tcase_create(\"Public Interface (2)\");", "suite_add_tcase(s, qdict_public2_tcase);", "tcase_add_checked_fixture(qdict_public2_tcase, qdict_setup, qdict_teardown);", "tcase_add_test(qdict_public2_tcase, qdict_get_test);", "tcase_add_test(qdict_public2_tcase, qdict_get_int_test);", "tcase_add_test(qdict_public2_tcase, qdict_get_try_int_test);", "tcase_add_test(qdict_public2_tcase, qdict_get_str_test);", "tcase_add_test(qdict_public2_tcase, qdict_get_try_str_test);", "tcase_add_test(qdict_public2_tcase, qdict_haskey_not_test);", "tcase_add_test(qdict_public2_tcase, qdict_haskey_test);", "tcase_add_test(qdict_public2_tcase, qdict_del_test);", "tcase_add_test(qdict_public2_tcase, qobject_to_qdict_test);", "tcase_add_test(qdict_public2_tcase, qdict_iterapi_test);", "qdict_errors_tcase = tcase_create(\"Errors\");", "suite_add_tcase(s, qdict_errors_tcase);", "tcase_add_checked_fixture(qdict_errors_tcase, qdict_setup, qdict_teardown);", "tcase_add_test(qdict_errors_tcase, qdict_put_exists_test);", "tcase_add_test(qdict_errors_tcase, qdict_get_not_exists_test);", "qdict_stress_tcase = tcase_create(\"Stress Test\");", "suite_add_tcase(s, qdict_stress_tcase);", "tcase_add_test(qdict_stress_tcase, qdict_stress_test);", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ] ]
22,466
static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) { Error *local_err = NULL; QObject *obj, *data; QDict *input, *args; const mon_cmd_t *cmd; const char *cmd_name; Monitor *mon = cur_mon; args = input = NULL; data = NULL; obj = json_parser_parse(tokens, NULL); if (!obj) { // FIXME: should be triggered in json_parser_parse() qerror_report(QERR_JSON_PARSING); goto err_out; } input = qmp_check_input_obj(obj, &local_err); if (!input) { qerror_report_err(local_err); qobject_decref(obj); goto err_out; } mon->mc->id = qdict_get(input, "id"); qobject_incref(mon->mc->id); cmd_name = qdict_get_str(input, "execute"); trace_handle_qmp_command(mon, cmd_name); cmd = qmp_find_cmd(cmd_name); if (!cmd) { qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found", cmd_name); goto err_out; } if (invalid_qmp_mode(mon, cmd)) { goto err_out; } obj = qdict_get(input, "arguments"); if (!obj) { args = qdict_new(); } else { args = qobject_to_qdict(obj); QINCREF(args); } qmp_check_client_args(cmd, args, &local_err); if (local_err) { qerror_report_err(local_err); goto err_out; } if (cmd->mhandler.cmd_new(mon, args, &data)) { /* Command failed... */ if (!monitor_has_error(mon)) { /* ... without setting an error, so make one up */ qerror_report(QERR_UNDEFINED_ERROR); } } err_out: monitor_protocol_emitter(mon, data); qobject_decref(data); QDECREF(input); QDECREF(args); }
false
qemu
4086182fcd9b106345b5cc535d78bcc6d13a7683
static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) { Error *local_err = NULL; QObject *obj, *data; QDict *input, *args; const mon_cmd_t *cmd; const char *cmd_name; Monitor *mon = cur_mon; args = input = NULL; data = NULL; obj = json_parser_parse(tokens, NULL); if (!obj) { qerror_report(QERR_JSON_PARSING); goto err_out; } input = qmp_check_input_obj(obj, &local_err); if (!input) { qerror_report_err(local_err); qobject_decref(obj); goto err_out; } mon->mc->id = qdict_get(input, "id"); qobject_incref(mon->mc->id); cmd_name = qdict_get_str(input, "execute"); trace_handle_qmp_command(mon, cmd_name); cmd = qmp_find_cmd(cmd_name); if (!cmd) { qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found", cmd_name); goto err_out; } if (invalid_qmp_mode(mon, cmd)) { goto err_out; } obj = qdict_get(input, "arguments"); if (!obj) { args = qdict_new(); } else { args = qobject_to_qdict(obj); QINCREF(args); } qmp_check_client_args(cmd, args, &local_err); if (local_err) { qerror_report_err(local_err); goto err_out; } if (cmd->mhandler.cmd_new(mon, args, &data)) { if (!monitor_has_error(mon)) { qerror_report(QERR_UNDEFINED_ERROR); } } err_out: monitor_protocol_emitter(mon, data); qobject_decref(data); QDECREF(input); QDECREF(args); }
{ "code": [], "line_no": [] }
static void FUNC_0(JSONMessageParser *VAR_0, QList *VAR_1) { Error *local_err = NULL; QObject *obj, *data; QDict *input, *args; const mon_cmd_t *VAR_2; const char *VAR_3; Monitor *mon = cur_mon; args = input = NULL; data = NULL; obj = json_parser_parse(VAR_1, NULL); if (!obj) { qerror_report(QERR_JSON_PARSING); goto err_out; } input = qmp_check_input_obj(obj, &local_err); if (!input) { qerror_report_err(local_err); qobject_decref(obj); goto err_out; } mon->mc->id = qdict_get(input, "id"); qobject_incref(mon->mc->id); VAR_3 = qdict_get_str(input, "execute"); trace_handle_qmp_command(mon, VAR_3); VAR_2 = qmp_find_cmd(VAR_3); if (!VAR_2) { qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found", VAR_3); goto err_out; } if (invalid_qmp_mode(mon, VAR_2)) { goto err_out; } obj = qdict_get(input, "arguments"); if (!obj) { args = qdict_new(); } else { args = qobject_to_qdict(obj); QINCREF(args); } qmp_check_client_args(VAR_2, args, &local_err); if (local_err) { qerror_report_err(local_err); goto err_out; } if (VAR_2->mhandler.cmd_new(mon, args, &data)) { if (!monitor_has_error(mon)) { qerror_report(QERR_UNDEFINED_ERROR); } } err_out: monitor_protocol_emitter(mon, data); qobject_decref(data); QDECREF(input); QDECREF(args); }
[ "static void FUNC_0(JSONMessageParser *VAR_0, QList *VAR_1)\n{", "Error *local_err = NULL;", "QObject *obj, *data;", "QDict *input, *args;", "const mon_cmd_t *VAR_2;", "const char *VAR_3;", "Monitor *mon = cur_mon;", "args = input = NULL;", "data = NULL;", "obj = json_parser_parse(VAR_1, NULL);", "if (!obj) {", "qerror_report(QERR_JSON_PARSING);", "goto err_out;", "}", "input = qmp_check_input_obj(obj, &local_err);", "if (!input) {", "qerror_report_err(local_err);", "qobject_decref(obj);", "goto err_out;", "}", "mon->mc->id = qdict_get(input, \"id\");", "qobject_incref(mon->mc->id);", "VAR_3 = qdict_get_str(input, \"execute\");", "trace_handle_qmp_command(mon, VAR_3);", "VAR_2 = qmp_find_cmd(VAR_3);", "if (!VAR_2) {", "qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND,\n\"The command %s has not been found\", VAR_3);", "goto err_out;", "}", "if (invalid_qmp_mode(mon, VAR_2)) {", "goto err_out;", "}", "obj = qdict_get(input, \"arguments\");", "if (!obj) {", "args = qdict_new();", "} else {", "args = qobject_to_qdict(obj);", "QINCREF(args);", "}", "qmp_check_client_args(VAR_2, args, &local_err);", "if (local_err) {", "qerror_report_err(local_err);", "goto err_out;", "}", "if (VAR_2->mhandler.cmd_new(mon, args, &data)) {", "if (!monitor_has_error(mon)) {", "qerror_report(QERR_UNDEFINED_ERROR);", "}", "}", "err_out:\nmonitor_protocol_emitter(mon, data);", "qobject_decref(data);", "QDECREF(input);", "QDECREF(args);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ] ]
22,467
static void aer915_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); k->init = aer915_init; k->event = aer915_event; k->recv = aer915_recv; k->send = aer915_send; dc->vmsd = &vmstate_aer915_state; }
false
qemu
9e41bade85ef338afd983c109368d1bbbe931f80
static void aer915_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); k->init = aer915_init; k->event = aer915_event; k->recv = aer915_recv; k->send = aer915_send; dc->vmsd = &vmstate_aer915_state; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); I2CSlaveClass *k = I2C_SLAVE_CLASS(VAR_0); k->init = aer915_init; k->event = aer915_event; k->recv = aer915_recv; k->send = aer915_send; dc->vmsd = &vmstate_aer915_state; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "I2CSlaveClass *k = I2C_SLAVE_CLASS(VAR_0);", "k->init = aer915_init;", "k->event = aer915_event;", "k->recv = aer915_recv;", "k->send = aer915_send;", "dc->vmsd = &vmstate_aer915_state;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
22,468
static av_always_inline void decode_line(FFV1Context *s, int w, int16_t *sample[2], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_count = 0; int run_mode = 0; int run_index = s->run_index; for (x = 0; x < w; x++) { int diff, context, sign; context = get_context(p, sample[1] + x, sample[0] + x, sample[1] + x); if (context < 0) { context = -context; sign = 1; } else sign = 0; av_assert2(context < p->context_count); if (s->ac) { diff = get_symbol_inline(c, p->state[context], 1); } else { if (context == 0 && run_mode == 0) run_mode = 1; if (run_mode) { if (run_count == 0 && run_mode == 1) { if (get_bits1(&s->gb)) { run_count = 1 << ff_log2_run[run_index]; if (x + run_count <= w) run_index++; } else { if (ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]); else run_count = 0; if (run_index) run_index--; run_mode = 2; } } run_count--; if (run_count < 0) { run_mode = 0; run_count = 0; diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if (diff >= 0) diff++; } else diff = 0; } else diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, get_bits_count(&s->gb)); } if (sign) diff = -diff; sample[1][x] = (predict(sample[1] + x, sample[0] + x) + diff) & ((1 << bits) - 1); } s->run_index = run_index; }
false
FFmpeg
4bb1070c154e49d35805fbcdac9c9e92f702ef96
static av_always_inline void decode_line(FFV1Context *s, int w, int16_t *sample[2], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_count = 0; int run_mode = 0; int run_index = s->run_index; for (x = 0; x < w; x++) { int diff, context, sign; context = get_context(p, sample[1] + x, sample[0] + x, sample[1] + x); if (context < 0) { context = -context; sign = 1; } else sign = 0; av_assert2(context < p->context_count); if (s->ac) { diff = get_symbol_inline(c, p->state[context], 1); } else { if (context == 0 && run_mode == 0) run_mode = 1; if (run_mode) { if (run_count == 0 && run_mode == 1) { if (get_bits1(&s->gb)) { run_count = 1 << ff_log2_run[run_index]; if (x + run_count <= w) run_index++; } else { if (ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]); else run_count = 0; if (run_index) run_index--; run_mode = 2; } } run_count--; if (run_count < 0) { run_mode = 0; run_count = 0; diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if (diff >= 0) diff++; } else diff = 0; } else diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, get_bits_count(&s->gb)); } if (sign) diff = -diff; sample[1][x] = (predict(sample[1] + x, sample[0] + x) + diff) & ((1 << bits) - 1); } s->run_index = run_index; }
{ "code": [], "line_no": [] }
static av_always_inline void FUNC_0(FFV1Context *s, int w, int16_t *sample[2], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int VAR_0; int VAR_1 = 0; int VAR_2 = 0; int VAR_3 = s->VAR_3; for (VAR_0 = 0; VAR_0 < w; VAR_0++) { int VAR_4, VAR_5, VAR_6; VAR_5 = get_context(p, sample[1] + VAR_0, sample[0] + VAR_0, sample[1] + VAR_0); if (VAR_5 < 0) { VAR_5 = -VAR_5; VAR_6 = 1; } else VAR_6 = 0; av_assert2(VAR_5 < p->context_count); if (s->ac) { VAR_4 = get_symbol_inline(c, p->state[VAR_5], 1); } else { if (VAR_5 == 0 && VAR_2 == 0) VAR_2 = 1; if (VAR_2) { if (VAR_1 == 0 && VAR_2 == 1) { if (get_bits1(&s->gb)) { VAR_1 = 1 << ff_log2_run[VAR_3]; if (VAR_0 + VAR_1 <= w) VAR_3++; } else { if (ff_log2_run[VAR_3]) VAR_1 = get_bits(&s->gb, ff_log2_run[VAR_3]); else VAR_1 = 0; if (VAR_3) VAR_3--; VAR_2 = 2; } } VAR_1--; if (VAR_1 < 0) { VAR_2 = 0; VAR_1 = 0; VAR_4 = get_vlc_symbol(&s->gb, &p->vlc_state[VAR_5], bits); if (VAR_4 >= 0) VAR_4++; } else VAR_4 = 0; } else VAR_4 = get_vlc_symbol(&s->gb, &p->vlc_state[VAR_5], bits); ff_dlog(s->avctx, "count:%d index:%d, mode:%d, VAR_0:%d pos:%d\n", VAR_1, VAR_3, VAR_2, VAR_0, get_bits_count(&s->gb)); } if (VAR_6) VAR_4 = -VAR_4; sample[1][VAR_0] = (predict(sample[1] + VAR_0, sample[0] + VAR_0) + VAR_4) & ((1 << bits) - 1); } s->VAR_3 = VAR_3; }
[ "static av_always_inline void FUNC_0(FFV1Context *s, int w,\nint16_t *sample[2],\nint plane_index, int bits)\n{", "PlaneContext *const p = &s->plane[plane_index];", "RangeCoder *const c = &s->c;", "int VAR_0;", "int VAR_1 = 0;", "int VAR_2 = 0;", "int VAR_3 = s->VAR_3;", "for (VAR_0 = 0; VAR_0 < w; VAR_0++) {", "int VAR_4, VAR_5, VAR_6;", "VAR_5 = get_context(p, sample[1] + VAR_0, sample[0] + VAR_0, sample[1] + VAR_0);", "if (VAR_5 < 0) {", "VAR_5 = -VAR_5;", "VAR_6 = 1;", "} else", "VAR_6 = 0;", "av_assert2(VAR_5 < p->context_count);", "if (s->ac) {", "VAR_4 = get_symbol_inline(c, p->state[VAR_5], 1);", "} else {", "if (VAR_5 == 0 && VAR_2 == 0)\nVAR_2 = 1;", "if (VAR_2) {", "if (VAR_1 == 0 && VAR_2 == 1) {", "if (get_bits1(&s->gb)) {", "VAR_1 = 1 << ff_log2_run[VAR_3];", "if (VAR_0 + VAR_1 <= w)\nVAR_3++;", "} else {", "if (ff_log2_run[VAR_3])\nVAR_1 = get_bits(&s->gb, ff_log2_run[VAR_3]);", "else\nVAR_1 = 0;", "if (VAR_3)\nVAR_3--;", "VAR_2 = 2;", "}", "}", "VAR_1--;", "if (VAR_1 < 0) {", "VAR_2 = 0;", "VAR_1 = 0;", "VAR_4 = get_vlc_symbol(&s->gb, &p->vlc_state[VAR_5],\nbits);", "if (VAR_4 >= 0)\nVAR_4++;", "} else", "VAR_4 = 0;", "} else", "VAR_4 = get_vlc_symbol(&s->gb, &p->vlc_state[VAR_5], bits);", "ff_dlog(s->avctx, \"count:%d index:%d, mode:%d, VAR_0:%d pos:%d\\n\",\nVAR_1, VAR_3, VAR_2, VAR_0, get_bits_count(&s->gb));", "}", "if (VAR_6)\nVAR_4 = -VAR_4;", "sample[1][VAR_0] = (predict(sample[1] + VAR_0, sample[0] + VAR_0) + VAR_4) &\n((1 << bits) - 1);", "}", "s->VAR_3 = VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 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 ], [ 117, 119 ], [ 121 ], [ 125, 127 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ] ]
22,469
static uint64_t mcf_fec_read(void *opaque, target_phys_addr_t addr, unsigned size) { mcf_fec_state *s = (mcf_fec_state *)opaque; switch (addr & 0x3ff) { case 0x004: return s->eir; case 0x008: return s->eimr; case 0x010: return s->rx_enabled ? (1 << 24) : 0; /* RDAR */ case 0x014: return 0; /* TDAR */ case 0x024: return s->ecr; case 0x040: return s->mmfr; case 0x044: return s->mscr; case 0x064: return 0; /* MIBC */ case 0x084: return s->rcr; case 0x0c4: return s->tcr; case 0x0e4: /* PALR */ return (s->conf.macaddr.a[0] << 24) | (s->conf.macaddr.a[1] << 16) | (s->conf.macaddr.a[2] << 8) | s->conf.macaddr.a[3]; break; case 0x0e8: /* PAUR */ return (s->conf.macaddr.a[4] << 24) | (s->conf.macaddr.a[5] << 16) | 0x8808; case 0x0ec: return 0x10000; /* OPD */ case 0x118: return 0; case 0x11c: return 0; case 0x120: return 0; case 0x124: return 0; case 0x144: return s->tfwr; case 0x14c: return 0x600; case 0x150: return s->rfsr; case 0x180: return s->erdsr; case 0x184: return s->etdsr; case 0x188: return s->emrbr; default: hw_error("mcf_fec_read: Bad address 0x%x\n", (int)addr); return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t mcf_fec_read(void *opaque, target_phys_addr_t addr, unsigned size) { mcf_fec_state *s = (mcf_fec_state *)opaque; switch (addr & 0x3ff) { case 0x004: return s->eir; case 0x008: return s->eimr; case 0x010: return s->rx_enabled ? (1 << 24) : 0; case 0x014: return 0; case 0x024: return s->ecr; case 0x040: return s->mmfr; case 0x044: return s->mscr; case 0x064: return 0; case 0x084: return s->rcr; case 0x0c4: return s->tcr; case 0x0e4: return (s->conf.macaddr.a[0] << 24) | (s->conf.macaddr.a[1] << 16) | (s->conf.macaddr.a[2] << 8) | s->conf.macaddr.a[3]; break; case 0x0e8: return (s->conf.macaddr.a[4] << 24) | (s->conf.macaddr.a[5] << 16) | 0x8808; case 0x0ec: return 0x10000; case 0x118: return 0; case 0x11c: return 0; case 0x120: return 0; case 0x124: return 0; case 0x144: return s->tfwr; case 0x14c: return 0x600; case 0x150: return s->rfsr; case 0x180: return s->erdsr; case 0x184: return s->etdsr; case 0x188: return s->emrbr; default: hw_error("mcf_fec_read: Bad address 0x%x\n", (int)addr); return 0; } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { mcf_fec_state *s = (mcf_fec_state *)opaque; switch (addr & 0x3ff) { case 0x004: return s->eir; case 0x008: return s->eimr; case 0x010: return s->rx_enabled ? (1 << 24) : 0; case 0x014: return 0; case 0x024: return s->ecr; case 0x040: return s->mmfr; case 0x044: return s->mscr; case 0x064: return 0; case 0x084: return s->rcr; case 0x0c4: return s->tcr; case 0x0e4: return (s->conf.macaddr.a[0] << 24) | (s->conf.macaddr.a[1] << 16) | (s->conf.macaddr.a[2] << 8) | s->conf.macaddr.a[3]; break; case 0x0e8: return (s->conf.macaddr.a[4] << 24) | (s->conf.macaddr.a[5] << 16) | 0x8808; case 0x0ec: return 0x10000; case 0x118: return 0; case 0x11c: return 0; case 0x120: return 0; case 0x124: return 0; case 0x144: return s->tfwr; case 0x14c: return 0x600; case 0x150: return s->rfsr; case 0x180: return s->erdsr; case 0x184: return s->etdsr; case 0x188: return s->emrbr; default: hw_error("FUNC_0: Bad address 0x%x\n", (int)addr); return 0; } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "mcf_fec_state *s = (mcf_fec_state *)opaque;", "switch (addr & 0x3ff) {", "case 0x004: return s->eir;", "case 0x008: return s->eimr;", "case 0x010: return s->rx_enabled ? (1 << 24) : 0;", "case 0x014: return 0;", "case 0x024: return s->ecr;", "case 0x040: return s->mmfr;", "case 0x044: return s->mscr;", "case 0x064: return 0;", "case 0x084: return s->rcr;", "case 0x0c4: return s->tcr;", "case 0x0e4:\nreturn (s->conf.macaddr.a[0] << 24) | (s->conf.macaddr.a[1] << 16)\n| (s->conf.macaddr.a[2] << 8) | s->conf.macaddr.a[3];", "break;", "case 0x0e8:\nreturn (s->conf.macaddr.a[4] << 24) | (s->conf.macaddr.a[5] << 16) | 0x8808;", "case 0x0ec: return 0x10000;", "case 0x118: return 0;", "case 0x11c: return 0;", "case 0x120: return 0;", "case 0x124: return 0;", "case 0x144: return s->tfwr;", "case 0x14c: return 0x600;", "case 0x150: return s->rfsr;", "case 0x180: return s->erdsr;", "case 0x184: return s->etdsr;", "case 0x188: return s->emrbr;", "default:\nhw_error(\"FUNC_0: Bad address 0x%x\\n\", (int)addr);", "return 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ] ]
22,470
static hwaddr ppc_hash64_pteg_search(PowerPCCPU *cpu, hwaddr hash, const struct ppc_one_seg_page_size *sps, target_ulong ptem, ppc_hash_pte64_t *pte, unsigned *pshift) { CPUPPCState *env = &cpu->env; int i; const ppc_hash_pte64_t *pteg; target_ulong pte0, pte1; target_ulong ptex; ptex = (hash & env->htab_mask) * HPTES_PER_GROUP; pteg = ppc_hash64_map_hptes(cpu, ptex, HPTES_PER_GROUP); if (!pteg) { return -1; } for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash64_hpte0(cpu, pteg, i); pte1 = ppc_hash64_hpte1(cpu, pteg, i); /* This compares V, B, H (secondary) and the AVPN */ if (HPTE64_V_COMPARE(pte0, ptem)) { *pshift = hpte_page_shift(sps, pte0, pte1); /* * If there is no match, ignore the PTE, it could simply * be for a different segment size encoding and the * architecture specifies we should not match. Linux will * potentially leave behind PTEs for the wrong base page * size when demoting segments. */ if (*pshift == 0) { continue; } /* We don't do anything with pshift yet as qemu TLB only deals * with 4K pages anyway */ pte->pte0 = pte0; pte->pte1 = pte1; ppc_hash64_unmap_hptes(cpu, pteg, ptex, HPTES_PER_GROUP); return ptex + i; } } ppc_hash64_unmap_hptes(cpu, pteg, ptex, HPTES_PER_GROUP); /* * We didn't find a valid entry. */ return -1; }
false
qemu
36778660d7fd0748a6129916e47ecedd67bdb758
static hwaddr ppc_hash64_pteg_search(PowerPCCPU *cpu, hwaddr hash, const struct ppc_one_seg_page_size *sps, target_ulong ptem, ppc_hash_pte64_t *pte, unsigned *pshift) { CPUPPCState *env = &cpu->env; int i; const ppc_hash_pte64_t *pteg; target_ulong pte0, pte1; target_ulong ptex; ptex = (hash & env->htab_mask) * HPTES_PER_GROUP; pteg = ppc_hash64_map_hptes(cpu, ptex, HPTES_PER_GROUP); if (!pteg) { return -1; } for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash64_hpte0(cpu, pteg, i); pte1 = ppc_hash64_hpte1(cpu, pteg, i); if (HPTE64_V_COMPARE(pte0, ptem)) { *pshift = hpte_page_shift(sps, pte0, pte1); if (*pshift == 0) { continue; } pte->pte0 = pte0; pte->pte1 = pte1; ppc_hash64_unmap_hptes(cpu, pteg, ptex, HPTES_PER_GROUP); return ptex + i; } } ppc_hash64_unmap_hptes(cpu, pteg, ptex, HPTES_PER_GROUP); return -1; }
{ "code": [], "line_no": [] }
static hwaddr FUNC_0(PowerPCCPU *cpu, hwaddr hash, const struct ppc_one_seg_page_size *sps, target_ulong ptem, ppc_hash_pte64_t *pte, unsigned *pshift) { CPUPPCState *env = &cpu->env; int VAR_0; const ppc_hash_pte64_t *VAR_1; target_ulong pte0, pte1; target_ulong ptex; ptex = (hash & env->htab_mask) * HPTES_PER_GROUP; VAR_1 = ppc_hash64_map_hptes(cpu, ptex, HPTES_PER_GROUP); if (!VAR_1) { return -1; } for (VAR_0 = 0; VAR_0 < HPTES_PER_GROUP; VAR_0++) { pte0 = ppc_hash64_hpte0(cpu, VAR_1, VAR_0); pte1 = ppc_hash64_hpte1(cpu, VAR_1, VAR_0); if (HPTE64_V_COMPARE(pte0, ptem)) { *pshift = hpte_page_shift(sps, pte0, pte1); if (*pshift == 0) { continue; } pte->pte0 = pte0; pte->pte1 = pte1; ppc_hash64_unmap_hptes(cpu, VAR_1, ptex, HPTES_PER_GROUP); return ptex + VAR_0; } } ppc_hash64_unmap_hptes(cpu, VAR_1, ptex, HPTES_PER_GROUP); return -1; }
[ "static hwaddr FUNC_0(PowerPCCPU *cpu, hwaddr hash,\nconst struct ppc_one_seg_page_size *sps,\ntarget_ulong ptem,\nppc_hash_pte64_t *pte, unsigned *pshift)\n{", "CPUPPCState *env = &cpu->env;", "int VAR_0;", "const ppc_hash_pte64_t *VAR_1;", "target_ulong pte0, pte1;", "target_ulong ptex;", "ptex = (hash & env->htab_mask) * HPTES_PER_GROUP;", "VAR_1 = ppc_hash64_map_hptes(cpu, ptex, HPTES_PER_GROUP);", "if (!VAR_1) {", "return -1;", "}", "for (VAR_0 = 0; VAR_0 < HPTES_PER_GROUP; VAR_0++) {", "pte0 = ppc_hash64_hpte0(cpu, VAR_1, VAR_0);", "pte1 = ppc_hash64_hpte1(cpu, VAR_1, VAR_0);", "if (HPTE64_V_COMPARE(pte0, ptem)) {", "*pshift = hpte_page_shift(sps, pte0, pte1);", "if (*pshift == 0) {", "continue;", "}", "pte->pte0 = pte0;", "pte->pte1 = pte1;", "ppc_hash64_unmap_hptes(cpu, VAR_1, ptex, HPTES_PER_GROUP);", "return ptex + VAR_0;", "}", "}", "ppc_hash64_unmap_hptes(cpu, VAR_1, ptex, HPTES_PER_GROUP);", "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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 61 ], [ 63 ], [ 65 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 93 ], [ 95 ] ]
22,471
static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum, BlockDriverState **file) { BDRVRawState *s = bs->opaque; *pnum = nb_sectors; *file = bs->file->bs; sector_num += s->offset / BDRV_SECTOR_SIZE; return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA | (sector_num << BDRV_SECTOR_BITS); }
false
qemu
2e6fc7eb1a4af1b127df5f07b8bb28af891946fa
static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum, BlockDriverState **file) { BDRVRawState *s = bs->opaque; *pnum = nb_sectors; *file = bs->file->bs; sector_num += s->offset / BDRV_SECTOR_SIZE; 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, BlockDriverState **file) { BDRVRawState *s = bs->opaque; *pnum = nb_sectors; *file = bs->file->bs; sector_num += s->offset / BDRV_SECTOR_SIZE; 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,\nBlockDriverState **file)\n{", "BDRVRawState *s = bs->opaque;", "*pnum = nb_sectors;", "*file = bs->file->bs;", "sector_num += s->offset / BDRV_SECTOR_SIZE;", "return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA |\n(sector_num << BDRV_SECTOR_BITS);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ] ]
22,472
static void v9fs_wstat_post_rename(V9fsState *s, V9fsWstatState *vs, int err) { if (err < 0) { goto out; } if (vs->v9stat.name.size != 0) { v9fs_string_free(&vs->nname); } if (vs->v9stat.length != -1) { if (v9fs_do_truncate(s, &vs->fidp->path, vs->v9stat.length) < 0) { err = -errno; } } v9fs_wstat_post_truncate(s, vs, err); return; out: v9fs_stat_free(&vs->v9stat); complete_pdu(s, vs->pdu, err); qemu_free(vs); }
false
qemu
c7b4b0b302709928b84582881a7b4fb6c1e39e2b
static void v9fs_wstat_post_rename(V9fsState *s, V9fsWstatState *vs, int err) { if (err < 0) { goto out; } if (vs->v9stat.name.size != 0) { v9fs_string_free(&vs->nname); } if (vs->v9stat.length != -1) { if (v9fs_do_truncate(s, &vs->fidp->path, vs->v9stat.length) < 0) { err = -errno; } } v9fs_wstat_post_truncate(s, vs, err); return; out: v9fs_stat_free(&vs->v9stat); complete_pdu(s, vs->pdu, err); qemu_free(vs); }
{ "code": [], "line_no": [] }
static void FUNC_0(V9fsState *VAR_0, V9fsWstatState *VAR_1, int VAR_2) { if (VAR_2 < 0) { goto out; } if (VAR_1->v9stat.name.size != 0) { v9fs_string_free(&VAR_1->nname); } if (VAR_1->v9stat.length != -1) { if (v9fs_do_truncate(VAR_0, &VAR_1->fidp->path, VAR_1->v9stat.length) < 0) { VAR_2 = -errno; } } v9fs_wstat_post_truncate(VAR_0, VAR_1, VAR_2); return; out: v9fs_stat_free(&VAR_1->v9stat); complete_pdu(VAR_0, VAR_1->pdu, VAR_2); qemu_free(VAR_1); }
[ "static void FUNC_0(V9fsState *VAR_0, V9fsWstatState *VAR_1, int VAR_2)\n{", "if (VAR_2 < 0) {", "goto out;", "}", "if (VAR_1->v9stat.name.size != 0) {", "v9fs_string_free(&VAR_1->nname);", "}", "if (VAR_1->v9stat.length != -1) {", "if (v9fs_do_truncate(VAR_0, &VAR_1->fidp->path, VAR_1->v9stat.length) < 0) {", "VAR_2 = -errno;", "}", "}", "v9fs_wstat_post_truncate(VAR_0, VAR_1, VAR_2);", "return;", "out:\nv9fs_stat_free(&VAR_1->v9stat);", "complete_pdu(VAR_0, VAR_1->pdu, VAR_2);", "qemu_free(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ] ]
22,473
static int pci_unin_internal_init_device(SysBusDevice *dev) { UNINState *s; int pci_mem_config, pci_mem_data; /* Uninorth internal bus */ s = FROM_SYSBUS(UNINState, dev); pci_mem_config = cpu_register_io_memory(pci_unin_config_read, pci_unin_config_write, s); pci_mem_data = cpu_register_io_memory(pci_unin_read, pci_unin_write, s); sysbus_init_mmio(dev, 0x1000, pci_mem_config); sysbus_init_mmio(dev, 0x1000, pci_mem_data); return 0; }
false
qemu
4f5e19e6c570459cd524b29b24374f03860f5149
static int pci_unin_internal_init_device(SysBusDevice *dev) { UNINState *s; int pci_mem_config, pci_mem_data; s = FROM_SYSBUS(UNINState, dev); pci_mem_config = cpu_register_io_memory(pci_unin_config_read, pci_unin_config_write, s); pci_mem_data = cpu_register_io_memory(pci_unin_read, pci_unin_write, s); sysbus_init_mmio(dev, 0x1000, pci_mem_config); sysbus_init_mmio(dev, 0x1000, pci_mem_data); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(SysBusDevice *VAR_0) { UNINState *s; int VAR_1, VAR_2; s = FROM_SYSBUS(UNINState, VAR_0); VAR_1 = cpu_register_io_memory(pci_unin_config_read, pci_unin_config_write, s); VAR_2 = cpu_register_io_memory(pci_unin_read, pci_unin_write, s); sysbus_init_mmio(VAR_0, 0x1000, VAR_1); sysbus_init_mmio(VAR_0, 0x1000, VAR_2); return 0; }
[ "static int FUNC_0(SysBusDevice *VAR_0)\n{", "UNINState *s;", "int VAR_1, VAR_2;", "s = FROM_SYSBUS(UNINState, VAR_0);", "VAR_1 = cpu_register_io_memory(pci_unin_config_read,\npci_unin_config_write, s);", "VAR_2 = cpu_register_io_memory(pci_unin_read,\npci_unin_write, s);", "sysbus_init_mmio(VAR_0, 0x1000, VAR_1);", "sysbus_init_mmio(VAR_0, 0x1000, VAR_2);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
22,474
e1000e_process_tx_desc(E1000ECore *core, struct e1000e_tx *tx, struct e1000_tx_desc *dp, int queue_index) { uint32_t txd_lower = le32_to_cpu(dp->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int split_size = txd_lower & 0xffff; uint64_t addr; struct e1000_context_desc *xp = (struct e1000_context_desc *)dp; bool eop = txd_lower & E1000_TXD_CMD_EOP; if (dtype == E1000_TXD_CMD_DEXT) { /* context descriptor */ e1000x_read_tx_ctx_descr(xp, &tx->props); e1000e_process_snap_option(core, le32_to_cpu(xp->cmd_and_length)); return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { /* data descriptor */ tx->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8; tx->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; e1000e_process_ts_option(core, dp); } else { /* legacy descriptor */ e1000e_process_ts_option(core, dp); tx->props.cptse = 0; } addr = le64_to_cpu(dp->buffer_addr); if (!tx->skip_cp) { if (!net_tx_pkt_add_raw_fragment(tx->tx_pkt, addr, split_size)) { tx->skip_cp = true; } } if (eop) { if (!tx->skip_cp && net_tx_pkt_parse(tx->tx_pkt)) { if (e1000x_vlan_enabled(core->mac) && e1000x_is_vlan_txd(txd_lower)) { net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, le16_to_cpu(dp->upper.fields.special), core->vet); } if (e1000e_tx_pkt_send(core, tx, queue_index)) { e1000e_on_tx_done_update_stats(core, tx->tx_pkt); } } tx->skip_cp = false; net_tx_pkt_reset(tx->tx_pkt); tx->props.sum_needed = 0; tx->props.cptse = 0; } }
false
qemu
7d08c73e7bdc39b10e5f2f5acdce700f17ffe962
e1000e_process_tx_desc(E1000ECore *core, struct e1000e_tx *tx, struct e1000_tx_desc *dp, int queue_index) { uint32_t txd_lower = le32_to_cpu(dp->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int split_size = txd_lower & 0xffff; uint64_t addr; struct e1000_context_desc *xp = (struct e1000_context_desc *)dp; bool eop = txd_lower & E1000_TXD_CMD_EOP; if (dtype == E1000_TXD_CMD_DEXT) { e1000x_read_tx_ctx_descr(xp, &tx->props); e1000e_process_snap_option(core, le32_to_cpu(xp->cmd_and_length)); return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { tx->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8; tx->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; e1000e_process_ts_option(core, dp); } else { e1000e_process_ts_option(core, dp); tx->props.cptse = 0; } addr = le64_to_cpu(dp->buffer_addr); if (!tx->skip_cp) { if (!net_tx_pkt_add_raw_fragment(tx->tx_pkt, addr, split_size)) { tx->skip_cp = true; } } if (eop) { if (!tx->skip_cp && net_tx_pkt_parse(tx->tx_pkt)) { if (e1000x_vlan_enabled(core->mac) && e1000x_is_vlan_txd(txd_lower)) { net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, le16_to_cpu(dp->upper.fields.special), core->vet); } if (e1000e_tx_pkt_send(core, tx, queue_index)) { e1000e_on_tx_done_update_stats(core, tx->tx_pkt); } } tx->skip_cp = false; net_tx_pkt_reset(tx->tx_pkt); tx->props.sum_needed = 0; tx->props.cptse = 0; } }
{ "code": [], "line_no": [] }
FUNC_0(E1000ECore *VAR_0, struct e1000e_tx *VAR_1, struct e1000_tx_desc *VAR_2, int VAR_3) { uint32_t txd_lower = le32_to_cpu(VAR_2->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int VAR_4 = txd_lower & 0xffff; uint64_t addr; struct e1000_context_desc *VAR_5 = (struct e1000_context_desc *)VAR_2; bool eop = txd_lower & E1000_TXD_CMD_EOP; if (dtype == E1000_TXD_CMD_DEXT) { e1000x_read_tx_ctx_descr(VAR_5, &VAR_1->props); e1000e_process_snap_option(VAR_0, le32_to_cpu(VAR_5->cmd_and_length)); return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { VAR_1->props.sum_needed = le32_to_cpu(VAR_2->upper.data) >> 8; VAR_1->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; e1000e_process_ts_option(VAR_0, VAR_2); } else { e1000e_process_ts_option(VAR_0, VAR_2); VAR_1->props.cptse = 0; } addr = le64_to_cpu(VAR_2->buffer_addr); if (!VAR_1->skip_cp) { if (!net_tx_pkt_add_raw_fragment(VAR_1->tx_pkt, addr, VAR_4)) { VAR_1->skip_cp = true; } } if (eop) { if (!VAR_1->skip_cp && net_tx_pkt_parse(VAR_1->tx_pkt)) { if (e1000x_vlan_enabled(VAR_0->mac) && e1000x_is_vlan_txd(txd_lower)) { net_tx_pkt_setup_vlan_header_ex(VAR_1->tx_pkt, le16_to_cpu(VAR_2->upper.fields.special), VAR_0->vet); } if (e1000e_tx_pkt_send(VAR_0, VAR_1, VAR_3)) { e1000e_on_tx_done_update_stats(VAR_0, VAR_1->tx_pkt); } } VAR_1->skip_cp = false; net_tx_pkt_reset(VAR_1->tx_pkt); VAR_1->props.sum_needed = 0; VAR_1->props.cptse = 0; } }
[ "FUNC_0(E1000ECore *VAR_0,\nstruct e1000e_tx *VAR_1,\nstruct e1000_tx_desc *VAR_2,\nint VAR_3)\n{", "uint32_t txd_lower = le32_to_cpu(VAR_2->lower.data);", "uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D);", "unsigned int VAR_4 = txd_lower & 0xffff;", "uint64_t addr;", "struct e1000_context_desc *VAR_5 = (struct e1000_context_desc *)VAR_2;", "bool eop = txd_lower & E1000_TXD_CMD_EOP;", "if (dtype == E1000_TXD_CMD_DEXT) {", "e1000x_read_tx_ctx_descr(VAR_5, &VAR_1->props);", "e1000e_process_snap_option(VAR_0, le32_to_cpu(VAR_5->cmd_and_length));", "return;", "} else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) {", "VAR_1->props.sum_needed = le32_to_cpu(VAR_2->upper.data) >> 8;", "VAR_1->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0;", "e1000e_process_ts_option(VAR_0, VAR_2);", "} else {", "e1000e_process_ts_option(VAR_0, VAR_2);", "VAR_1->props.cptse = 0;", "}", "addr = le64_to_cpu(VAR_2->buffer_addr);", "if (!VAR_1->skip_cp) {", "if (!net_tx_pkt_add_raw_fragment(VAR_1->tx_pkt, addr, VAR_4)) {", "VAR_1->skip_cp = true;", "}", "}", "if (eop) {", "if (!VAR_1->skip_cp && net_tx_pkt_parse(VAR_1->tx_pkt)) {", "if (e1000x_vlan_enabled(VAR_0->mac) &&\ne1000x_is_vlan_txd(txd_lower)) {", "net_tx_pkt_setup_vlan_header_ex(VAR_1->tx_pkt,\nle16_to_cpu(VAR_2->upper.fields.special), VAR_0->vet);", "}", "if (e1000e_tx_pkt_send(VAR_0, VAR_1, VAR_3)) {", "e1000e_on_tx_done_update_stats(VAR_0, VAR_1->tx_pkt);", "}", "}", "VAR_1->skip_cp = false;", "net_tx_pkt_reset(VAR_1->tx_pkt);", "VAR_1->props.sum_needed = 0;", "VAR_1->props.cptse = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ] ]
22,475
BlockAIOCB *ide_issue_trim( int64_t offset, QEMUIOVector *qiov, BlockCompletionFunc *cb, void *cb_opaque, void *opaque) { BlockBackend *blk = opaque; TrimAIOCB *iocb; iocb = blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque); iocb->blk = blk; iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb); iocb->ret = 0; iocb->qiov = qiov; iocb->i = -1; iocb->j = 0; ide_issue_trim_cb(iocb, 0); return &iocb->common; }
false
qemu
ef0e64a9838c0a20b5cb8a0bd2dcbcc59b0b812d
BlockAIOCB *ide_issue_trim( int64_t offset, QEMUIOVector *qiov, BlockCompletionFunc *cb, void *cb_opaque, void *opaque) { BlockBackend *blk = opaque; TrimAIOCB *iocb; iocb = blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque); iocb->blk = blk; iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb); iocb->ret = 0; iocb->qiov = qiov; iocb->i = -1; iocb->j = 0; ide_issue_trim_cb(iocb, 0); return &iocb->common; }
{ "code": [], "line_no": [] }
BlockAIOCB *FUNC_0( int64_t offset, QEMUIOVector *qiov, BlockCompletionFunc *cb, void *cb_opaque, void *opaque) { BlockBackend *blk = opaque; TrimAIOCB *iocb; iocb = blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque); iocb->blk = blk; iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb); iocb->ret = 0; iocb->qiov = qiov; iocb->i = -1; iocb->j = 0; ide_issue_trim_cb(iocb, 0); return &iocb->common; }
[ "BlockAIOCB *FUNC_0(\nint64_t offset, QEMUIOVector *qiov,\nBlockCompletionFunc *cb, void *cb_opaque, void *opaque)\n{", "BlockBackend *blk = opaque;", "TrimAIOCB *iocb;", "iocb = blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque);", "iocb->blk = blk;", "iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);", "iocb->ret = 0;", "iocb->qiov = qiov;", "iocb->i = -1;", "iocb->j = 0;", "ide_issue_trim_cb(iocb, 0);", "return &iocb->common;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
22,476
static int fw_cfg_boot_set(void *opaque, const char *boot_device) { fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); return 0; }
false
qemu
ddcd55316fb2851e144e719171621ad2816487dc
static int fw_cfg_boot_set(void *opaque, const char *boot_device) { fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, const char *VAR_1) { fw_cfg_add_i16(VAR_0, FW_CFG_BOOT_DEVICE, VAR_1[0]); return 0; }
[ "static int FUNC_0(void *VAR_0, const char *VAR_1)\n{", "fw_cfg_add_i16(VAR_0, FW_CFG_BOOT_DEVICE, VAR_1[0]);", "return 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
22,478
static bool next_query_bds(BlockBackend **blk, BlockDriverState **bs, bool query_nodes) { if (query_nodes) { *bs = bdrv_next_node(*bs); return !!*bs; } *blk = blk_next(*blk); *bs = *blk ? blk_bs(*blk) : NULL; return !!*blk; }
false
qemu
a6baa60807f88ba7d97b1787797fb58882ccbfb9
static bool next_query_bds(BlockBackend **blk, BlockDriverState **bs, bool query_nodes) { if (query_nodes) { *bs = bdrv_next_node(*bs); return !!*bs; } *blk = blk_next(*blk); *bs = *blk ? blk_bs(*blk) : NULL; return !!*blk; }
{ "code": [], "line_no": [] }
static bool FUNC_0(BlockBackend **blk, BlockDriverState **bs, bool query_nodes) { if (query_nodes) { *bs = bdrv_next_node(*bs); return !!*bs; } *blk = blk_next(*blk); *bs = *blk ? blk_bs(*blk) : NULL; return !!*blk; }
[ "static bool FUNC_0(BlockBackend **blk, BlockDriverState **bs,\nbool query_nodes)\n{", "if (query_nodes) {", "*bs = bdrv_next_node(*bs);", "return !!*bs;", "}", "*blk = blk_next(*blk);", "*bs = *blk ? blk_bs(*blk) : NULL;", "return !!*blk;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
22,480
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs) { unsigned int nRc = 0; // unsigned long flags; FPA11 *fpa11; // save_flags(flags); sti(); qemufpa=qfpa; user_registers=qregs; #if 0 fprintf(stderr,"emulating FP insn 0x%08x, PC=0x%08x\n", opcode, qregs[REG_PC]); #endif fpa11 = GET_FPA11(); if (fpa11->initflag == 0) /* good place for __builtin_expect */ { resetFPA11(); SetRoundingMode(ROUND_TO_NEAREST); SetRoundingPrecision(ROUND_EXTENDED); fpa11->initflag = 1; } set_float_exception_flags(0, &fpa11->fp_status); if (TEST_OPCODE(opcode,MASK_CPRT)) { //fprintf(stderr,"emulating CPRT\n"); /* Emulate conversion opcodes. */ /* Emulate register transfer opcodes. */ /* Emulate comparison opcodes. */ nRc = EmulateCPRT(opcode); } else if (TEST_OPCODE(opcode,MASK_CPDO)) { //fprintf(stderr,"emulating CPDO\n"); /* Emulate monadic arithmetic opcodes. */ /* Emulate dyadic arithmetic opcodes. */ nRc = EmulateCPDO(opcode); } else if (TEST_OPCODE(opcode,MASK_CPDT)) { //fprintf(stderr,"emulating CPDT\n"); /* Emulate load/store opcodes. */ /* Emulate load/store multiple opcodes. */ nRc = EmulateCPDT(opcode); } else { /* Invalid instruction detected. Return FALSE. */ nRc = 0; } // restore_flags(flags); if(nRc == 1 && get_float_exception_flags(&fpa11->fp_status)) { //printf("fef 0x%x\n",float_exception_flags); nRc -= get_float_exception_flags(&fpa11->fp_status); } //printf("returning %d\n",nRc); return(nRc); }
false
qemu
22e4104079a4a92a4800d516fc1d968a3e8b8157
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs) { unsigned int nRc = 0; FPA11 *fpa11; qemufpa=qfpa; user_registers=qregs; #if 0 fprintf(stderr,"emulating FP insn 0x%08x, PC=0x%08x\n", opcode, qregs[REG_PC]); #endif fpa11 = GET_FPA11(); if (fpa11->initflag == 0) { resetFPA11(); SetRoundingMode(ROUND_TO_NEAREST); SetRoundingPrecision(ROUND_EXTENDED); fpa11->initflag = 1; } set_float_exception_flags(0, &fpa11->fp_status); if (TEST_OPCODE(opcode,MASK_CPRT)) { nRc = EmulateCPRT(opcode); } else if (TEST_OPCODE(opcode,MASK_CPDO)) { nRc = EmulateCPDO(opcode); } else if (TEST_OPCODE(opcode,MASK_CPDT)) { nRc = EmulateCPDT(opcode); } else { nRc = 0; } if(nRc == 1 && get_float_exception_flags(&fpa11->fp_status)) { nRc -= get_float_exception_flags(&fpa11->fp_status); } return(nRc); }
{ "code": [], "line_no": [] }
unsigned int FUNC_0(unsigned int VAR_0, FPA11* VAR_1, CPUARMState* VAR_2) { unsigned int VAR_3 = 0; FPA11 *fpa11; qemufpa=VAR_1; user_registers=VAR_2; #if 0 fprintf(stderr,"emulating FP insn 0x%08x, PC=0x%08x\n", VAR_0, VAR_2[REG_PC]); #endif fpa11 = GET_FPA11(); if (fpa11->initflag == 0) { resetFPA11(); SetRoundingMode(ROUND_TO_NEAREST); SetRoundingPrecision(ROUND_EXTENDED); fpa11->initflag = 1; } set_float_exception_flags(0, &fpa11->fp_status); if (TEST_OPCODE(VAR_0,MASK_CPRT)) { VAR_3 = EmulateCPRT(VAR_0); } else if (TEST_OPCODE(VAR_0,MASK_CPDO)) { VAR_3 = EmulateCPDO(VAR_0); } else if (TEST_OPCODE(VAR_0,MASK_CPDT)) { VAR_3 = EmulateCPDT(VAR_0); } else { VAR_3 = 0; } if(VAR_3 == 1 && get_float_exception_flags(&fpa11->fp_status)) { VAR_3 -= get_float_exception_flags(&fpa11->fp_status); } return(VAR_3); }
[ "unsigned int FUNC_0(unsigned int VAR_0, FPA11* VAR_1, CPUARMState* VAR_2)\n{", "unsigned int VAR_3 = 0;", "FPA11 *fpa11;", "qemufpa=VAR_1;", "user_registers=VAR_2;", "#if 0\nfprintf(stderr,\"emulating FP insn 0x%08x, PC=0x%08x\\n\",\nVAR_0, VAR_2[REG_PC]);", "#endif\nfpa11 = GET_FPA11();", "if (fpa11->initflag == 0)\n{", "resetFPA11();", "SetRoundingMode(ROUND_TO_NEAREST);", "SetRoundingPrecision(ROUND_EXTENDED);", "fpa11->initflag = 1;", "}", "set_float_exception_flags(0, &fpa11->fp_status);", "if (TEST_OPCODE(VAR_0,MASK_CPRT))\n{", "VAR_3 = EmulateCPRT(VAR_0);", "}", "else if (TEST_OPCODE(VAR_0,MASK_CPDO))\n{", "VAR_3 = EmulateCPDO(VAR_0);", "}", "else if (TEST_OPCODE(VAR_0,MASK_CPDT))\n{", "VAR_3 = EmulateCPDT(VAR_0);", "}", "else\n{", "VAR_3 = 0;", "}", "if(VAR_3 == 1 && get_float_exception_flags(&fpa11->fp_status))\n{", "VAR_3 -= get_float_exception_flags(&fpa11->fp_status);", "}", "return(VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 15 ], [ 17 ], [ 21, 23, 25 ], [ 27, 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53, 55 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 103 ], [ 105 ], [ 111, 113 ], [ 117 ], [ 119 ], [ 125 ], [ 127 ] ]
22,481
static gboolean io_watch_poll_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { return g_io_watch_funcs.dispatch(source, callback, user_data); }
false
qemu
d185c094b404b4ff392b77d1244c0233da7d53bd
static gboolean io_watch_poll_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { return g_io_watch_funcs.dispatch(source, callback, user_data); }
{ "code": [], "line_no": [] }
static gboolean FUNC_0(GSource *source, GSourceFunc callback, gpointer user_data) { return g_io_watch_funcs.dispatch(source, callback, user_data); }
[ "static gboolean FUNC_0(GSource *source, GSourceFunc callback,\ngpointer user_data)\n{", "return g_io_watch_funcs.dispatch(source, callback, user_data);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
22,484
static void iostatus_bdrv_it(void *opaque, BlockDriverState *bs) { bdrv_iostatus_reset(bs); }
false
qemu
ab31979a7e835832605f8425d0eaa5c74d1e6375
static void iostatus_bdrv_it(void *opaque, BlockDriverState *bs) { bdrv_iostatus_reset(bs); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, BlockDriverState *VAR_1) { bdrv_iostatus_reset(VAR_1); }
[ "static void FUNC_0(void *VAR_0, BlockDriverState *VAR_1)\n{", "bdrv_iostatus_reset(VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
22,485
void op_flush_icache_range(void) { CALL_FROM_TB2(tlb_flush_page, env, T0 + T1); RETURN(); }
false
qemu
df1561e22df42643d769aacdcc7d6d239f243366
void op_flush_icache_range(void) { CALL_FROM_TB2(tlb_flush_page, env, T0 + T1); RETURN(); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { CALL_FROM_TB2(tlb_flush_page, env, T0 + T1); RETURN(); }
[ "void FUNC_0(void) {", "CALL_FROM_TB2(tlb_flush_page, env, T0 + T1);", "RETURN();", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ] ]
22,486
static uint64_t lan9118_readl(void *opaque, hwaddr offset, unsigned size) { lan9118_state *s = (lan9118_state *)opaque; //DPRINTF("Read reg 0x%02x\n", (int)offset); if (offset < 0x20) { /* RX FIFO */ return rx_fifo_pop(s); } switch (offset) { case 0x40: return rx_status_fifo_pop(s); case 0x44: return s->rx_status_fifo[s->tx_status_fifo_head]; case 0x48: return tx_status_fifo_pop(s); case 0x4c: return s->tx_status_fifo[s->tx_status_fifo_head]; case CSR_ID_REV: return 0x01180001; case CSR_IRQ_CFG: return s->irq_cfg; case CSR_INT_STS: return s->int_sts; case CSR_INT_EN: return s->int_en; case CSR_BYTE_TEST: return 0x87654321; case CSR_FIFO_INT: return s->fifo_int; case CSR_RX_CFG: return s->rx_cfg; case CSR_TX_CFG: return s->tx_cfg; case CSR_HW_CFG: return s->hw_cfg; case CSR_RX_DP_CTRL: return 0; case CSR_RX_FIFO_INF: return (s->rx_status_fifo_used << 16) | (s->rx_fifo_used << 2); case CSR_TX_FIFO_INF: return (s->tx_status_fifo_used << 16) | (s->tx_fifo_size - s->txp->fifo_used); case CSR_PMT_CTRL: return s->pmt_ctrl; case CSR_GPIO_CFG: return s->gpio_cfg; case CSR_GPT_CFG: return s->gpt_cfg; case CSR_GPT_CNT: return ptimer_get_count(s->timer); case CSR_WORD_SWAP: return s->word_swap; case CSR_FREE_RUN: return (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / 40) - s->free_timer_start; case CSR_RX_DROP: /* TODO: Implement dropped frames counter. */ return 0; case CSR_MAC_CSR_CMD: return s->mac_cmd; case CSR_MAC_CSR_DATA: return s->mac_data; case CSR_AFC_CFG: return s->afc_cfg; case CSR_E2P_CMD: return s->e2p_cmd; case CSR_E2P_DATA: return s->e2p_data; } hw_error("lan9118_read: Bad reg 0x%x\n", (int)offset); return 0; }
false
qemu
52b4bb7383b32e4e7512f98c57738c8fc9cb35ba
static uint64_t lan9118_readl(void *opaque, hwaddr offset, unsigned size) { lan9118_state *s = (lan9118_state *)opaque; if (offset < 0x20) { return rx_fifo_pop(s); } switch (offset) { case 0x40: return rx_status_fifo_pop(s); case 0x44: return s->rx_status_fifo[s->tx_status_fifo_head]; case 0x48: return tx_status_fifo_pop(s); case 0x4c: return s->tx_status_fifo[s->tx_status_fifo_head]; case CSR_ID_REV: return 0x01180001; case CSR_IRQ_CFG: return s->irq_cfg; case CSR_INT_STS: return s->int_sts; case CSR_INT_EN: return s->int_en; case CSR_BYTE_TEST: return 0x87654321; case CSR_FIFO_INT: return s->fifo_int; case CSR_RX_CFG: return s->rx_cfg; case CSR_TX_CFG: return s->tx_cfg; case CSR_HW_CFG: return s->hw_cfg; case CSR_RX_DP_CTRL: return 0; case CSR_RX_FIFO_INF: return (s->rx_status_fifo_used << 16) | (s->rx_fifo_used << 2); case CSR_TX_FIFO_INF: return (s->tx_status_fifo_used << 16) | (s->tx_fifo_size - s->txp->fifo_used); case CSR_PMT_CTRL: return s->pmt_ctrl; case CSR_GPIO_CFG: return s->gpio_cfg; case CSR_GPT_CFG: return s->gpt_cfg; case CSR_GPT_CNT: return ptimer_get_count(s->timer); case CSR_WORD_SWAP: return s->word_swap; case CSR_FREE_RUN: return (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / 40) - s->free_timer_start; case CSR_RX_DROP: return 0; case CSR_MAC_CSR_CMD: return s->mac_cmd; case CSR_MAC_CSR_DATA: return s->mac_data; case CSR_AFC_CFG: return s->afc_cfg; case CSR_E2P_CMD: return s->e2p_cmd; case CSR_E2P_DATA: return s->e2p_data; } hw_error("lan9118_read: Bad reg 0x%x\n", (int)offset); return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, hwaddr offset, unsigned size) { lan9118_state *s = (lan9118_state *)opaque; if (offset < 0x20) { return rx_fifo_pop(s); } switch (offset) { case 0x40: return rx_status_fifo_pop(s); case 0x44: return s->rx_status_fifo[s->tx_status_fifo_head]; case 0x48: return tx_status_fifo_pop(s); case 0x4c: return s->tx_status_fifo[s->tx_status_fifo_head]; case CSR_ID_REV: return 0x01180001; case CSR_IRQ_CFG: return s->irq_cfg; case CSR_INT_STS: return s->int_sts; case CSR_INT_EN: return s->int_en; case CSR_BYTE_TEST: return 0x87654321; case CSR_FIFO_INT: return s->fifo_int; case CSR_RX_CFG: return s->rx_cfg; case CSR_TX_CFG: return s->tx_cfg; case CSR_HW_CFG: return s->hw_cfg; case CSR_RX_DP_CTRL: return 0; case CSR_RX_FIFO_INF: return (s->rx_status_fifo_used << 16) | (s->rx_fifo_used << 2); case CSR_TX_FIFO_INF: return (s->tx_status_fifo_used << 16) | (s->tx_fifo_size - s->txp->fifo_used); case CSR_PMT_CTRL: return s->pmt_ctrl; case CSR_GPIO_CFG: return s->gpio_cfg; case CSR_GPT_CFG: return s->gpt_cfg; case CSR_GPT_CNT: return ptimer_get_count(s->timer); case CSR_WORD_SWAP: return s->word_swap; case CSR_FREE_RUN: return (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / 40) - s->free_timer_start; case CSR_RX_DROP: return 0; case CSR_MAC_CSR_CMD: return s->mac_cmd; case CSR_MAC_CSR_DATA: return s->mac_data; case CSR_AFC_CFG: return s->afc_cfg; case CSR_E2P_CMD: return s->e2p_cmd; case CSR_E2P_DATA: return s->e2p_data; } hw_error("lan9118_read: Bad reg 0x%x\n", (int)offset); return 0; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr offset,\nunsigned size)\n{", "lan9118_state *s = (lan9118_state *)opaque;", "if (offset < 0x20) {", "return rx_fifo_pop(s);", "}", "switch (offset) {", "case 0x40:\nreturn rx_status_fifo_pop(s);", "case 0x44:\nreturn s->rx_status_fifo[s->tx_status_fifo_head];", "case 0x48:\nreturn tx_status_fifo_pop(s);", "case 0x4c:\nreturn s->tx_status_fifo[s->tx_status_fifo_head];", "case CSR_ID_REV:\nreturn 0x01180001;", "case CSR_IRQ_CFG:\nreturn s->irq_cfg;", "case CSR_INT_STS:\nreturn s->int_sts;", "case CSR_INT_EN:\nreturn s->int_en;", "case CSR_BYTE_TEST:\nreturn 0x87654321;", "case CSR_FIFO_INT:\nreturn s->fifo_int;", "case CSR_RX_CFG:\nreturn s->rx_cfg;", "case CSR_TX_CFG:\nreturn s->tx_cfg;", "case CSR_HW_CFG:\nreturn s->hw_cfg;", "case CSR_RX_DP_CTRL:\nreturn 0;", "case CSR_RX_FIFO_INF:\nreturn (s->rx_status_fifo_used << 16) | (s->rx_fifo_used << 2);", "case CSR_TX_FIFO_INF:\nreturn (s->tx_status_fifo_used << 16)\n| (s->tx_fifo_size - s->txp->fifo_used);", "case CSR_PMT_CTRL:\nreturn s->pmt_ctrl;", "case CSR_GPIO_CFG:\nreturn s->gpio_cfg;", "case CSR_GPT_CFG:\nreturn s->gpt_cfg;", "case CSR_GPT_CNT:\nreturn ptimer_get_count(s->timer);", "case CSR_WORD_SWAP:\nreturn s->word_swap;", "case CSR_FREE_RUN:\nreturn (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / 40) - s->free_timer_start;", "case CSR_RX_DROP:\nreturn 0;", "case CSR_MAC_CSR_CMD:\nreturn s->mac_cmd;", "case CSR_MAC_CSR_DATA:\nreturn s->mac_data;", "case CSR_AFC_CFG:\nreturn s->afc_cfg;", "case CSR_E2P_CMD:\nreturn s->e2p_cmd;", "case CSR_E2P_DATA:\nreturn s->e2p_data;", "}", "hw_error(\"lan9118_read: Bad reg 0x%x\\n\", (int)offset);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 71, 73 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85, 87 ], [ 89, 91 ], [ 93, 95 ], [ 97, 99 ], [ 101, 103 ], [ 105, 107 ], [ 109, 111 ], [ 113, 117 ], [ 119, 121 ], [ 123, 125 ], [ 127, 129 ], [ 131, 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ] ]
22,487
static void do_attach(USBDevice *dev) { USBBus *bus = usb_bus_from_device(dev); USBPort *port; if (dev->attached) { fprintf(stderr, "Warning: tried to attach usb device %s twice\n", dev->devname); return; } dev->attached++; port = TAILQ_FIRST(&bus->free); TAILQ_REMOVE(&bus->free, port, next); bus->nfree--; usb_attach(port, dev); TAILQ_INSERT_TAIL(&bus->used, port, next); bus->nused++; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static void do_attach(USBDevice *dev) { USBBus *bus = usb_bus_from_device(dev); USBPort *port; if (dev->attached) { fprintf(stderr, "Warning: tried to attach usb device %s twice\n", dev->devname); return; } dev->attached++; port = TAILQ_FIRST(&bus->free); TAILQ_REMOVE(&bus->free, port, next); bus->nfree--; usb_attach(port, dev); TAILQ_INSERT_TAIL(&bus->used, port, next); bus->nused++; }
{ "code": [], "line_no": [] }
static void FUNC_0(USBDevice *VAR_0) { USBBus *bus = usb_bus_from_device(VAR_0); USBPort *port; if (VAR_0->attached) { fprintf(stderr, "Warning: tried to attach usb device %s twice\n", VAR_0->devname); return; } VAR_0->attached++; port = TAILQ_FIRST(&bus->free); TAILQ_REMOVE(&bus->free, port, next); bus->nfree--; usb_attach(port, VAR_0); TAILQ_INSERT_TAIL(&bus->used, port, next); bus->nused++; }
[ "static void FUNC_0(USBDevice *VAR_0)\n{", "USBBus *bus = usb_bus_from_device(VAR_0);", "USBPort *port;", "if (VAR_0->attached) {", "fprintf(stderr, \"Warning: tried to attach usb device %s twice\\n\",\nVAR_0->devname);", "return;", "}", "VAR_0->attached++;", "port = TAILQ_FIRST(&bus->free);", "TAILQ_REMOVE(&bus->free, port, next);", "bus->nfree--;", "usb_attach(port, VAR_0);", "TAILQ_INSERT_TAIL(&bus->used, port, next);", "bus->nused++;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ] ]
22,488
static void add_to_pool(BufferPoolEntry *buf) { AVBufferPool *pool; BufferPoolEntry *cur, *end = buf; if (!buf) return; pool = buf->pool; while (end->next) end = end->next; while ((cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, buf))) { /* pool is not empty, retrieve it and append it to our list */ cur = get_pool(pool); end->next = cur; while (end->next) end = end->next; } }
true
FFmpeg
fbd6c97f9ca858140df16dd07200ea0d4bdc1a83
static void add_to_pool(BufferPoolEntry *buf) { AVBufferPool *pool; BufferPoolEntry *cur, *end = buf; if (!buf) return; pool = buf->pool; while (end->next) end = end->next; while ((cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, buf))) { cur = get_pool(pool); end->next = cur; while (end->next) end = end->next; } }
{ "code": [ "static void add_to_pool(BufferPoolEntry *buf)", " AVBufferPool *pool;", " BufferPoolEntry *cur, *end = buf;", " if (!buf)", " pool = buf->pool;", " while (end->next)", " end = end->next;", " while ((cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, buf))) {", " cur = get_pool(pool);", " end->next = cur;", " while (end->next)", " end = end->next;", " if (!buf)" ], "line_no": [ 1, 5, 7, 11, 15, 19, 21, 25, 29, 31, 33, 35, 11 ] }
static void FUNC_0(BufferPoolEntry *VAR_0) { AVBufferPool *pool; BufferPoolEntry *cur, *end = VAR_0; if (!VAR_0) return; pool = VAR_0->pool; while (end->next) end = end->next; while ((cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, VAR_0))) { cur = get_pool(pool); end->next = cur; while (end->next) end = end->next; } }
[ "static void FUNC_0(BufferPoolEntry *VAR_0)\n{", "AVBufferPool *pool;", "BufferPoolEntry *cur, *end = VAR_0;", "if (!VAR_0)\nreturn;", "pool = VAR_0->pool;", "while (end->next)\nend = end->next;", "while ((cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, VAR_0))) {", "cur = get_pool(pool);", "end->next = cur;", "while (end->next)\nend = end->next;", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ] ]
22,489
static int tcp_get_msgfds(CharDriverState *chr, int *fds, int num) { TCPCharDriver *s = chr->opaque; int to_copy = (s->read_msgfds_num < num) ? s->read_msgfds_num : num; if (to_copy) { memcpy(fds, s->read_msgfds, to_copy * sizeof(int)); g_free(s->read_msgfds); s->read_msgfds = 0; s->read_msgfds_num = 0; return to_copy;
true
qemu
d2fc39b4208709db95b6825c0e1b00ce6fbf0ecc
static int tcp_get_msgfds(CharDriverState *chr, int *fds, int num) { TCPCharDriver *s = chr->opaque; int to_copy = (s->read_msgfds_num < num) ? s->read_msgfds_num : num; if (to_copy) { memcpy(fds, s->read_msgfds, to_copy * sizeof(int)); g_free(s->read_msgfds); s->read_msgfds = 0; s->read_msgfds_num = 0; return to_copy;
{ "code": [], "line_no": [] }
static int FUNC_0(CharDriverState *VAR_0, int *VAR_1, int VAR_2) { TCPCharDriver *s = VAR_0->opaque; int VAR_3 = (s->read_msgfds_num < VAR_2) ? s->read_msgfds_num : VAR_2; if (VAR_3) { memcpy(VAR_1, s->read_msgfds, VAR_3 * sizeof(int)); g_free(s->read_msgfds); s->read_msgfds = 0; s->read_msgfds_num = 0; return VAR_3;
[ "static int FUNC_0(CharDriverState *VAR_0, int *VAR_1, int VAR_2)\n{", "TCPCharDriver *s = VAR_0->opaque;", "int VAR_3 = (s->read_msgfds_num < VAR_2) ? s->read_msgfds_num : VAR_2;", "if (VAR_3) {", "memcpy(VAR_1, s->read_msgfds, VAR_3 * sizeof(int));", "g_free(s->read_msgfds);", "s->read_msgfds = 0;", "s->read_msgfds_num = 0;", "return VAR_3;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ] ]
22,490
void *qht_do_lookup(struct qht_bucket *head, qht_lookup_func_t func, const void *userp, uint32_t hash) { struct qht_bucket *b = head; int i; do { for (i = 0; i < QHT_BUCKET_ENTRIES; i++) { if (b->hashes[i] == hash) { /* The pointer is dereferenced before seqlock_read_retry, * so (unlike qht_insert__locked) we need to use * atomic_rcu_read here. */ void *p = atomic_rcu_read(&b->pointers[i]); if (likely(p) && likely(func(p, userp))) { return p; } } } b = atomic_rcu_read(&b->next); } while (b); return NULL; }
true
qemu
a890643958f03aaa344290700093b280cb606c28
void *qht_do_lookup(struct qht_bucket *head, qht_lookup_func_t func, const void *userp, uint32_t hash) { struct qht_bucket *b = head; int i; do { for (i = 0; i < QHT_BUCKET_ENTRIES; i++) { if (b->hashes[i] == hash) { void *p = atomic_rcu_read(&b->pointers[i]); if (likely(p) && likely(func(p, userp))) { return p; } } } b = atomic_rcu_read(&b->next); } while (b); return NULL; }
{ "code": [ " if (b->hashes[i] == hash) {" ], "line_no": [ 17 ] }
void *FUNC_0(struct qht_bucket *VAR_0, qht_lookup_func_t VAR_1, const void *VAR_2, uint32_t VAR_3) { struct qht_bucket *VAR_4 = VAR_0; int VAR_5; do { for (VAR_5 = 0; VAR_5 < QHT_BUCKET_ENTRIES; VAR_5++) { if (VAR_4->hashes[VAR_5] == VAR_3) { void *p = atomic_rcu_read(&VAR_4->pointers[VAR_5]); if (likely(p) && likely(VAR_1(p, VAR_2))) { return p; } } } VAR_4 = atomic_rcu_read(&VAR_4->next); } while (VAR_4); return NULL; }
[ "void *FUNC_0(struct qht_bucket *VAR_0, qht_lookup_func_t VAR_1,\nconst void *VAR_2, uint32_t VAR_3)\n{", "struct qht_bucket *VAR_4 = VAR_0;", "int VAR_5;", "do {", "for (VAR_5 = 0; VAR_5 < QHT_BUCKET_ENTRIES; VAR_5++) {", "if (VAR_4->hashes[VAR_5] == VAR_3) {", "void *p = atomic_rcu_read(&VAR_4->pointers[VAR_5]);", "if (likely(p) && likely(VAR_1(p, VAR_2))) {", "return p;", "}", "}", "}", "VAR_4 = atomic_rcu_read(&VAR_4->next);", "} while (VAR_4);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
22,491
static void test_io_channel_command_fifo(bool async) { #define TEST_FIFO "tests/test-io-channel-command.fifo" QIOChannel *src, *dst; QIOChannelTest *test; char *srcfifo = g_strdup_printf("PIPE:%s,wronly", TEST_FIFO); char *dstfifo = g_strdup_printf("PIPE:%s,rdonly", TEST_FIFO); const char *srcargv[] = { "/bin/socat", "-", srcfifo, NULL, }; const char *dstargv[] = { "/bin/socat", dstfifo, "-", NULL, }; unlink(TEST_FIFO); if (access("/bin/socat", X_OK) < 0) { return; /* Pretend success if socat is not present */ } if (mkfifo(TEST_FIFO, 0600) < 0) { abort(); } src = QIO_CHANNEL(qio_channel_command_new_spawn(srcargv, O_WRONLY, &error_abort)); dst = QIO_CHANNEL(qio_channel_command_new_spawn(dstargv, O_RDONLY, &error_abort)); test = qio_channel_test_new(); qio_channel_test_run_threads(test, async, src, dst); qio_channel_test_validate(test); object_unref(OBJECT(src)); object_unref(OBJECT(dst)); g_free(srcfifo); g_free(dstfifo); unlink(TEST_FIFO); }
true
qemu
14324f585d76abd8a609c119d627503e6a0961be
static void test_io_channel_command_fifo(bool async) { #define TEST_FIFO "tests/test-io-channel-command.fifo" QIOChannel *src, *dst; QIOChannelTest *test; char *srcfifo = g_strdup_printf("PIPE:%s,wronly", TEST_FIFO); char *dstfifo = g_strdup_printf("PIPE:%s,rdonly", TEST_FIFO); const char *srcargv[] = { "/bin/socat", "-", srcfifo, NULL, }; const char *dstargv[] = { "/bin/socat", dstfifo, "-", NULL, }; unlink(TEST_FIFO); if (access("/bin/socat", X_OK) < 0) { return; } if (mkfifo(TEST_FIFO, 0600) < 0) { abort(); } src = QIO_CHANNEL(qio_channel_command_new_spawn(srcargv, O_WRONLY, &error_abort)); dst = QIO_CHANNEL(qio_channel_command_new_spawn(dstargv, O_RDONLY, &error_abort)); test = qio_channel_test_new(); qio_channel_test_run_threads(test, async, src, dst); qio_channel_test_validate(test); object_unref(OBJECT(src)); object_unref(OBJECT(dst)); g_free(srcfifo); g_free(dstfifo); unlink(TEST_FIFO); }
{ "code": [ " char *srcfifo = g_strdup_printf(\"PIPE:%s,wronly\", TEST_FIFO);", " char *dstfifo = g_strdup_printf(\"PIPE:%s,rdonly\", TEST_FIFO);", " g_free(srcfifo);", " g_free(dstfifo);" ], "line_no": [ 11, 13, 71, 73 ] }
static void FUNC_0(bool VAR_0) { #define TEST_FIFO "tests/test-io-channel-command.fifo" QIOChannel *src, *dst; QIOChannelTest *test; char *VAR_1 = g_strdup_printf("PIPE:%s,wronly", TEST_FIFO); char *VAR_2 = g_strdup_printf("PIPE:%s,rdonly", TEST_FIFO); const char *VAR_3[] = { "/bin/socat", "-", VAR_1, NULL, }; const char *VAR_4[] = { "/bin/socat", VAR_2, "-", NULL, }; unlink(TEST_FIFO); if (access("/bin/socat", X_OK) < 0) { return; } if (mkfifo(TEST_FIFO, 0600) < 0) { abort(); } src = QIO_CHANNEL(qio_channel_command_new_spawn(VAR_3, O_WRONLY, &error_abort)); dst = QIO_CHANNEL(qio_channel_command_new_spawn(VAR_4, O_RDONLY, &error_abort)); test = qio_channel_test_new(); qio_channel_test_run_threads(test, VAR_0, src, dst); qio_channel_test_validate(test); object_unref(OBJECT(src)); object_unref(OBJECT(dst)); g_free(VAR_1); g_free(VAR_2); unlink(TEST_FIFO); }
[ "static void FUNC_0(bool VAR_0)\n{", "#define TEST_FIFO \"tests/test-io-channel-command.fifo\"\nQIOChannel *src, *dst;", "QIOChannelTest *test;", "char *VAR_1 = g_strdup_printf(\"PIPE:%s,wronly\", TEST_FIFO);", "char *VAR_2 = g_strdup_printf(\"PIPE:%s,rdonly\", TEST_FIFO);", "const char *VAR_3[] = {", "\"/bin/socat\", \"-\", VAR_1, NULL,\n};", "const char *VAR_4[] = {", "\"/bin/socat\", VAR_2, \"-\", NULL,\n};", "unlink(TEST_FIFO);", "if (access(\"/bin/socat\", X_OK) < 0) {", "return;", "}", "if (mkfifo(TEST_FIFO, 0600) < 0) {", "abort();", "}", "src = QIO_CHANNEL(qio_channel_command_new_spawn(VAR_3,\nO_WRONLY,\n&error_abort));", "dst = QIO_CHANNEL(qio_channel_command_new_spawn(VAR_4,\nO_RDONLY,\n&error_abort));", "test = qio_channel_test_new();", "qio_channel_test_run_threads(test, VAR_0, src, dst);", "qio_channel_test_validate(test);", "object_unref(OBJECT(src));", "object_unref(OBJECT(dst));", "g_free(VAR_1);", "g_free(VAR_2);", "unlink(TEST_FIFO);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49, 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
22,492
static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; int nb_sectors, sectors_per_chunk, nb_chunks; int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector; uint64_t delay_ns = 0; MirrorOp *op; s->sector_num = hbitmap_iter_next(&s->hbi); if (s->sector_num < 0) { bdrv_dirty_iter_init(source, s->dirty_bitmap, &s->hbi); s->sector_num = hbitmap_iter_next(&s->hbi); trace_mirror_restart_iter(s, bdrv_get_dirty_count(source, s->dirty_bitmap)); assert(s->sector_num >= 0); } hbitmap_next_sector = s->sector_num; sector_num = s->sector_num; sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS; end = s->bdev_length / BDRV_SECTOR_SIZE; /* Extend the QEMUIOVector to include all adjacent blocks that will * be copied in this operation. * * We have to do this if we have no backing file yet in the destination, * and the cluster size is very large. Then we need to do COW ourselves. * The first time a cluster is copied, copy it entirely. Note that, * because both the granularity and the cluster size are powers of two, * the number of sectors to copy cannot exceed one cluster. * * We also want to extend the QEMUIOVector to include more adjacent * dirty blocks if possible, to limit the number of I/O operations and * run efficiently even with a small granularity. */ nb_chunks = 0; nb_sectors = 0; next_sector = sector_num; next_chunk = sector_num / sectors_per_chunk; /* Wait for I/O to this cluster (from a previous iteration) to be done. */ while (test_bit(next_chunk, s->in_flight_bitmap)) { trace_mirror_yield_in_flight(s, sector_num, s->in_flight); qemu_coroutine_yield(); } do { int added_sectors, added_chunks; if (!bdrv_get_dirty(source, s->dirty_bitmap, next_sector) || test_bit(next_chunk, s->in_flight_bitmap)) { assert(nb_sectors > 0); break; } added_sectors = sectors_per_chunk; if (s->cow_bitmap && !test_bit(next_chunk, s->cow_bitmap)) { bdrv_round_to_clusters(s->target, next_sector, added_sectors, &next_sector, &added_sectors); /* On the first iteration, the rounding may make us copy * sectors before the first dirty one. */ if (next_sector < sector_num) { assert(nb_sectors == 0); sector_num = next_sector; next_chunk = next_sector / sectors_per_chunk; } } added_sectors = MIN(added_sectors, end - (sector_num + nb_sectors)); added_chunks = (added_sectors + sectors_per_chunk - 1) / sectors_per_chunk; /* When doing COW, it may happen that there is not enough space for * a full cluster. Wait if that is the case. */ while (nb_chunks == 0 && s->buf_free_count < added_chunks) { trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight); qemu_coroutine_yield(); } if (s->buf_free_count < nb_chunks + added_chunks) { trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight); break; } /* We have enough free space to copy these sectors. */ bitmap_set(s->in_flight_bitmap, next_chunk, added_chunks); nb_sectors += added_sectors; nb_chunks += added_chunks; next_sector += added_sectors; next_chunk += added_chunks; if (!s->synced && s->common.speed) { delay_ns = ratelimit_calculate_delay(&s->limit, added_sectors); } } while (delay_ns == 0 && next_sector < end); /* Allocate a MirrorOp that is used as an AIO callback. */ op = g_slice_new(MirrorOp); op->s = s; op->sector_num = sector_num; op->nb_sectors = nb_sectors; /* Now make a QEMUIOVector taking enough granularity-sized chunks * from s->buf_free. */ qemu_iovec_init(&op->qiov, nb_chunks); next_sector = sector_num; while (nb_chunks-- > 0) { MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free); size_t remaining = (nb_sectors * BDRV_SECTOR_SIZE) - op->qiov.size; QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next); s->buf_free_count--; qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining)); /* Advance the HBitmapIter in parallel, so that we do not examine * the same sector twice. */ if (next_sector > hbitmap_next_sector && bdrv_get_dirty(source, s->dirty_bitmap, next_sector)) { hbitmap_next_sector = hbitmap_iter_next(&s->hbi); } next_sector += sectors_per_chunk; } bdrv_reset_dirty(source, sector_num, nb_sectors); /* Copy the dirty cluster. */ s->in_flight++; s->sectors_in_flight += nb_sectors; trace_mirror_one_iteration(s, sector_num, nb_sectors); bdrv_aio_readv(source, sector_num, &op->qiov, nb_sectors, mirror_read_complete, op); return delay_ns; }
true
qemu
c4237dfa635900e4d1cdc6038d5efe3507f45f0c
static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; int nb_sectors, sectors_per_chunk, nb_chunks; int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector; uint64_t delay_ns = 0; MirrorOp *op; s->sector_num = hbitmap_iter_next(&s->hbi); if (s->sector_num < 0) { bdrv_dirty_iter_init(source, s->dirty_bitmap, &s->hbi); s->sector_num = hbitmap_iter_next(&s->hbi); trace_mirror_restart_iter(s, bdrv_get_dirty_count(source, s->dirty_bitmap)); assert(s->sector_num >= 0); } hbitmap_next_sector = s->sector_num; sector_num = s->sector_num; sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS; end = s->bdev_length / BDRV_SECTOR_SIZE; nb_chunks = 0; nb_sectors = 0; next_sector = sector_num; next_chunk = sector_num / sectors_per_chunk; while (test_bit(next_chunk, s->in_flight_bitmap)) { trace_mirror_yield_in_flight(s, sector_num, s->in_flight); qemu_coroutine_yield(); } do { int added_sectors, added_chunks; if (!bdrv_get_dirty(source, s->dirty_bitmap, next_sector) || test_bit(next_chunk, s->in_flight_bitmap)) { assert(nb_sectors > 0); break; } added_sectors = sectors_per_chunk; if (s->cow_bitmap && !test_bit(next_chunk, s->cow_bitmap)) { bdrv_round_to_clusters(s->target, next_sector, added_sectors, &next_sector, &added_sectors); if (next_sector < sector_num) { assert(nb_sectors == 0); sector_num = next_sector; next_chunk = next_sector / sectors_per_chunk; } } added_sectors = MIN(added_sectors, end - (sector_num + nb_sectors)); added_chunks = (added_sectors + sectors_per_chunk - 1) / sectors_per_chunk; while (nb_chunks == 0 && s->buf_free_count < added_chunks) { trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight); qemu_coroutine_yield(); } if (s->buf_free_count < nb_chunks + added_chunks) { trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight); break; } bitmap_set(s->in_flight_bitmap, next_chunk, added_chunks); nb_sectors += added_sectors; nb_chunks += added_chunks; next_sector += added_sectors; next_chunk += added_chunks; if (!s->synced && s->common.speed) { delay_ns = ratelimit_calculate_delay(&s->limit, added_sectors); } } while (delay_ns == 0 && next_sector < end); op = g_slice_new(MirrorOp); op->s = s; op->sector_num = sector_num; op->nb_sectors = nb_sectors; qemu_iovec_init(&op->qiov, nb_chunks); next_sector = sector_num; while (nb_chunks-- > 0) { MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free); size_t remaining = (nb_sectors * BDRV_SECTOR_SIZE) - op->qiov.size; QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next); s->buf_free_count--; qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining)); if (next_sector > hbitmap_next_sector && bdrv_get_dirty(source, s->dirty_bitmap, next_sector)) { hbitmap_next_sector = hbitmap_iter_next(&s->hbi); } next_sector += sectors_per_chunk; } bdrv_reset_dirty(source, sector_num, nb_sectors); s->in_flight++; s->sectors_in_flight += nb_sectors; trace_mirror_one_iteration(s, sector_num, nb_sectors); bdrv_aio_readv(source, sector_num, &op->qiov, nb_sectors, mirror_read_complete, op); return delay_ns; }
{ "code": [ " bdrv_reset_dirty(source, sector_num, nb_sectors);" ], "line_no": [ 257 ] }
static uint64_t VAR_0 mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; int nb_sectors, sectors_per_chunk, nb_chunks; int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector; uint64_t delay_ns = 0; MirrorOp *op; s->sector_num = hbitmap_iter_next(&s->hbi); if (s->sector_num < 0) { bdrv_dirty_iter_init(source, s->dirty_bitmap, &s->hbi); s->sector_num = hbitmap_iter_next(&s->hbi); trace_mirror_restart_iter(s, bdrv_get_dirty_count(source, s->dirty_bitmap)); assert(s->sector_num >= 0); } hbitmap_next_sector = s->sector_num; sector_num = s->sector_num; sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS; end = s->bdev_length / BDRV_SECTOR_SIZE; nb_chunks = 0; nb_sectors = 0; next_sector = sector_num; next_chunk = sector_num / sectors_per_chunk; while (test_bit(next_chunk, s->in_flight_bitmap)) { trace_mirror_yield_in_flight(s, sector_num, s->in_flight); qemu_coroutine_yield(); } do { int added_sectors, added_chunks; if (!bdrv_get_dirty(source, s->dirty_bitmap, next_sector) || test_bit(next_chunk, s->in_flight_bitmap)) { assert(nb_sectors > 0); break; } added_sectors = sectors_per_chunk; if (s->cow_bitmap && !test_bit(next_chunk, s->cow_bitmap)) { bdrv_round_to_clusters(s->target, next_sector, added_sectors, &next_sector, &added_sectors); if (next_sector < sector_num) { assert(nb_sectors == 0); sector_num = next_sector; next_chunk = next_sector / sectors_per_chunk; } } added_sectors = MIN(added_sectors, end - (sector_num + nb_sectors)); added_chunks = (added_sectors + sectors_per_chunk - 1) / sectors_per_chunk; while (nb_chunks == 0 && s->buf_free_count < added_chunks) { trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight); qemu_coroutine_yield(); } if (s->buf_free_count < nb_chunks + added_chunks) { trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight); break; } bitmap_set(s->in_flight_bitmap, next_chunk, added_chunks); nb_sectors += added_sectors; nb_chunks += added_chunks; next_sector += added_sectors; next_chunk += added_chunks; if (!s->synced && s->common.speed) { delay_ns = ratelimit_calculate_delay(&s->limit, added_sectors); } } while (delay_ns == 0 && next_sector < end); op = g_slice_new(MirrorOp); op->s = s; op->sector_num = sector_num; op->nb_sectors = nb_sectors; qemu_iovec_init(&op->qiov, nb_chunks); next_sector = sector_num; while (nb_chunks-- > 0) { MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free); size_t remaining = (nb_sectors * BDRV_SECTOR_SIZE) - op->qiov.size; QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next); s->buf_free_count--; qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining)); if (next_sector > hbitmap_next_sector && bdrv_get_dirty(source, s->dirty_bitmap, next_sector)) { hbitmap_next_sector = hbitmap_iter_next(&s->hbi); } next_sector += sectors_per_chunk; } bdrv_reset_dirty(source, sector_num, nb_sectors); s->in_flight++; s->sectors_in_flight += nb_sectors; trace_mirror_one_iteration(s, sector_num, nb_sectors); bdrv_aio_readv(source, sector_num, &op->qiov, nb_sectors, mirror_read_complete, op); return delay_ns; }
[ "static uint64_t VAR_0 mirror_iteration(MirrorBlockJob *s)\n{", "BlockDriverState *source = s->common.bs;", "int nb_sectors, sectors_per_chunk, nb_chunks;", "int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector;", "uint64_t delay_ns = 0;", "MirrorOp *op;", "s->sector_num = hbitmap_iter_next(&s->hbi);", "if (s->sector_num < 0) {", "bdrv_dirty_iter_init(source, s->dirty_bitmap, &s->hbi);", "s->sector_num = hbitmap_iter_next(&s->hbi);", "trace_mirror_restart_iter(s,\nbdrv_get_dirty_count(source, s->dirty_bitmap));", "assert(s->sector_num >= 0);", "}", "hbitmap_next_sector = s->sector_num;", "sector_num = s->sector_num;", "sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS;", "end = s->bdev_length / BDRV_SECTOR_SIZE;", "nb_chunks = 0;", "nb_sectors = 0;", "next_sector = sector_num;", "next_chunk = sector_num / sectors_per_chunk;", "while (test_bit(next_chunk, s->in_flight_bitmap)) {", "trace_mirror_yield_in_flight(s, sector_num, s->in_flight);", "qemu_coroutine_yield();", "}", "do {", "int added_sectors, added_chunks;", "if (!bdrv_get_dirty(source, s->dirty_bitmap, next_sector) ||\ntest_bit(next_chunk, s->in_flight_bitmap)) {", "assert(nb_sectors > 0);", "break;", "}", "added_sectors = sectors_per_chunk;", "if (s->cow_bitmap && !test_bit(next_chunk, s->cow_bitmap)) {", "bdrv_round_to_clusters(s->target,\nnext_sector, added_sectors,\n&next_sector, &added_sectors);", "if (next_sector < sector_num) {", "assert(nb_sectors == 0);", "sector_num = next_sector;", "next_chunk = next_sector / sectors_per_chunk;", "}", "}", "added_sectors = MIN(added_sectors, end - (sector_num + nb_sectors));", "added_chunks = (added_sectors + sectors_per_chunk - 1) / sectors_per_chunk;", "while (nb_chunks == 0 && s->buf_free_count < added_chunks) {", "trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight);", "qemu_coroutine_yield();", "}", "if (s->buf_free_count < nb_chunks + added_chunks) {", "trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight);", "break;", "}", "bitmap_set(s->in_flight_bitmap, next_chunk, added_chunks);", "nb_sectors += added_sectors;", "nb_chunks += added_chunks;", "next_sector += added_sectors;", "next_chunk += added_chunks;", "if (!s->synced && s->common.speed) {", "delay_ns = ratelimit_calculate_delay(&s->limit, added_sectors);", "}", "} while (delay_ns == 0 && next_sector < end);", "op = g_slice_new(MirrorOp);", "op->s = s;", "op->sector_num = sector_num;", "op->nb_sectors = nb_sectors;", "qemu_iovec_init(&op->qiov, nb_chunks);", "next_sector = sector_num;", "while (nb_chunks-- > 0) {", "MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free);", "size_t remaining = (nb_sectors * BDRV_SECTOR_SIZE) - op->qiov.size;", "QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next);", "s->buf_free_count--;", "qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining));", "if (next_sector > hbitmap_next_sector\n&& bdrv_get_dirty(source, s->dirty_bitmap, next_sector)) {", "hbitmap_next_sector = hbitmap_iter_next(&s->hbi);", "}", "next_sector += sectors_per_chunk;", "}", "bdrv_reset_dirty(source, sector_num, nb_sectors);", "s->in_flight++;", "s->sectors_in_flight += nb_sectors;", "trace_mirror_one_iteration(s, sector_num, nb_sectors);", "bdrv_aio_readv(source, sector_num, &op->qiov, nb_sectors,\nmirror_read_complete, op);", "return delay_ns;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115, 117, 119 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 257 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ] ]
22,493
static int libquvi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { LibQuviContext *qc = s->priv_data; return av_seek_frame(qc->fmtctx, stream_index, timestamp, flags); }
true
FFmpeg
2d40a09b6e73230b160a505f01ed1acf169e1d9f
static int libquvi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { LibQuviContext *qc = s->priv_data; return av_seek_frame(qc->fmtctx, stream_index, timestamp, flags); }
{ "code": [ " LibQuviContext *qc = s->priv_data;", " LibQuviContext *qc = s->priv_data;", " LibQuviContext *qc = s->priv_data;", "static int libquvi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)", " LibQuviContext *qc = s->priv_data;", " return av_seek_frame(qc->fmtctx, stream_index, timestamp, flags);" ], "line_no": [ 5, 5, 5, 1, 5, 7 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { LibQuviContext *qc = VAR_0->priv_data; return av_seek_frame(qc->fmtctx, VAR_1, VAR_2, VAR_3); }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3)\n{", "LibQuviContext *qc = VAR_0->priv_data;", "return av_seek_frame(qc->fmtctx, VAR_1, VAR_2, VAR_3);", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
22,495
static void sysbus_ahci_realize(DeviceState *dev, Error **errp) { SysBusDevice *sbd = SYS_BUS_DEVICE(dev); SysbusAHCIState *s = SYSBUS_AHCI(dev); ahci_init(&s->ahci, dev, NULL, s->num_ports); sysbus_init_mmio(sbd, &s->ahci.mem); sysbus_init_irq(sbd, &s->ahci.irq); }
true
qemu
bd16430777cc3d25930e479fdbe290d92cec0888
static void sysbus_ahci_realize(DeviceState *dev, Error **errp) { SysBusDevice *sbd = SYS_BUS_DEVICE(dev); SysbusAHCIState *s = SYSBUS_AHCI(dev); ahci_init(&s->ahci, dev, NULL, s->num_ports); sysbus_init_mmio(sbd, &s->ahci.mem); sysbus_init_irq(sbd, &s->ahci.irq); }
{ "code": [ " ahci_init(&s->ahci, dev, NULL, s->num_ports);" ], "line_no": [ 11 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0); SysbusAHCIState *s = SYSBUS_AHCI(VAR_0); ahci_init(&s->ahci, VAR_0, NULL, s->num_ports); sysbus_init_mmio(sbd, &s->ahci.mem); sysbus_init_irq(sbd, &s->ahci.irq); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0);", "SysbusAHCIState *s = SYSBUS_AHCI(VAR_0);", "ahci_init(&s->ahci, VAR_0, NULL, s->num_ports);", "sysbus_init_mmio(sbd, &s->ahci.mem);", "sysbus_init_irq(sbd, &s->ahci.irq);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ] ]