unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
89,119
0
comp_distance_value(MinMax* d1, MinMax* d2, int v1, int v2) { if (v2 <= 0) return -1; if (v1 <= 0) return 1; v1 *= distance_value(d1); v2 *= distance_value(d2); if (v2 > v1) return 1; if (v2 < v1) return -1; if (d2->min < d1->min) return 1; if (d2->min > d1->min) return -1; return 0; }
700
135,138
0
bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, const String& contextURL, const WTF::OrdinalNumber& contextLine) { if (!ContentSecurityPolicy::shouldBypassMainWorld(this) && !contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLine)) return false; LocalFrame* frame = executingFrame(); if (!frame) return false; if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) return false; if (node && node->document() != this && !node->document().allowInlineEventHandlers(node, listener, contextURL, contextLine)) return false; return true; }
701
59,426
0
xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) { return(xmlCtxtUseOptionsInternal(ctxt, options, NULL)); }
702
24,483
0
cifs_find_tcp_session(struct sockaddr *addr, struct smb_vol *vol) { struct TCP_Server_Info *server; spin_lock(&cifs_tcp_ses_lock); list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) { if (!net_eq(cifs_net_ns(server), current->nsproxy->net_ns)) continue; if (!match_address(server, addr, (struct sockaddr *)&vol->srcaddr)) continue; if (!match_port(server, addr)) continue; if (!match_security(server, vol)) continue; ++server->srv_count; spin_unlock(&cifs_tcp_ses_lock); cFYI(1, "Existing tcp session with server found"); return server; } spin_unlock(&cifs_tcp_ses_lock); return NULL; }
703
150,758
0
UMARequestDeviceOutcome OutcomeFromChooserEvent(BluetoothChooser::Event event) { switch (event) { case BluetoothChooser::Event::DENIED_PERMISSION: return UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_DENIED_PERMISSION; case BluetoothChooser::Event::CANCELLED: return UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_CANCELLED; case BluetoothChooser::Event::SHOW_OVERVIEW_HELP: return UMARequestDeviceOutcome::BLUETOOTH_OVERVIEW_HELP_LINK_PRESSED; case BluetoothChooser::Event::SHOW_ADAPTER_OFF_HELP: return UMARequestDeviceOutcome::ADAPTER_OFF_HELP_LINK_PRESSED; case BluetoothChooser::Event::SHOW_NEED_LOCATION_HELP: return UMARequestDeviceOutcome::NEED_LOCATION_HELP_LINK_PRESSED; case BluetoothChooser::Event::SELECTED: NOTREACHED(); return UMARequestDeviceOutcome::SUCCESS; case BluetoothChooser::Event::RESCAN: return UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_RESCAN; } NOTREACHED(); return UMARequestDeviceOutcome::SUCCESS; }
704
48,373
0
tsize_t t2p_write_pdf_name(unsigned char* name, TIFF* output){ tsize_t written=0; uint32 i=0; char buffer[64]; uint16 nextchar=0; size_t namelen=0; namelen = strlen((char *)name); if (namelen>126) { namelen=126; } written += t2pWriteFile(output, (tdata_t) "/", 1); for (i=0;i<namelen;i++){ if ( ((unsigned char)name[i]) < 0x21){ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); nextchar=1; } if ( ((unsigned char)name[i]) > 0x7E){ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); nextchar=1; } if (nextchar==0){ switch (name[i]){ case 0x23: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x25: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x28: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x29: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x2F: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x3C: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x3E: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x5B: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x5D: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x7B: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; case 0x7D: snprintf(buffer, sizeof(buffer), "#%.2X", name[i]); buffer[sizeof(buffer) - 1] = '\0'; written += t2pWriteFile(output, (tdata_t) buffer, 3); break; default: written += t2pWriteFile(output, (tdata_t) &name[i], 1); } } nextchar=0; } written += t2pWriteFile(output, (tdata_t) " ", 1); return(written); }
705
148,335
0
WebContents* WebContents::CreateWithSessionStorage( const WebContents::CreateParams& params, const SessionStorageNamespaceMap& session_storage_namespace_map) { WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context); new_contents->SetOpenerForNewContents(FindOpener(params), params.opener_suppressed); for (SessionStorageNamespaceMap::const_iterator it = session_storage_namespace_map.begin(); it != session_storage_namespace_map.end(); ++it) { new_contents->GetController() .SetSessionStorageNamespace(it->first, it->second.get()); } new_contents->Init(params); return new_contents; }
706
107,353
0
void Browser::ShowSingletonTab(const GURL& url, bool ignore_path) { browser::NavigateParams params(this, url, PageTransition::AUTO_BOOKMARK); params.disposition = SINGLETON_TAB; params.show_window = true; params.ignore_path = ignore_path; browser::Navigate(&params); }
707
66,061
0
static void omninet_process_read_urb(struct urb *urb) { struct usb_serial_port *port = urb->context; const struct omninet_header *hdr = urb->transfer_buffer; const unsigned char *data; size_t data_len; if (urb->actual_length <= OMNINET_HEADERLEN || !hdr->oh_len) return; data = (char *)urb->transfer_buffer + OMNINET_HEADERLEN; data_len = min_t(size_t, urb->actual_length - OMNINET_HEADERLEN, hdr->oh_len); tty_insert_flip_string(&port->port, data, data_len); tty_flip_buffer_push(&port->port); }
708
87,586
0
static unsigned readChunk_pHYs(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) { if(chunkLength != 9) return 74; /*invalid pHYs chunk size*/ info->phys_defined = 1; info->phys_x = 16777216u * data[0] + 65536u * data[1] + 256u * data[2] + data[3]; info->phys_y = 16777216u * data[4] + 65536u * data[5] + 256u * data[6] + data[7]; info->phys_unit = data[8]; return 0; /* OK */ }
709
145,601
0
void XmlConfigParser::CharactersImpl(void* ctx, const xmlChar* ch, int len) { XmlConfigParser* context = FromContext(ctx); if (context->IsParsingData()) { context->master_prefs_ += std::string(reinterpret_cast<const char*>(ch), len); } }
710
122,582
0
void WebDevToolsAgentImpl::setProcessId(long processId) { inspectorController()->setProcessId(processId); }
711
126,292
0
void BrowserCommandController::UpdateCommandsForBookmarkEditing() { command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, CanBookmarkCurrentPage(browser_)); command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, CanBookmarkAllTabs(browser_)); command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, true); }
712
32,391
0
static bool mnt_ns_loop(struct path *path) { /* Could bind mounting the mount namespace inode cause a * mount namespace loop? */ struct inode *inode = path->dentry->d_inode; struct proc_inode *ei; struct mnt_namespace *mnt_ns; if (!proc_ns_inode(inode)) return false; ei = PROC_I(inode); if (ei->ns_ops != &mntns_operations) return false; mnt_ns = ei->ns; return current->nsproxy->mnt_ns->seq >= mnt_ns->seq; }
713
177,056
0
SoftAVC::~SoftAVC() { H264SwDecRelease(mHandle); mHandle = NULL; while (mPicToHeaderMap.size() != 0) { OMX_BUFFERHEADERTYPE *header = mPicToHeaderMap.editValueAt(0); mPicToHeaderMap.removeItemsAt(0); delete header; header = NULL; } List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex); List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex); CHECK(outQueue.empty()); CHECK(inQueue.empty()); delete[] mFirstPicture; }
714
143,847
0
size_t GetIndependentHistogramCount() { HistogramFlattenerDeltaRecorder flattener; base::HistogramSnapshotManager snapshot_manager(&flattener); SystemProfileProto profile_proto; if (!provider()->ProvideIndependentMetrics(&profile_proto, &snapshot_manager)) { return 0; } return flattener.GetRecordedDeltaHistogramNames().size(); }
715
1,944
0
static void reds_update_mouse_mode(void) { int allowed = 0; int qxl_count = red_dispatcher_qxl_count(); if ((agent_mouse && vdagent) || (inputs_has_tablet() && qxl_count == 1)) { allowed = reds->dispatcher_allows_client_mouse; } if (allowed == reds->is_client_mouse_allowed) { return; } reds->is_client_mouse_allowed = allowed; if (reds->mouse_mode == SPICE_MOUSE_MODE_CLIENT && !allowed) { reds_set_mouse_mode(SPICE_MOUSE_MODE_SERVER); return; } if (reds->main_channel) { main_channel_push_mouse_mode(reds->main_channel, reds->mouse_mode, reds->is_client_mouse_allowed); } }
716
157,034
0
void MultibufferDataSource::MediaPlaybackRateChanged(double playback_rate) { DCHECK(render_task_runner_->BelongsToCurrentThread()); if (playback_rate < 0.0) return; playback_rate_ = playback_rate; cancel_on_defer_ = false; UpdateBufferSizes(); }
717
60,050
0
char* Elf_(r_bin_elf_get_arch)(ELFOBJ *bin) { switch (bin->ehdr.e_machine) { case EM_ARC: case EM_ARC_A5: return strdup ("arc"); case EM_AVR: return strdup ("avr"); case EM_CRIS: return strdup ("cris"); case EM_68K: return strdup ("m68k"); case EM_MIPS: case EM_MIPS_RS3_LE: case EM_MIPS_X: return strdup ("mips"); case EM_MCST_ELBRUS: return strdup ("elbrus"); case EM_TRICORE: return strdup ("tricore"); case EM_ARM: case EM_AARCH64: return strdup ("arm"); case EM_HEXAGON: return strdup ("hexagon"); case EM_BLACKFIN: return strdup ("blackfin"); case EM_SPARC: case EM_SPARC32PLUS: case EM_SPARCV9: return strdup ("sparc"); case EM_PPC: case EM_PPC64: return strdup ("ppc"); case EM_PARISC: return strdup ("hppa"); case EM_PROPELLER: return strdup ("propeller"); case EM_MICROBLAZE: return strdup ("microblaze.gnu"); case EM_RISCV: return strdup ("riscv"); case EM_VAX: return strdup ("vax"); case EM_XTENSA: return strdup ("xtensa"); case EM_LANAI: return strdup ("lanai"); case EM_VIDEOCORE3: case EM_VIDEOCORE4: return strdup ("vc4"); case EM_SH: return strdup ("sh"); case EM_V850: return strdup ("v850"); case EM_IA_64: return strdup("ia64"); default: return strdup ("x86"); } }
718
96,860
0
static bool pipe_buf_can_merge(struct pipe_buffer *buf) { return buf->ops == &anon_pipe_buf_ops; }
719
155,990
0
InlineLoginHandlerImpl::FinishCompleteLoginParams::FinishCompleteLoginParams( InlineLoginHandlerImpl* handler, content::StoragePartition* partition, const GURL& url, const base::FilePath& profile_path, bool confirm_untrusted_signin, const std::string& email, const std::string& gaia_id, const std::string& password, const std::string& auth_code, bool choose_what_to_sync, bool is_force_sign_in_with_usermanager) : handler(handler), partition(partition), url(url), profile_path(profile_path), confirm_untrusted_signin(confirm_untrusted_signin), email(email), gaia_id(gaia_id), password(password), auth_code(auth_code), choose_what_to_sync(choose_what_to_sync), is_force_sign_in_with_usermanager(is_force_sign_in_with_usermanager) {}
720
46,652
0
static int __init aes_s390_init(void) { int ret; if (crypt_s390_func_available(KM_AES_128_ENCRYPT, CRYPT_S390_MSA)) keylen_flag |= AES_KEYLEN_128; if (crypt_s390_func_available(KM_AES_192_ENCRYPT, CRYPT_S390_MSA)) keylen_flag |= AES_KEYLEN_192; if (crypt_s390_func_available(KM_AES_256_ENCRYPT, CRYPT_S390_MSA)) keylen_flag |= AES_KEYLEN_256; if (!keylen_flag) return -EOPNOTSUPP; /* z9 109 and z9 BC/EC only support 128 bit key length */ if (keylen_flag == AES_KEYLEN_128) pr_info("AES hardware acceleration is only available for" " 128-bit keys\n"); ret = crypto_register_alg(&aes_alg); if (ret) goto aes_err; ret = crypto_register_alg(&ecb_aes_alg); if (ret) goto ecb_aes_err; ret = crypto_register_alg(&cbc_aes_alg); if (ret) goto cbc_aes_err; if (crypt_s390_func_available(KM_XTS_128_ENCRYPT, CRYPT_S390_MSA | CRYPT_S390_MSA4) && crypt_s390_func_available(KM_XTS_256_ENCRYPT, CRYPT_S390_MSA | CRYPT_S390_MSA4)) { ret = crypto_register_alg(&xts_aes_alg); if (ret) goto xts_aes_err; xts_aes_alg_reg = 1; } if (crypt_s390_func_available(KMCTR_AES_128_ENCRYPT, CRYPT_S390_MSA | CRYPT_S390_MSA4) && crypt_s390_func_available(KMCTR_AES_192_ENCRYPT, CRYPT_S390_MSA | CRYPT_S390_MSA4) && crypt_s390_func_available(KMCTR_AES_256_ENCRYPT, CRYPT_S390_MSA | CRYPT_S390_MSA4)) { ctrblk = (u8 *) __get_free_page(GFP_KERNEL); if (!ctrblk) { ret = -ENOMEM; goto ctr_aes_err; } ret = crypto_register_alg(&ctr_aes_alg); if (ret) { free_page((unsigned long) ctrblk); goto ctr_aes_err; } ctr_aes_alg_reg = 1; } out: return ret; ctr_aes_err: crypto_unregister_alg(&xts_aes_alg); xts_aes_err: crypto_unregister_alg(&cbc_aes_alg); cbc_aes_err: crypto_unregister_alg(&ecb_aes_alg); ecb_aes_err: crypto_unregister_alg(&aes_alg); aes_err: goto out; }
721
3,439
0
hook_search_fd (int fd) { struct t_hook *ptr_hook; for (ptr_hook = weechat_hooks[HOOK_TYPE_FD]; ptr_hook; ptr_hook = ptr_hook->next_hook) { if (!ptr_hook->deleted && (HOOK_FD(ptr_hook, fd) == fd)) return ptr_hook; } /* fd hook not found */ return NULL; }
722
160,904
0
DOMWindow::DOMWindow(Frame& frame) : frame_(frame), window_proxy_manager_(frame.GetWindowProxyManager()), window_is_closing_(false) {}
723
171,900
0
static void btif_hl_proc_dch_close_ind(tBTA_HL *p_data) { btif_hl_mdl_cb_t *p_dcb; btif_hl_mcl_cb_t *p_mcb; UINT8 app_idx, mcl_idx, mdl_idx; BTIF_TRACE_DEBUG("%s", __FUNCTION__); if (btif_hl_find_mdl_idx_using_handle(p_data->dch_close_ind.mdl_handle, &app_idx, &mcl_idx, &mdl_idx )) { p_dcb = BTIF_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx); btif_hl_release_socket(app_idx,mcl_idx, mdl_idx); btif_hl_send_setup_disconnected_cb(app_idx, mcl_idx); p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx,mcl_idx); btif_hl_clean_mdl_cb(p_dcb); if (!btif_hl_num_dchs_in_use(p_mcb->mcl_handle)) btif_hl_start_cch_timer(app_idx, mcl_idx); BTIF_TRACE_DEBUG("remote DCH close success mdl_idx=%d", mdl_idx); } }
724
121,469
0
DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow( Browser* browser, const DevToolsToggleAction& action) { if (action.type() == DevToolsToggleAction::kToggle && browser->is_devtools()) { browser->tab_strip_model()->CloseAllTabs(); return NULL; } return ToggleDevToolsWindow( browser->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(), action.type() == DevToolsToggleAction::kInspect, action); }
725
13,965
0
gsicc_get_spotnames(gcmmhprofile_t profile, gs_memory_t *memory) { int k; gsicc_namelist_t *list; gsicc_colorname_t *name; gsicc_colorname_t **curr_entry; int num_colors; char *clr_name; num_colors = gscms_get_numberclrtnames(profile); if (num_colors == 0) return(NULL); /* Allocate structure for managing this */ list = gsicc_new_namelist(memory); if (list == NULL) return(NULL); curr_entry = &(list->head); list->count = num_colors; for (k = 0; k < num_colors; k++) { /* Allocate a new name object */ clr_name = gscms_get_clrtname(profile, k, memory); if (clr_name == NULL) break; name = gsicc_new_colorname(memory); if (name == NULL) { /* FIXME: Free clr_name */ gs_free_object(memory, clr_name, "gsicc_get_spotnames"); break; } /* Get the name */ name->name = clr_name; name->length = strlen(clr_name); *curr_entry = name; curr_entry = &(name->next); } if (k < num_colors) { /* Failed allocation */ gsicc_free_spotnames(list, memory); return NULL; } return list; }
726
43,822
0
spnego_gss_inquire_cred( OM_uint32 *minor_status, gss_cred_id_t cred_handle, gss_name_t *name, OM_uint32 *lifetime, int *cred_usage, gss_OID_set *mechanisms) { OM_uint32 status; spnego_gss_cred_id_t spcred = NULL; gss_cred_id_t creds = GSS_C_NO_CREDENTIAL; OM_uint32 tmp_minor_status; OM_uint32 initiator_lifetime, acceptor_lifetime; dsyslog("Entering inquire_cred\n"); /* * To avoid infinite recursion, if GSS_C_NO_CREDENTIAL is * supplied we call gss_inquire_cred_by_mech() on the * first non-SPNEGO mechanism. */ spcred = (spnego_gss_cred_id_t)cred_handle; if (spcred == NULL) { status = get_available_mechs(minor_status, GSS_C_NO_NAME, GSS_C_BOTH, GSS_C_NO_CRED_STORE, &creds, mechanisms, NULL); if (status != GSS_S_COMPLETE) { dsyslog("Leaving inquire_cred\n"); return (status); } if ((*mechanisms)->count == 0) { gss_release_cred(&tmp_minor_status, &creds); gss_release_oid_set(&tmp_minor_status, mechanisms); dsyslog("Leaving inquire_cred\n"); return (GSS_S_DEFECTIVE_CREDENTIAL); } assert((*mechanisms)->elements != NULL); status = gss_inquire_cred_by_mech(minor_status, creds, &(*mechanisms)->elements[0], name, &initiator_lifetime, &acceptor_lifetime, cred_usage); if (status != GSS_S_COMPLETE) { gss_release_cred(&tmp_minor_status, &creds); dsyslog("Leaving inquire_cred\n"); return (status); } if (lifetime != NULL) *lifetime = (*cred_usage == GSS_C_ACCEPT) ? acceptor_lifetime : initiator_lifetime; gss_release_cred(&tmp_minor_status, &creds); } else { status = gss_inquire_cred(minor_status, spcred->mcred, name, lifetime, cred_usage, mechanisms); } dsyslog("Leaving inquire_cred\n"); return (status); }
727
88,991
0
static void ClipCLAHEHistogram(const double clip_limit,const size_t number_bins, size_t *histogram) { #define NumberCLAHEGrays (65536) register ssize_t i; size_t cumulative_excess, previous_excess, step; ssize_t excess; /* Compute total number of excess pixels. */ cumulative_excess=0; for (i=0; i < (ssize_t) number_bins; i++) { excess=(ssize_t) histogram[i]-(ssize_t) clip_limit; if (excess > 0) cumulative_excess+=excess; } /* Clip histogram and redistribute excess pixels across all bins. */ step=cumulative_excess/number_bins; excess=(ssize_t) (clip_limit-step); for (i=0; i < (ssize_t) number_bins; i++) { if ((double) histogram[i] > clip_limit) histogram[i]=(size_t) clip_limit; else if ((ssize_t) histogram[i] > excess) { cumulative_excess-=histogram[i]-excess; histogram[i]=(size_t) clip_limit; } else { cumulative_excess-=step; histogram[i]+=step; } } /* Redistribute remaining excess. */ do { register size_t *p; size_t *q; previous_excess=cumulative_excess; p=histogram; q=histogram+number_bins; while ((cumulative_excess != 0) && (p < q)) { step=number_bins/cumulative_excess; if (step < 1) step=1; for (p=histogram; (p < q) && (cumulative_excess != 0); p+=step) if ((double) *p < clip_limit) { (*p)++; cumulative_excess--; } p++; } } while ((cumulative_excess != 0) && (cumulative_excess < previous_excess)); }
728
141,510
0
void PaintLayerScrollableArea::UpdateAfterOverflowRecalc() { UpdateScrollDimensions(); UpdateScrollbarProportions(); bool needs_horizontal_scrollbar; bool needs_vertical_scrollbar; ComputeScrollbarExistence(needs_horizontal_scrollbar, needs_vertical_scrollbar); bool horizontal_scrollbar_should_change = needs_horizontal_scrollbar != HasHorizontalScrollbar(); bool vertical_scrollbar_should_change = needs_vertical_scrollbar != HasVerticalScrollbar(); if ((GetLayoutBox()->HasAutoHorizontalScrollbar() && horizontal_scrollbar_should_change) || (GetLayoutBox()->HasAutoVerticalScrollbar() && vertical_scrollbar_should_change)) { GetLayoutBox()->SetNeedsLayoutAndFullPaintInvalidation( layout_invalidation_reason::kUnknown); } ClampScrollOffsetAfterOverflowChange(); }
729
110,529
0
void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { VertexAttribManager::VertexAttribInfo* info = vertex_attrib_manager_->GetVertexAttribInfo(index); if (!info) { SetGLError(GL_INVALID_VALUE, "glVertexAttrib4fv", "index out of range"); return; } VertexAttribManager::VertexAttribInfo::Vec4 value; value.v[0] = v[0]; value.v[1] = v[1]; value.v[2] = v[2]; value.v[3] = v[3]; info->set_value(value); glVertexAttrib4fv(index, v); }
730
144,606
0
void WebContentsImpl::OnMediaSessionStateChanged() { MediaSession* session = MediaSession::Get(this); FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaSessionStateChanged(session->IsControllable(), session->IsSuspended())); }
731
175,632
0
status_t SoftAACEncoder::initEncoder() { mApiHandle = new VO_AUDIO_CODECAPI; if (VO_ERR_NONE != voGetAACEncAPI(mApiHandle)) { ALOGE("Failed to get api handle"); return UNKNOWN_ERROR; } mMemOperator = new VO_MEM_OPERATOR; mMemOperator->Alloc = cmnMemAlloc; mMemOperator->Copy = cmnMemCopy; mMemOperator->Free = cmnMemFree; mMemOperator->Set = cmnMemSet; mMemOperator->Check = cmnMemCheck; VO_CODEC_INIT_USERDATA userData; memset(&userData, 0, sizeof(userData)); userData.memflag = VO_IMF_USERMEMOPERATOR; userData.memData = (VO_PTR) mMemOperator; if (VO_ERR_NONE != mApiHandle->Init(&mEncoderHandle, VO_AUDIO_CodingAAC, &userData)) { ALOGE("Failed to init AAC encoder"); return UNKNOWN_ERROR; } return OK; }
732
141,695
0
void reportCallWithArgument(ConsoleAPIType type, const String16& message) { std::vector<v8::Local<v8::Value>> arguments(1, toV8String(m_isolate, message)); reportCall(type, arguments); }
733
155,861
0
void SupervisedUserService::UpdateApprovedExtensions() { const base::DictionaryValue* dict = profile_->GetPrefs()->GetDictionary( prefs::kSupervisedUserApprovedExtensions); std::set<std::string> extensions_to_be_checked; for (const auto& extension : approved_extensions_map_) extensions_to_be_checked.insert(extension.first); approved_extensions_map_.clear(); for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { std::string version_str; bool result = it.value().GetAsString(&version_str); DCHECK(result); base::Version version(version_str); if (version.IsValid()) { approved_extensions_map_[it.key()] = version; extensions_to_be_checked.insert(it.key()); } else { LOG(WARNING) << "Invalid version number " << version_str; } } for (const auto& extension_id : extensions_to_be_checked) { ChangeExtensionStateIfNecessary(extension_id); } }
734
185,846
1
void WallpaperManager::OnWallpaperDecoded( const AccountId& account_id, const wallpaper::WallpaperInfo& info, bool update_wallpaper, MovableOnDestroyCallbackHolder on_finish, std::unique_ptr<user_manager::UserImage> user_image) { DCHECK_CURRENTLY_ON(BrowserThread::UI); TRACE_EVENT_ASYNC_END0("ui", "LoadAndDecodeWallpaper", this); // If decoded wallpaper is empty, we have probably failed to decode the file. // Use default wallpaper in this case. if (user_image->image().isNull()) { // Updates user pref to default wallpaper. wallpaper::WallpaperInfo default_info( "", wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, wallpaper::DEFAULT, base::Time::Now().LocalMidnight()); SetUserWallpaperInfo(account_id, default_info, true); if (update_wallpaper) DoSetDefaultWallpaper(account_id, std::move(on_finish)); return; } // Update the image, but keep the path which was set earlier. wallpaper_cache_[account_id].second = user_image->image(); if (update_wallpaper) SetWallpaper(user_image->image(), info); }
735
143,472
0
void CompositorImpl::AddChildFrameSink(const viz::FrameSinkId& frame_sink_id) { if (has_layer_tree_frame_sink_) { GetHostFrameSinkManager()->RegisterFrameSinkHierarchy(frame_sink_id_, frame_sink_id); } else { pending_child_frame_sink_ids_.insert(frame_sink_id); } }
736
139,538
0
static bool IsUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID value_id) { return value_id == CSSValueEmbed || value_id == CSSValueBidiOverride || value_id == CSSValueWebkitIsolate || value_id == CSSValueWebkitIsolateOverride || value_id == CSSValueWebkitPlaintext || value_id == CSSValueIsolate || value_id == CSSValueIsolateOverride || value_id == CSSValuePlaintext; }
737
143,471
0
GLOutputSurfaceBufferQueueAndroid::GetOverlayCandidateValidator() const { return overlay_candidate_validator_.get(); }
738
98,539
0
virtual void Run() { ui_controls::SendMouseEventsNotifyWhenDone(ui_controls::LEFT, state_, next_task_); }
739
120,916
0
ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() {}
740
33,472
0
int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options) { struct console_cmdline *c; int i; for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) if (strcmp(console_cmdline[i].name, name) == 0 && console_cmdline[i].index == idx) { c = &console_cmdline[i]; strlcpy(c->name, name_new, sizeof(c->name)); c->name[sizeof(c->name) - 1] = 0; c->options = options; c->index = idx_new; return i; } /* not found */ return -1; }
741
26,159
0
int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { perf_guest_cbs = cbs; return 0; }
742
177,671
0
virtual ~ResizingVideoSource() {}
743
91,778
0
void comps_objmrtree_set_x(COMPS_ObjMRTree *rt, char *key, COMPS_Object *data) { __comps_objmrtree_set(rt, key, strlen(key), data); }
744
81,420
0
static struct dentry *trace_options_init_dentry(struct trace_array *tr) { struct dentry *d_tracer; if (tr->options) return tr->options; d_tracer = tracing_get_dentry(tr); if (IS_ERR(d_tracer)) return NULL; tr->options = tracefs_create_dir("options", d_tracer); if (!tr->options) { pr_warn("Could not create tracefs directory 'options'\n"); return NULL; } return tr->options; }
745
56,519
0
long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file_inode(file); loff_t new_size = 0; unsigned int max_blocks; int ret = 0; int flags; ext4_lblk_t lblk; unsigned int blkbits = inode->i_blkbits; /* * Encrypted inodes can't handle collapse range or insert * range since we would need to re-encrypt blocks with a * different IV or XTS tweak (which are based on the logical * block number). * * XXX It's not clear why zero range isn't working, but we'll * leave it disabled for encrypted inodes for now. This is a * bug we should fix.... */ if (ext4_encrypted_inode(inode) && (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE | FALLOC_FL_ZERO_RANGE))) return -EOPNOTSUPP; /* Return error if mode is not supported */ if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE)) return -EOPNOTSUPP; if (mode & FALLOC_FL_PUNCH_HOLE) return ext4_punch_hole(inode, offset, len); ret = ext4_convert_inline_data(inode); if (ret) return ret; if (mode & FALLOC_FL_COLLAPSE_RANGE) return ext4_collapse_range(inode, offset, len); if (mode & FALLOC_FL_INSERT_RANGE) return ext4_insert_range(inode, offset, len); if (mode & FALLOC_FL_ZERO_RANGE) return ext4_zero_range(file, offset, len, mode); trace_ext4_fallocate_enter(inode, offset, len, mode); lblk = offset >> blkbits; /* * We can't just convert len to max_blocks because * If blocksize = 4096 offset = 3072 and len = 2048 */ max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) - lblk; flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT; if (mode & FALLOC_FL_KEEP_SIZE) flags |= EXT4_GET_BLOCKS_KEEP_SIZE; mutex_lock(&inode->i_mutex); /* * We only support preallocation for extent-based files only */ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) { ret = -EOPNOTSUPP; goto out; } if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > i_size_read(inode)) { new_size = offset + len; ret = inode_newsize_ok(inode, new_size); if (ret) goto out; } ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, flags, mode); if (ret) goto out; if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) { ret = jbd2_complete_transaction(EXT4_SB(inode->i_sb)->s_journal, EXT4_I(inode)->i_sync_tid); } out: mutex_unlock(&inode->i_mutex); trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); return ret; }
746
59,536
0
xmlRecoverDoc(const xmlChar *cur) { return(xmlSAXParseDoc(NULL, cur, 1)); }
747
16,179
0
int GahpClient::ec2_vm_vm_keypair_all( const char *service_url, const char* publickeyfile, const char* privatekeyfile, StringList & returnStatus, char* & error_code ) { static const char* command = "EC2_VM_RUNNING_KEYPAIR"; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) ) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } std::string reqline; char* esc1 = strdup( escapeGahpString(service_url) ); char* esc2 = strdup( escapeGahpString(publickeyfile) ); char* esc3 = strdup( escapeGahpString(privatekeyfile) ); int x = sprintf(reqline, "%s %s %s", esc1, esc2, esc3 ); free( esc1 ); free( esc2 ); free( esc3 ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command, buf, deleg_proxy); } Gahp_Args* result = get_pending_result(command, buf); if ( result ) { int rc = atoi(result->argv[1]); if (rc == 1) { if (result->argc == 2) { error_string = ""; } else if (result->argc == 4) { error_code = strdup(result->argv[2]); error_string = result->argv[3]; } else { EXCEPT("Bad %s Result",command); } } else { // rc == 0 if ( ( (result->argc-2) % 2) != 0 ) { EXCEPT("Bad %s Result",command); } else { for (int i=2; i<result->argc; i++) { returnStatus.append( strdup(result->argv[i]) ); } returnStatus.rewind(); } } delete result; return rc; } if ( check_pending_timeout(command, buf) ) { sprintf( error_string, "%s timed out", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; }
748
142,679
0
void FrameLoader::didExplicitOpen() { if (!m_stateMachine.committedFirstRealDocumentLoad()) m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad); if (Frame* parent = m_frame->tree().parent()) { if ((parent->isLocalFrame() && toLocalFrame(parent)->document()->loadEventStillNeeded()) || (parent->isRemoteFrame() && parent->isLoading())) { m_progressTracker->progressStarted(); } } m_frame->navigationScheduler().cancel(); }
749
129,631
0
bool SVGLayoutSupport::pointInClippingArea(const LayoutObject* object, const FloatPoint& point) { ASSERT(object); SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(object); if (!resources) return true; if (LayoutSVGResourceClipper* clipper = resources->clipper()) return clipper->hitTestClipContent(object->objectBoundingBox(), point); return true; }
750
96,942
0
static inline long check_and_migrate_cma_pages(unsigned long start, long nr_pages, unsigned int gup_flags, struct page **pages, struct vm_area_struct **vmas) { return nr_pages; }
751
126,503
0
gfx::Image* TabStripGtk::GetDropArrowImage(bool is_down) { return &ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); }
752
101,769
0
void Browser::PrepareForInstant() { window_->PrepareForInstant(); }
753
103,457
0
const SkBitmap& ExtensionService::GetOmniboxPopupIcon( const std::string& extension_id) { return omnibox_popup_icon_manager_.GetIcon(extension_id); }
754
178,021
1
FT_Bitmap_Embolden( FT_Library library, FT_Bitmap* bitmap, FT_Pos xStrength, FT_Pos yStrength ) { FT_Error error; unsigned char* p; FT_Int i, x, y, pitch; FT_Int xstr, ystr; return FT_THROW( Invalid_Library_Handle ); if ( !bitmap || !bitmap->buffer ) return FT_THROW( Invalid_Argument ); if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) || ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) ) return FT_THROW( Invalid_Argument ); xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6; ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6; if ( xstr == 0 && ystr == 0 ) return FT_Err_Ok; else if ( xstr < 0 || ystr < 0 ) return FT_THROW( Invalid_Argument ); switch ( bitmap->pixel_mode ) { case FT_PIXEL_MODE_GRAY2: case FT_PIXEL_MODE_GRAY4: { FT_Bitmap tmp; /* convert to 8bpp */ FT_Bitmap_New( &tmp ); error = FT_Bitmap_Convert( library, bitmap, &tmp, 1 ); if ( error ) return error; FT_Bitmap_Done( library, bitmap ); *bitmap = tmp; } break; case FT_PIXEL_MODE_MONO: if ( xstr > 8 ) xstr = 8; break; case FT_PIXEL_MODE_LCD: xstr *= 3; break; case FT_PIXEL_MODE_LCD_V: ystr *= 3; break; case FT_PIXEL_MODE_BGRA: /* We don't embolden color glyphs. */ return FT_Err_Ok; } error = ft_bitmap_assure_buffer( library->memory, bitmap, xstr, ystr ); if ( error ) return error; /* take care of bitmap flow */ pitch = bitmap->pitch; if ( pitch > 0 ) p = bitmap->buffer + pitch * ystr; else { pitch = -pitch; p = bitmap->buffer + pitch * ( bitmap->rows - 1 ); } /* for each row */ for ( y = 0; y < bitmap->rows ; y++ ) { /* * Horizontally: * * From the last pixel on, make each pixel or'ed with the * `xstr' pixels before it. */ for ( x = pitch - 1; x >= 0; x-- ) { unsigned char tmp; tmp = p[x]; for ( i = 1; i <= xstr; i++ ) { if ( bitmap->pixel_mode == FT_PIXEL_MODE_MONO ) { p[x] |= tmp >> i; /* the maximum value of 8 for `xstr' comes from here */ if ( x > 0 ) p[x] |= p[x - 1] << ( 8 - i ); #if 0 if ( p[x] == 0xff ) break; #endif } else { if ( x - i >= 0 ) { if ( p[x] + p[x - i] > bitmap->num_grays - 1 ) { p[x] = (unsigned char)( bitmap->num_grays - 1 ); break; } else { p[x] = (unsigned char)( p[x] + p[x - i] ); if ( p[x] == bitmap->num_grays - 1 ) break; } } else break; } } } /* * Vertically: * * Make the above `ystr' rows or'ed with it. */ for ( x = 1; x <= ystr; x++ ) { unsigned char* q; q = p - bitmap->pitch * x; for ( i = 0; i < pitch; i++ ) q[i] |= p[i]; } p += bitmap->pitch; } bitmap->width += xstr; bitmap->rows += ystr; return FT_Err_Ok; }
755
84,461
0
_peekURL(int only_img) { Anchor *a; ParsedURL pu; static Str s = NULL; #ifdef USE_M17N static Lineprop *p = NULL; Lineprop *pp; #endif static int offset = 0, n; if (Currentbuf->firstLine == NULL) return; if (CurrentKey == prev_key && s != NULL) { if (s->length - offset >= COLS) offset++; else if (s->length <= offset) /* bug ? */ offset = 0; goto disp; } else { offset = 0; } s = NULL; a = (only_img ? NULL : retrieveCurrentAnchor(Currentbuf)); if (a == NULL) { a = (only_img ? NULL : retrieveCurrentForm(Currentbuf)); if (a == NULL) { a = retrieveCurrentImg(Currentbuf); if (a == NULL) return; } else s = Strnew_charp(form2str((FormItemList *)a->url)); } if (s == NULL) { parseURL2(a->url, &pu, baseURL(Currentbuf)); s = parsedURL2Str(&pu); } if (DecodeURL) s = Strnew_charp(url_decode2(s->ptr, Currentbuf)); #ifdef USE_M17N s = checkType(s, &pp, NULL); p = NewAtom_N(Lineprop, s->length); bcopy((void *)pp, (void *)p, s->length * sizeof(Lineprop)); #endif disp: n = searchKeyNum(); if (n > 1 && s->length > (n - 1) * (COLS - 1)) offset = (n - 1) * (COLS - 1); #ifdef USE_M17N while (offset < s->length && p[offset] & PC_WCHAR2) offset++; #endif disp_message_nomouse(&s->ptr[offset], TRUE); }
756
121,336
0
virtual ~Context() {}
757
2,519
0
array_to_json_pretty(PG_FUNCTION_ARGS) { Datum array = PG_GETARG_DATUM(0); bool use_line_feeds = PG_GETARG_BOOL(1); StringInfo result; result = makeStringInfo(); array_to_json_internal(array, result, use_line_feeds); PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len)); }
758
167,378
0
void SetCookieStore(net::CookieStore* cookie_store) { cookie_store_ = cookie_store; }
759
83,203
0
COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, struct compat_siginfo __user *, uinfo, struct compat_timespec __user *, uts, compat_size_t, sigsetsize) { compat_sigset_t s32; sigset_t s; struct timespec t; siginfo_t info; long ret; if (sigsetsize != sizeof(sigset_t)) return -EINVAL; if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t))) return -EFAULT; sigset_from_compat(&s, &s32); if (uts) { if (compat_get_timespec(&t, uts)) return -EFAULT; } ret = do_sigtimedwait(&s, &info, uts ? &t : NULL); if (ret > 0 && uinfo) { if (copy_siginfo_to_user32(uinfo, &info)) ret = -EFAULT; } return ret; }
760
130,626
0
static void activityLoggedInIsolatedWorldsAttrSetterAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); TestObjectV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttributeSetterForMainWorld(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
761
107,928
0
void InfoBar::AnimationEnded(const ui::Animation* animation) { if (container_) { container_->InfoBarAnimated(false); if (!animation_->IsShowing()) Close(); } }
762
93,723
0
char *cJSON_PrintBuffered(cJSON *item,int prebuffer,int fmt) { printbuffer p; p.buffer=(char*)cJSON_malloc(prebuffer); p.length=prebuffer; p.offset=0; return print_value(item,0,fmt,&p); }
763
185,354
1
StateBase* writeBlob(v8::Handle<v8::Value> value, StateBase* next) { Blob* blob = V8Blob::toNative(value.As<v8::Object>()); if (!blob) return 0; if (blob->hasBeenClosed()) return handleError(DataCloneError, "A Blob object has been closed, and could therefore not be cloned.", next); int blobIndex = -1; m_blobDataHandles.add(blob->uuid(), blob->blobDataHandle()); if (appendBlobInfo(blob->uuid(), blob->type(), blob->size(), &blobIndex)) m_writer.writeBlobIndex(blobIndex); else m_writer.writeBlob(blob->uuid(), blob->type(), blob->size()); return 0; }
764
11,510
0
int close_pipe(int p[]) { int a = 0, b = 0; assert(p); if (p[0] >= 0) { a = close_nointr(p[0]); p[0] = -1; } if (p[1] >= 0) { b = close_nointr(p[1]); p[1] = -1; } return a < 0 ? a : b; }
765
39,683
0
static __always_inline void follow_dotdot(struct nameidata *nd) { set_root(nd); while(1) { struct vfsmount *parent; struct dentry *old = nd->path.dentry; if (nd->path.dentry == nd->root.dentry && nd->path.mnt == nd->root.mnt) { break; } spin_lock(&dcache_lock); if (nd->path.dentry != nd->path.mnt->mnt_root) { nd->path.dentry = dget(nd->path.dentry->d_parent); spin_unlock(&dcache_lock); dput(old); break; } spin_unlock(&dcache_lock); spin_lock(&vfsmount_lock); parent = nd->path.mnt->mnt_parent; if (parent == nd->path.mnt) { spin_unlock(&vfsmount_lock); break; } mntget(parent); nd->path.dentry = dget(nd->path.mnt->mnt_mountpoint); spin_unlock(&vfsmount_lock); dput(old); mntput(nd->path.mnt); nd->path.mnt = parent; } follow_mount(&nd->path); }
766
8,537
0
static void ssh2_log_outgoing_packet(Ssh ssh, struct Packet *pkt) { int nblanks = 0; struct logblank_t blanks[4]; char *str; int slen; /* * For outgoing packets, pkt->length represents the length of the * whole packet starting at pkt->data (including some header), and * pkt->body refers to the point within that where the log-worthy * payload begins. However, incoming packets expect pkt->length to * represent only the payload length (that is, it's measured from * pkt->body not from pkt->data). Temporarily adjust our outgoing * packet to conform to the incoming-packet semantics, so that we * can analyse it with the ssh_pkt_get functions. */ pkt->length -= (pkt->body - pkt->data); pkt->savedpos = 0; if (ssh->logomitdata && (pkt->type == SSH2_MSG_CHANNEL_DATA || pkt->type == SSH2_MSG_CHANNEL_EXTENDED_DATA)) { /* "Session data" packets - omit the data string. */ ssh_pkt_getuint32(pkt); /* skip channel id */ if (pkt->type == SSH2_MSG_CHANNEL_EXTENDED_DATA) ssh_pkt_getuint32(pkt); /* skip extended data type */ blanks[nblanks].offset = pkt->savedpos + 4; blanks[nblanks].type = PKTLOG_OMIT; ssh_pkt_getstring(pkt, &str, &slen); if (str) { blanks[nblanks].len = slen; nblanks++; } } if (pkt->type == SSH2_MSG_USERAUTH_REQUEST && conf_get_int(ssh->conf, CONF_logomitpass)) { /* If this is a password packet, blank the password(s). */ pkt->savedpos = 0; ssh_pkt_getstring(pkt, &str, &slen); ssh_pkt_getstring(pkt, &str, &slen); ssh_pkt_getstring(pkt, &str, &slen); if (slen == 8 && !memcmp(str, "password", 8)) { ssh2_pkt_getbool(pkt); /* Blank the password field. */ blanks[nblanks].offset = pkt->savedpos; blanks[nblanks].type = PKTLOG_BLANK; ssh_pkt_getstring(pkt, &str, &slen); if (str) { blanks[nblanks].len = pkt->savedpos - blanks[nblanks].offset; nblanks++; /* If there's another password field beyond it (change of * password), blank that too. */ ssh_pkt_getstring(pkt, &str, &slen); if (str) blanks[nblanks-1].len = pkt->savedpos - blanks[nblanks].offset; } } } else if (ssh->pkt_actx == SSH2_PKTCTX_KBDINTER && pkt->type == SSH2_MSG_USERAUTH_INFO_RESPONSE && conf_get_int(ssh->conf, CONF_logomitpass)) { /* If this is a keyboard-interactive response packet, blank * the responses. */ pkt->savedpos = 0; ssh_pkt_getuint32(pkt); blanks[nblanks].offset = pkt->savedpos; blanks[nblanks].type = PKTLOG_BLANK; while (1) { ssh_pkt_getstring(pkt, &str, &slen); if (!str) break; } blanks[nblanks].len = pkt->savedpos - blanks[nblanks].offset; nblanks++; } else if (pkt->type == SSH2_MSG_CHANNEL_REQUEST && conf_get_int(ssh->conf, CONF_logomitpass)) { /* * If this is an X forwarding request packet, blank the fake * auth data. * * Note that while we blank the X authentication data here, we * don't take any special action to blank the start of an X11 * channel, so using MIT-MAGIC-COOKIE-1 and actually opening * an X connection without having session blanking enabled is * likely to leak your cookie into the log. */ pkt->savedpos = 0; ssh_pkt_getuint32(pkt); ssh_pkt_getstring(pkt, &str, &slen); if (slen == 7 && !memcmp(str, "x11-req", 0)) { ssh2_pkt_getbool(pkt); ssh2_pkt_getbool(pkt); ssh_pkt_getstring(pkt, &str, &slen); blanks[nblanks].offset = pkt->savedpos; blanks[nblanks].type = PKTLOG_BLANK; ssh_pkt_getstring(pkt, &str, &slen); if (str) { blanks[nblanks].len = pkt->savedpos - blanks[nblanks].offset; nblanks++; } } } log_packet(ssh->logctx, PKT_OUTGOING, pkt->data[5], ssh2_pkt_type(ssh->pkt_kctx, ssh->pkt_actx, pkt->data[5]), pkt->body, pkt->length, nblanks, blanks, &ssh->v2_outgoing_sequence, pkt->downstream_id, pkt->additional_log_text); /* * Undo the above adjustment of pkt->length, to put the packet * back in the state we found it. */ pkt->length += (pkt->body - pkt->data); }
767
187,723
1
standard_row_validate(standard_display *dp, png_const_structp pp, int iImage, int iDisplay, png_uint_32 y) { int where; png_byte std[STANDARD_ROWMAX]; /* The row must be pre-initialized to the magic number here for the size * tests to pass: */ memset(std, 178, sizeof std); standard_row(pp, std, dp->id, y); /* At the end both the 'row' and 'display' arrays should end up identical. * In earlier passes 'row' will be partially filled in, with only the pixels * that have been read so far, but 'display' will have those pixels * replicated to fill the unread pixels while reading an interlaced image. #if PNG_LIBPNG_VER < 10506 * The side effect inside the libpng sequential reader is that the 'row' * array retains the correct values for unwritten pixels within the row * bytes, while the 'display' array gets bits off the end of the image (in * the last byte) trashed. Unfortunately in the progressive reader the * row bytes are always trashed, so we always do a pixel_cmp here even though * a memcmp of all cbRow bytes will succeed for the sequential reader. #endif */ if (iImage >= 0 && (where = pixel_cmp(std, store_image_row(dp->ps, pp, iImage, y), dp->bit_width)) != 0) { char msg[64]; sprintf(msg, "PNG image row[%lu][%d] changed from %.2x to %.2x", (unsigned long)y, where-1, std[where-1], store_image_row(dp->ps, pp, iImage, y)[where-1]); png_error(pp, msg); } #if PNG_LIBPNG_VER < 10506 /* In this case use pixel_cmp because we need to compare a partial * byte at the end of the row if the row is not an exact multiple * of 8 bits wide. (This is fixed in libpng-1.5.6 and pixel_cmp is * changed to match!) * #endif if (iDisplay >= 0 && (where = pixel_cmp(std, store_image_row(dp->ps, pp, iDisplay, y), dp->bit_width)) != 0) { char msg[64]; sprintf(msg, "display row[%lu][%d] changed from %.2x to %.2x", (unsigned long)y, where-1, std[where-1], store_image_row(dp->ps, pp, iDisplay, y)[where-1]); png_error(pp, msg); } }
768
167,959
0
LocalFrame::PrefetchURLLoaderService() { if (!prefetch_loader_service_ && base::FeatureList::IsEnabled(network::features::kNetworkService)) { GetInterfaceProvider().GetInterface( mojo::MakeRequest(&prefetch_loader_service_)); } return prefetch_loader_service_.get(); }
769
54,110
0
static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh, u32 portid) { struct sk_buff *skb; u32 seq = nlh ? nlh->nlmsg_seq : 0; int err = -ENOBUFS; struct net *net; net = dev_net(ifa->ifa_dev->dev); skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); if (!skb) goto errout; err = inet_fill_ifaddr(skb, ifa, portid, seq, event, 0); if (err < 0) { /* -EMSGSIZE implies BUG in inet_nlmsg_size() */ WARN_ON(err == -EMSGSIZE); kfree_skb(skb); goto errout; } rtnl_notify(skb, net, portid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL); return; errout: if (err < 0) rtnl_set_sk_err(net, RTNLGRP_IPV4_IFADDR, err); }
770
183,662
1
const base::Time& BaseNode::GetModificationTime() const { return GetEntry()->Get(syncable::MTIME); }
771
100,513
0
void Cache::removeFromLiveResourcesSize(CachedResource* resource) { m_liveSize -= resource->size(); m_deadSize += resource->size(); }
772
97,435
0
void FrameLoader::loadArchive(PassRefPtr<Archive> prpArchive) { RefPtr<Archive> archive = prpArchive; ArchiveResource* mainResource = archive->mainResource(); ASSERT(mainResource); if (!mainResource) return; SubstituteData substituteData(mainResource->data(), mainResource->mimeType(), mainResource->textEncoding(), KURL()); ResourceRequest request(mainResource->url()); #if PLATFORM(MAC) request.applyWebArchiveHackForMail(); #endif RefPtr<DocumentLoader> documentLoader = m_client->createDocumentLoader(request, substituteData); documentLoader->addAllArchiveResources(archive.get()); load(documentLoader.get()); }
773
29,627
0
static void sctp_inet6_skb_msgname(struct sk_buff *skb, char *msgname, int *addr_len) { struct sctphdr *sh; struct sockaddr_in6 *sin6; if (msgname) { sctp_inet6_msgname(msgname, addr_len); sin6 = (struct sockaddr_in6 *)msgname; sh = sctp_hdr(skb); sin6->sin6_port = sh->source; /* Map ipv4 address into v4-mapped-on-v6 address. */ if (sctp_sk(skb->sk)->v4mapped && ip_hdr(skb)->version == 4) { sctp_v4_map_v6((union sctp_addr *)sin6); sin6->sin6_addr.s6_addr32[3] = ip_hdr(skb)->saddr; return; } /* Otherwise, just copy the v6 address. */ sin6->sin6_addr = ipv6_hdr(skb)->saddr; if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) { struct sctp_ulpevent *ev = sctp_skb2event(skb); sin6->sin6_scope_id = ev->iif; } } }
774
44,790
0
local void finish_jobs(void) { struct job job; int caught; /* only do this once */ if (compress_have == NULL) return; /* command all of the extant compress threads to return */ possess(compress_have); job.seq = -1; job.next = NULL; compress_head = &job; compress_tail = &(job.next); twist(compress_have, BY, +1); /* will wake them all up */ /* join all of the compress threads, verify they all came back */ caught = join_all(); Trace(("-- joined %d compress threads", caught)); assert(caught == cthreads); cthreads = 0; /* free the resources */ caught = free_pool(&lens_pool); Trace(("-- freed %d block lengths buffers", caught)); caught = free_pool(&dict_pool); Trace(("-- freed %d dictionary buffers", caught)); caught = free_pool(&out_pool); Trace(("-- freed %d output buffers", caught)); caught = free_pool(&in_pool); Trace(("-- freed %d input buffers", caught)); free_lock(write_first); free_lock(compress_have); compress_have = NULL; }
775
111,446
0
void InputHandler::clearField() { if (!isActiveTextEdit()) return; ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame() && m_currentFocusElement->document()->frame()->editor()); Editor* editor = m_currentFocusElement->document()->frame()->editor(); editor->command("SelectAll").execute(); editor->command("DeleteBackward").execute(); }
776
91,172
0
static int readWordFromBuffer(char **s, ssize_t *len) { unsigned char buffer[2]; int i, c; for (i=0; i<2; i++) { c = *(*s)++; (*len)--; if (*len < 0) return -1; buffer[i] = (unsigned char) c; } return (((int) buffer[ 0 ]) << 8) | (((int) buffer[ 1 ])); }
777
123,723
0
bool CopyFile(const FilePath& from_path, const FilePath& to_path) { base::ThreadRestrictions::AssertIOAllowed(); int infile = HANDLE_EINTR(open(from_path.value().c_str(), O_RDONLY)); if (infile < 0) return false; int outfile = HANDLE_EINTR(creat(to_path.value().c_str(), 0666)); if (outfile < 0) { ignore_result(HANDLE_EINTR(close(infile))); return false; } const size_t kBufferSize = 32768; std::vector<char> buffer(kBufferSize); bool result = true; while (result) { ssize_t bytes_read = HANDLE_EINTR(read(infile, &buffer[0], buffer.size())); if (bytes_read < 0) { result = false; break; } if (bytes_read == 0) break; ssize_t bytes_written_per_read = 0; do { ssize_t bytes_written_partial = HANDLE_EINTR(write( outfile, &buffer[bytes_written_per_read], bytes_read - bytes_written_per_read)); if (bytes_written_partial < 0) { result = false; break; } bytes_written_per_read += bytes_written_partial; } while (bytes_written_per_read < bytes_read); } if (HANDLE_EINTR(close(infile)) < 0) result = false; if (HANDLE_EINTR(close(outfile)) < 0) result = false; return result; }
778
143,114
0
const OriginAccessEntry& Document::accessEntryFromURL() { if (!m_accessEntryFromURL) { m_accessEntryFromURL = wrapUnique(new OriginAccessEntry(url().protocol(), url().host(), OriginAccessEntry::AllowRegisterableDomains)); } return *m_accessEntryFromURL; }
779
136,177
0
void Document::setURL(const KURL& url) { const KURL& newURL = url.isEmpty() ? blankURL() : url; if (newURL == m_url) return; m_url = newURL; updateBaseURL(); contextFeatures().urlDidChange(this); }
780
107,961
0
AlertInfoBar::~AlertInfoBar() { }
781
69,419
0
cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, struct inode *inode, const char *path, const struct cifs_fid *pfid) { struct cifs_ntsd *pntsd = NULL; u32 acllen = 0; int rc = 0; struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); struct cifs_tcon *tcon; cifs_dbg(NOISY, "converting ACL to mode for %s\n", path); if (IS_ERR(tlink)) return PTR_ERR(tlink); tcon = tlink_tcon(tlink); if (pfid && (tcon->ses->server->ops->get_acl_by_fid)) pntsd = tcon->ses->server->ops->get_acl_by_fid(cifs_sb, pfid, &acllen); else if (tcon->ses->server->ops->get_acl) pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, &acllen); else { cifs_put_tlink(tlink); return -EOPNOTSUPP; } /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ if (IS_ERR(pntsd)) { rc = PTR_ERR(pntsd); cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); } else { rc = parse_sec_desc(cifs_sb, pntsd, acllen, fattr); kfree(pntsd); if (rc) cifs_dbg(VFS, "parse sec desc failed rc = %d\n", rc); } cifs_put_tlink(tlink); return rc; }
782
27,369
0
static void ecryptfs_kill_block_super(struct super_block *sb) { struct ecryptfs_sb_info *sb_info = ecryptfs_superblock_to_private(sb); kill_anon_super(sb); if (!sb_info) return; ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); bdi_destroy(&sb_info->bdi); kmem_cache_free(ecryptfs_sb_info_cache, sb_info); }
783
141,634
0
bool IsNewNode(const AXNode* node) { return new_nodes.find(node) != new_nodes.end(); }
784
69,248
0
DECLAREwriteFunc(writeBufferToSeparateTiles) { uint32 imagew = TIFFScanlineSize(out); tsize_t tilew = TIFFTileRowSize(out); uint32 iimagew = TIFFRasterScanlineSize(out); int iskew = iimagew - tilew*spp; tsize_t tilesize = TIFFTileSize(out); tdata_t obuf; uint8* bufp = (uint8*) buf; uint32 tl, tw; uint32 row; uint16 bps = 0, bytes_per_sample; obuf = _TIFFmalloc(TIFFTileSize(out)); if (obuf == NULL) return 0; _TIFFmemset(obuf, 0, tilesize); (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl); (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw); (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps); if( bps == 0 ) { TIFFError(TIFFFileName(out), "Error, cannot read BitsPerSample"); _TIFFfree(obuf); return 0; } if( (bps % 8) != 0 ) { TIFFError(TIFFFileName(out), "Error, cannot handle BitsPerSample that is not a multiple of 8"); _TIFFfree(obuf); return 0; } bytes_per_sample = bps/8; for (row = 0; row < imagelength; row += tl) { uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl; uint32 colb = 0; uint32 col; for (col = 0; col < imagewidth; col += tw) { tsample_t s; for (s = 0; s < spp; s++) { /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. */ if (colb + tilew > imagew) { uint32 width = (imagew - colb); int oskew = tilew - width; cpContigBufToSeparateBuf(obuf, bufp + (colb*spp) + s, nrow, width/bytes_per_sample, oskew, (oskew*spp)+iskew, spp, bytes_per_sample); } else cpContigBufToSeparateBuf(obuf, bufp + (colb*spp) + s, nrow, tilewidth, 0, iskew, spp, bytes_per_sample); if (TIFFWriteTile(out, obuf, col, row, 0, s) < 0) { TIFFError(TIFFFileName(out), "Error, can't write tile at %lu %lu " "sample %lu", (unsigned long) col, (unsigned long) row, (unsigned long) s); _TIFFfree(obuf); return 0; } } colb += tilew; } bufp += nrow * iimagew; } _TIFFfree(obuf); return 1; }
785
40,507
0
static void free_pg_vec(void **pg_vec, unsigned int order, unsigned int len) { unsigned int i; for (i = 0; i < len; i++) { if (pg_vec[i] != NULL) { if (is_vmalloc_addr(pg_vec[i])) vfree(pg_vec[i]); else free_pages((unsigned long)pg_vec[i], order); } } kfree(pg_vec); }
786
55,676
0
static void try_to_wake_up_local(struct task_struct *p, struct pin_cookie cookie) { struct rq *rq = task_rq(p); if (WARN_ON_ONCE(rq != this_rq()) || WARN_ON_ONCE(p == current)) return; lockdep_assert_held(&rq->lock); if (!raw_spin_trylock(&p->pi_lock)) { /* * This is OK, because current is on_cpu, which avoids it being * picked for load-balance and preemption/IRQs are still * disabled avoiding further scheduler activity on it and we've * not yet picked a replacement task. */ lockdep_unpin_lock(&rq->lock, cookie); raw_spin_unlock(&rq->lock); raw_spin_lock(&p->pi_lock); raw_spin_lock(&rq->lock); lockdep_repin_lock(&rq->lock, cookie); } if (!(p->state & TASK_NORMAL)) goto out; trace_sched_waking(p); if (!task_on_rq_queued(p)) ttwu_activate(rq, p, ENQUEUE_WAKEUP); ttwu_do_wakeup(rq, p, 0, cookie); if (schedstat_enabled()) ttwu_stat(p, smp_processor_id(), 0); out: raw_spin_unlock(&p->pi_lock); }
787
44,182
0
CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, unsigned int flags) { CMS_ContentInfo *cms; if (!md) md = EVP_sha1(); cms = cms_DigestedData_create(md); if (!cms) return NULL; if(!(flags & CMS_DETACHED)) CMS_set_detached(cms, 0); if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) return cms; CMS_ContentInfo_free(cms); return NULL; }
788
35,882
0
struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, struct sctp_chunk *asconf) { sctp_addip_chunk_t *addip = (sctp_addip_chunk_t *) asconf->chunk_hdr; bool all_param_pass = true; union sctp_params param; sctp_addiphdr_t *hdr; union sctp_addr_param *addr_param; sctp_addip_param_t *asconf_param; struct sctp_chunk *asconf_ack; __be16 err_code; int length = 0; int chunk_len; __u32 serial; chunk_len = ntohs(asconf->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); hdr = (sctp_addiphdr_t *)asconf->skb->data; serial = ntohl(hdr->serial); /* Skip the addiphdr and store a pointer to address parameter. */ length = sizeof(sctp_addiphdr_t); addr_param = (union sctp_addr_param *)(asconf->skb->data + length); chunk_len -= length; /* Skip the address parameter and store a pointer to the first * asconf parameter. */ length = ntohs(addr_param->p.length); asconf_param = (void *)addr_param + length; chunk_len -= length; /* create an ASCONF_ACK chunk. * Based on the definitions of parameters, we know that the size of * ASCONF_ACK parameters are less than or equal to the fourfold of ASCONF * parameters. */ asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 4); if (!asconf_ack) goto done; /* Process the TLVs contained within the ASCONF chunk. */ sctp_walk_params(param, addip, addip_hdr.params) { /* Skip preceeding address parameters. */ if (param.p->type == SCTP_PARAM_IPV4_ADDRESS || param.p->type == SCTP_PARAM_IPV6_ADDRESS) continue; err_code = sctp_process_asconf_param(asoc, asconf, param.addip); /* ADDIP 4.1 A7) * If an error response is received for a TLV parameter, * all TLVs with no response before the failed TLV are * considered successful if not reported. All TLVs after * the failed response are considered unsuccessful unless * a specific success indication is present for the parameter. */ if (err_code != SCTP_ERROR_NO_ERROR) all_param_pass = false; if (!all_param_pass) sctp_add_asconf_response(asconf_ack, param.addip->crr_id, err_code, param.addip); /* ADDIP 4.3 D11) When an endpoint receiving an ASCONF to add * an IP address sends an 'Out of Resource' in its response, it * MUST also fail any subsequent add or delete requests bundled * in the ASCONF. */ if (err_code == SCTP_ERROR_RSRC_LOW) goto done; } done: asoc->peer.addip_serial++; /* If we are sending a new ASCONF_ACK hold a reference to it in assoc * after freeing the reference to old asconf ack if any. */ if (asconf_ack) { sctp_chunk_hold(asconf_ack); list_add_tail(&asconf_ack->transmitted_list, &asoc->asconf_ack_list); } return asconf_ack; }
789
38,778
0
makepol(WORKSTATE *state) { int32 val, type; int32 stack[STACKDEPTH]; int32 lenstack = 0; /* since this function recurses, it could be driven to stack overflow */ check_stack_depth(); while ((type = gettoken(state, &val)) != END) { switch (type) { case VAL: pushquery(state, type, val); while (lenstack && (stack[lenstack - 1] == (int32) '&' || stack[lenstack - 1] == (int32) '!')) { lenstack--; pushquery(state, OPR, stack[lenstack]); } break; case OPR: if (lenstack && val == (int32) '|') pushquery(state, OPR, val); else { if (lenstack == STACKDEPTH) ereport(ERROR, (errcode(ERRCODE_STATEMENT_TOO_COMPLEX), errmsg("statement too complex"))); stack[lenstack] = val; lenstack++; } break; case OPEN: if (makepol(state) == ERR) return ERR; while (lenstack && (stack[lenstack - 1] == (int32) '&' || stack[lenstack - 1] == (int32) '!')) { lenstack--; pushquery(state, OPR, stack[lenstack]); } break; case CLOSE: while (lenstack) { lenstack--; pushquery(state, OPR, stack[lenstack]); }; return END; break; case ERR: default: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("syntax error"))); return ERR; } } while (lenstack) { lenstack--; pushquery(state, OPR, stack[lenstack]); }; return END; }
790
46,007
0
devzvol_make_dsname(const char *path, const char *name) { char *dsname; const char *ptr; int dslen; if (strcmp(path, ZVOL_DIR) == 0) return (NULL); if (name && (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)) return (NULL); ptr = path + strlen(ZVOL_DIR); if (strncmp(ptr, "/dsk", 4) == 0) ptr += strlen("/dsk"); else if (strncmp(ptr, "/rdsk", 5) == 0) ptr += strlen("/rdsk"); else return (NULL); if (*ptr == '/') ptr++; dslen = strlen(ptr); if (dslen) dslen++; /* plus null */ if (name) dslen += strlen(name) + 1; /* plus slash */ dsname = kmem_zalloc(dslen, KM_SLEEP); if (*ptr) { (void) strlcpy(dsname, ptr, dslen); if (name) (void) strlcat(dsname, "/", dslen); } if (name) (void) strlcat(dsname, name, dslen); return (dsname); }
791
98,224
0
static void AdjustLinuxOOMScore(const std::string& process_type) { const int kMiscScore = 7; const int kPluginScore = 10; int score = -1; if (process_type == switches::kPluginProcess) { score = kPluginScore; } else if (process_type == switches::kUtilityProcess || process_type == switches::kWorkerProcess || process_type == switches::kGpuProcess || process_type == switches::kServiceProcess) { score = kMiscScore; } else if (process_type == switches::kProfileImportProcess) { NOTIMPLEMENTED(); #ifndef DISABLE_NACL } else if (process_type == switches::kNaClLoaderProcess) { score = kPluginScore; #endif } else if (process_type == switches::kZygoteProcess || process_type.empty()) { } else if (process_type == switches::kExtensionProcess || process_type == switches::kRendererProcess) { LOG(WARNING) << "process type '" << process_type << "' " << "should go through the zygote."; return; } else { NOTREACHED() << "Unknown process type"; } if (score > -1) base::AdjustOOMScore(base::GetCurrentProcId(), score); }
792
118,584
0
void AppLauncherHandler::ExtensionEnableFlowFinished() { DCHECK_EQ(extension_id_prompting_, extension_enable_flow_->extension_id()); base::StringValue app_id(extension_id_prompting_); web_ui()->CallJavascriptFunction("ntp.launchAppAfterEnable", app_id); extension_enable_flow_.reset(); extension_id_prompting_ = ""; }
793
87,002
0
static void register_shm(struct thread_smc_args *smc_args, struct optee_msg_arg *arg, uint32_t num_params) { arg->ret = TEE_ERROR_BAD_PARAMETERS; smc_args->a0 = OPTEE_SMC_RETURN_OK; if (num_params != 1 || (arg->params[0].attr != (OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT | OPTEE_MSG_ATTR_NONCONTIG))) return; struct optee_msg_param_tmem *tmem = &arg->params[0].u.tmem; struct mobj *mobj = msg_param_mobj_from_noncontig(tmem->buf_ptr, tmem->size, tmem->shm_ref, false); if (!mobj) return; mobj_reg_shm_unguard(mobj); arg->ret = TEE_SUCCESS; }
794
97,926
0
void RenderView::OnAutoFillFormDataFilled(int query_id, const webkit_glue::FormData& form) { autofill_helper_.FormDataFilled(query_id, form); }
795
123,265
0
RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { if (!shared_surface_handle_.is_null()) { ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); factory->DestroySharedSurfaceHandle(shared_surface_handle_); factory->RemoveObserver(this); } window_->RemoveObserver(window_observer_.get()); UnlockMouse(); if (popup_type_ != WebKit::WebPopupTypeNone && popup_parent_host_view_) { DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || popup_parent_host_view_->popup_child_host_view_ == this); popup_parent_host_view_->popup_child_host_view_ = NULL; } if (popup_child_host_view_) { DCHECK(popup_child_host_view_->popup_parent_host_view_ == NULL || popup_child_host_view_->popup_parent_host_view_ == this); popup_child_host_view_->popup_parent_host_view_ = NULL; } aura::client::SetTooltipText(window_, NULL); gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); DetachFromInputMethod(); }
796
66,410
0
static void gen_sse(CPUX86State *env, DisasContext *s, int b, target_ulong pc_start, int rex_r) { int b1, op1_offset, op2_offset, is_xmm, val; int modrm, mod, rm, reg; SSEFunc_0_epp sse_fn_epp; SSEFunc_0_eppi sse_fn_eppi; SSEFunc_0_ppi sse_fn_ppi; SSEFunc_0_eppt sse_fn_eppt; TCGMemOp ot; b &= 0xff; if (s->prefix & PREFIX_DATA) b1 = 1; else if (s->prefix & PREFIX_REPZ) b1 = 2; else if (s->prefix & PREFIX_REPNZ) b1 = 3; else b1 = 0; sse_fn_epp = sse_op_table1[b][b1]; if (!sse_fn_epp) { goto unknown_op; } if ((b <= 0x5f && b >= 0x10) || b == 0xc6 || b == 0xc2) { is_xmm = 1; } else { if (b1 == 0) { /* MMX case */ is_xmm = 0; } else { is_xmm = 1; } } /* simple MMX/SSE operation */ if (s->flags & HF_TS_MASK) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); return; } if (s->flags & HF_EM_MASK) { illegal_op: gen_illegal_opcode(s); return; } if (is_xmm && !(s->flags & HF_OSFXSR_MASK) && ((b != 0x38 && b != 0x3a) || (s->prefix & PREFIX_DATA))) { goto unknown_op; } if (b == 0x0e) { if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) { /* If we were fully decoding this we might use illegal_op. */ goto unknown_op; } /* femms */ gen_helper_emms(cpu_env); return; } if (b == 0x77) { /* emms */ gen_helper_emms(cpu_env); return; } /* prepare MMX state (XXX: optimize by storing fptt and fptags in the static cpu state) */ if (!is_xmm) { gen_helper_enter_mmx(cpu_env); } modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7); if (is_xmm) reg |= rex_r; mod = (modrm >> 6) & 3; if (sse_fn_epp == SSE_SPECIAL) { b |= (b1 << 8); switch(b) { case 0x0e7: /* movntq */ if (mod == 3) { goto illegal_op; } gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); break; case 0x1e7: /* movntdq */ case 0x02b: /* movntps */ case 0x12b: /* movntps */ if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); break; case 0x3f0: /* lddqu */ if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); break; case 0x22b: /* movntss */ case 0x32b: /* movntsd */ if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); if (b1 & 1) { gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(0))); gen_op_st_v(s, MO_32, cpu_T0, cpu_A0); } break; case 0x6e: /* movd mm, ea */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0); tcg_gen_st_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); } else #endif { gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); gen_helper_movl_mm_T0_mmx(cpu_ptr0, cpu_tmp2_i32); } break; case 0x16e: /* movd xmm, ea */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); gen_helper_movq_mm_T0_xmm(cpu_ptr0, cpu_T0); } else #endif { gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); gen_helper_movl_mm_T0_xmm(cpu_ptr0, cpu_tmp2_i32); } break; case 0x6f: /* movq mm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); } else { rm = (modrm & 7); tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx)); tcg_gen_st_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); } break; case 0x010: /* movups */ case 0x110: /* movupd */ case 0x028: /* movaps */ case 0x128: /* movapd */ case 0x16f: /* movdqa xmm, ea */ case 0x26f: /* movdqu xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movo(offsetof(CPUX86State,xmm_regs[reg]), offsetof(CPUX86State,xmm_regs[rm])); } break; case 0x210: /* movss xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0))); } break; case 0x310: /* movsd xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } break; case 0x012: /* movlps */ case 0x112: /* movlpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { /* movhlps */ rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(1))); } break; case 0x212: /* movsldup */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(2))); } gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); break; case 0x312: /* movddup */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); break; case 0x016: /* movhps */ case 0x116: /* movhpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(1))); } else { /* movlhps */ rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } break; case 0x216: /* movshdup */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(1))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(3))); } gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); break; case 0x178: case 0x378: { int bit_index, field_length; if (b1 == 1 && reg != 0) goto illegal_op; field_length = cpu_ldub_code(env, s->pc++) & 0x3F; bit_index = cpu_ldub_code(env, s->pc++) & 0x3F; tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); if (b1 == 1) gen_helper_extrq_i(cpu_env, cpu_ptr0, tcg_const_i32(bit_index), tcg_const_i32(field_length)); else gen_helper_insertq_i(cpu_env, cpu_ptr0, tcg_const_i32(bit_index), tcg_const_i32(field_length)); } break; case 0x7e: /* movd ea, mm */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { tcg_gen_ld_i64(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1); } else #endif { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx.MMX_L(0))); gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1); } break; case 0x17e: /* movd ea, xmm */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { tcg_gen_ld_i64(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1); } else #endif { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1); } break; case 0x27e: /* movq xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1))); break; case 0x7f: /* movq ea, mm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); } else { rm = (modrm & 7); gen_op_movq(offsetof(CPUX86State,fpregs[rm].mmx), offsetof(CPUX86State,fpregs[reg].mmx)); } break; case 0x011: /* movups */ case 0x111: /* movupd */ case 0x029: /* movaps */ case 0x129: /* movapd */ case 0x17f: /* movdqa ea, xmm */ case 0x27f: /* movdqu ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movo(offsetof(CPUX86State,xmm_regs[rm]), offsetof(CPUX86State,xmm_regs[reg])); } break; case 0x211: /* movss ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_op_st_v(s, MO_32, cpu_T0, cpu_A0); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); } break; case 0x311: /* movsd ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); } break; case 0x013: /* movlps */ case 0x113: /* movlpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { goto illegal_op; } break; case 0x017: /* movhps */ case 0x117: /* movhpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(1))); } else { goto illegal_op; } break; case 0x71: /* shift mm, im */ case 0x72: case 0x73: case 0x171: /* shift xmm, im */ case 0x172: case 0x173: if (b1 >= 2) { goto unknown_op; } val = cpu_ldub_code(env, s->pc++); if (is_xmm) { tcg_gen_movi_tl(cpu_T0, val); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(1))); op1_offset = offsetof(CPUX86State,xmm_t0); } else { tcg_gen_movi_tl(cpu_T0, val); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(1))); op1_offset = offsetof(CPUX86State,mmx_t0); } sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + (((modrm >> 3)) & 7)][b1]; if (!sse_fn_epp) { goto unknown_op; } if (is_xmm) { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op1_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x050: /* movmskps */ rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_movmskps(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x150: /* movmskpd */ rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_movmskpd(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x02a: /* cvtpi2ps */ case 0x12a: /* cvtpi2pd */ gen_helper_enter_mmx(cpu_env); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,mmx_t0); gen_ldq_env_A0(s, op2_offset); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } op1_offset = offsetof(CPUX86State,xmm_regs[reg]); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); switch(b >> 8) { case 0x0: gen_helper_cvtpi2ps(cpu_env, cpu_ptr0, cpu_ptr1); break; default: case 0x1: gen_helper_cvtpi2pd(cpu_env, cpu_ptr0, cpu_ptr1); break; } break; case 0x22a: /* cvtsi2ss */ case 0x32a: /* cvtsi2sd */ ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); op1_offset = offsetof(CPUX86State,xmm_regs[reg]); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); if (ot == MO_32) { SSEFunc_0_epi sse_fn_epi = sse_op_table3ai[(b >> 8) & 1]; tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); sse_fn_epi(cpu_env, cpu_ptr0, cpu_tmp2_i32); } else { #ifdef TARGET_X86_64 SSEFunc_0_epl sse_fn_epl = sse_op_table3aq[(b >> 8) & 1]; sse_fn_epl(cpu_env, cpu_ptr0, cpu_T0); #else goto illegal_op; #endif } break; case 0x02c: /* cvttps2pi */ case 0x12c: /* cvttpd2pi */ case 0x02d: /* cvtps2pi */ case 0x12d: /* cvtpd2pi */ gen_helper_enter_mmx(cpu_env); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,xmm_t0); gen_ldo_env_A0(s, op2_offset); } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } op1_offset = offsetof(CPUX86State,fpregs[reg & 7].mmx); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); switch(b) { case 0x02c: gen_helper_cvttps2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x12c: gen_helper_cvttpd2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x02d: gen_helper_cvtps2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x12d: gen_helper_cvtpd2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; } break; case 0x22c: /* cvttss2si */ case 0x32c: /* cvttsd2si */ case 0x22d: /* cvtss2si */ case 0x32d: /* cvtsd2si */ ot = mo_64_32(s->dflag); if (mod != 3) { gen_lea_modrm(env, s, modrm); if ((b >> 8) & 1) { gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.ZMM_Q(0))); } else { gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); } op2_offset = offsetof(CPUX86State,xmm_t0); } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset); if (ot == MO_32) { SSEFunc_i_ep sse_fn_i_ep = sse_op_table3bi[((b >> 7) & 2) | (b & 1)]; sse_fn_i_ep(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_T0, cpu_tmp2_i32); } else { #ifdef TARGET_X86_64 SSEFunc_l_ep sse_fn_l_ep = sse_op_table3bq[((b >> 7) & 2) | (b & 1)]; sse_fn_l_ep(cpu_T0, cpu_env, cpu_ptr0); #else goto illegal_op; #endif } gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0xc4: /* pinsrw */ case 0x1c4: s->rip_offset = 1; gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); val = cpu_ldub_code(env, s->pc++); if (b1) { val &= 7; tcg_gen_st16_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_W(val))); } else { val &= 3; tcg_gen_st16_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx.MMX_W(val))); } break; case 0xc5: /* pextrw */ case 0x1c5: if (mod != 3) goto illegal_op; ot = mo_64_32(s->dflag); val = cpu_ldub_code(env, s->pc++); if (b1) { val &= 7; rm = (modrm & 7) | REX_B(s); tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[rm].ZMM_W(val))); } else { val &= 3; rm = (modrm & 7); tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx.MMX_W(val))); } reg = ((modrm >> 3) & 7) | rex_r; gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x1d6: /* movq ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(1))); } break; case 0x2d6: /* movq2dq */ gen_helper_enter_mmx(cpu_env); rm = (modrm & 7); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,fpregs[rm].mmx)); gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1))); break; case 0x3d6: /* movdq2q */ gen_helper_enter_mmx(cpu_env); rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,fpregs[reg & 7].mmx), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); break; case 0xd7: /* pmovmskb */ case 0x1d7: if (mod != 3) goto illegal_op; if (b1) { rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_pmovmskb_xmm(cpu_tmp2_i32, cpu_env, cpu_ptr0); } else { rm = (modrm & 7); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx)); gen_helper_pmovmskb_mmx(cpu_tmp2_i32, cpu_env, cpu_ptr0); } reg = ((modrm >> 3) & 7) | rex_r; tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x138: case 0x038: b = modrm; if ((b & 0xf0) == 0xf0) { goto do_0f_38_fx; } modrm = cpu_ldub_code(env, s->pc++); rm = modrm & 7; reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (b1 >= 2) { goto unknown_op; } sse_fn_epp = sse_op_table6[b].op[b1]; if (!sse_fn_epp) { goto unknown_op; } if (!(s->cpuid_ext_features & sse_op_table6[b].ext_mask)) goto illegal_op; if (b1) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod == 3) { op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]); } else { op2_offset = offsetof(CPUX86State,xmm_t0); gen_lea_modrm(env, s, modrm); switch (b) { case 0x20: case 0x30: /* pmovsxbw, pmovzxbw */ case 0x23: case 0x33: /* pmovsxwd, pmovzxwd */ case 0x25: case 0x35: /* pmovsxdq, pmovzxdq */ gen_ldq_env_A0(s, op2_offset + offsetof(ZMMReg, ZMM_Q(0))); break; case 0x21: case 0x31: /* pmovsxbd, pmovzxbd */ case 0x24: case 0x34: /* pmovsxwq, pmovzxwq */ tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, op2_offset + offsetof(ZMMReg, ZMM_L(0))); break; case 0x22: case 0x32: /* pmovsxbq, pmovzxbq */ tcg_gen_qemu_ld_tl(cpu_tmp0, cpu_A0, s->mem_index, MO_LEUW); tcg_gen_st16_tl(cpu_tmp0, cpu_env, op2_offset + offsetof(ZMMReg, ZMM_W(0))); break; case 0x2a: /* movntqda */ gen_ldo_env_A0(s, op1_offset); return; default: gen_ldo_env_A0(s, op2_offset); } } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod == 3) { op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } else { op2_offset = offsetof(CPUX86State,mmx_t0); gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, op2_offset); } } if (sse_fn_epp == SSE_SPECIAL) { goto unknown_op; } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); if (b == 0x17) { set_cc_op(s, CC_OP_EFLAGS); } break; case 0x238: case 0x338: do_0f_38_fx: /* Various integer extensions at 0f 38 f[0-f]. */ b = modrm | (b1 << 8); modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; switch (b) { case 0x3f0: /* crc32 Gd,Eb */ case 0x3f1: /* crc32 Gd,Ey */ do_crc32: if (!(s->cpuid_ext_features & CPUID_EXT_SSE42)) { goto illegal_op; } if ((b & 0xff) == 0xf0) { ot = MO_8; } else if (s->dflag != MO_64) { ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32); } else { ot = MO_64; } tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[reg]); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); gen_helper_crc32(cpu_T0, cpu_tmp2_i32, cpu_T0, tcg_const_i32(8 << ot)); ot = mo_64_32(s->dflag); gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x1f0: /* crc32 or movbe */ case 0x1f1: /* For these insns, the f3 prefix is supposed to have priority over the 66 prefix, but that's not what we implement above setting b1. */ if (s->prefix & PREFIX_REPNZ) { goto do_crc32; } /* FALLTHRU */ case 0x0f0: /* movbe Gy,My */ case 0x0f1: /* movbe My,Gy */ if (!(s->cpuid_ext_features & CPUID_EXT_MOVBE)) { goto illegal_op; } if (s->dflag != MO_64) { ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32); } else { ot = MO_64; } gen_lea_modrm(env, s, modrm); if ((b & 1) == 0) { tcg_gen_qemu_ld_tl(cpu_T0, cpu_A0, s->mem_index, ot | MO_BE); gen_op_mov_reg_v(ot, reg, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_regs[reg], cpu_A0, s->mem_index, ot | MO_BE); } break; case 0x0f2: /* andn Gy, By, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); tcg_gen_andc_tl(cpu_T0, cpu_regs[s->vex_v], cpu_T0); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); break; case 0x0f7: /* bextr Gy, Ey, By */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); { TCGv bound, zero; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Extract START, and shift the operand. Shifts larger than operand size get zeros. */ tcg_gen_ext8u_tl(cpu_A0, cpu_regs[s->vex_v]); tcg_gen_shr_tl(cpu_T0, cpu_T0, cpu_A0); bound = tcg_const_tl(ot == MO_64 ? 63 : 31); zero = tcg_const_tl(0); tcg_gen_movcond_tl(TCG_COND_LEU, cpu_T0, cpu_A0, bound, cpu_T0, zero); tcg_temp_free(zero); /* Extract the LEN into a mask. Lengths larger than operand size get all ones. */ tcg_gen_extract_tl(cpu_A0, cpu_regs[s->vex_v], 8, 8); tcg_gen_movcond_tl(TCG_COND_LEU, cpu_A0, cpu_A0, bound, cpu_A0, bound); tcg_temp_free(bound); tcg_gen_movi_tl(cpu_T1, 1); tcg_gen_shl_tl(cpu_T1, cpu_T1, cpu_A0); tcg_gen_subi_tl(cpu_T1, cpu_T1, 1); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_T1); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); } break; case 0x0f5: /* bzhi Gy, Ey, By */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); tcg_gen_ext8u_tl(cpu_T1, cpu_regs[s->vex_v]); { TCGv bound = tcg_const_tl(ot == MO_64 ? 63 : 31); /* Note that since we're using BMILG (in order to get O cleared) we need to store the inverse into C. */ tcg_gen_setcond_tl(TCG_COND_LT, cpu_cc_src, cpu_T1, bound); tcg_gen_movcond_tl(TCG_COND_GT, cpu_T1, cpu_T1, bound, bound, cpu_T1); tcg_temp_free(bound); } tcg_gen_movi_tl(cpu_A0, -1); tcg_gen_shl_tl(cpu_A0, cpu_A0, cpu_T1); tcg_gen_andc_tl(cpu_T0, cpu_T0, cpu_A0); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_BMILGB + ot); break; case 0x3f6: /* mulx By, Gy, rdx, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); switch (ot) { default: tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_regs[R_EDX]); tcg_gen_mulu2_i32(cpu_tmp2_i32, cpu_tmp3_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_regs[s->vex_v], cpu_tmp2_i32); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp3_i32); break; #ifdef TARGET_X86_64 case MO_64: tcg_gen_mulu2_i64(cpu_T0, cpu_T1, cpu_T0, cpu_regs[R_EDX]); tcg_gen_mov_i64(cpu_regs[s->vex_v], cpu_T0); tcg_gen_mov_i64(cpu_regs[reg], cpu_T1); break; #endif } break; case 0x3f5: /* pdep Gy, By, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Note that by zero-extending the mask operand, we automatically handle zero-extending the result. */ if (ot == MO_64) { tcg_gen_mov_tl(cpu_T1, cpu_regs[s->vex_v]); } else { tcg_gen_ext32u_tl(cpu_T1, cpu_regs[s->vex_v]); } gen_helper_pdep(cpu_regs[reg], cpu_T0, cpu_T1); break; case 0x2f5: /* pext Gy, By, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Note that by zero-extending the mask operand, we automatically handle zero-extending the result. */ if (ot == MO_64) { tcg_gen_mov_tl(cpu_T1, cpu_regs[s->vex_v]); } else { tcg_gen_ext32u_tl(cpu_T1, cpu_regs[s->vex_v]); } gen_helper_pext(cpu_regs[reg], cpu_T0, cpu_T1); break; case 0x1f6: /* adcx Gy, Ey */ case 0x2f6: /* adox Gy, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_ADX)) { goto illegal_op; } else { TCGv carry_in, carry_out, zero; int end_op; ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Re-use the carry-out from a previous round. */ TCGV_UNUSED(carry_in); carry_out = (b == 0x1f6 ? cpu_cc_dst : cpu_cc_src2); switch (s->cc_op) { case CC_OP_ADCX: if (b == 0x1f6) { carry_in = cpu_cc_dst; end_op = CC_OP_ADCX; } else { end_op = CC_OP_ADCOX; } break; case CC_OP_ADOX: if (b == 0x1f6) { end_op = CC_OP_ADCOX; } else { carry_in = cpu_cc_src2; end_op = CC_OP_ADOX; } break; case CC_OP_ADCOX: end_op = CC_OP_ADCOX; carry_in = carry_out; break; default: end_op = (b == 0x1f6 ? CC_OP_ADCX : CC_OP_ADOX); break; } /* If we can't reuse carry-out, get it out of EFLAGS. */ if (TCGV_IS_UNUSED(carry_in)) { if (s->cc_op != CC_OP_ADCX && s->cc_op != CC_OP_ADOX) { gen_compute_eflags(s); } carry_in = cpu_tmp0; tcg_gen_extract_tl(carry_in, cpu_cc_src, ctz32(b == 0x1f6 ? CC_C : CC_O), 1); } switch (ot) { #ifdef TARGET_X86_64 case MO_32: /* If we know TL is 64-bit, and we want a 32-bit result, just do everything in 64-bit arithmetic. */ tcg_gen_ext32u_i64(cpu_regs[reg], cpu_regs[reg]); tcg_gen_ext32u_i64(cpu_T0, cpu_T0); tcg_gen_add_i64(cpu_T0, cpu_T0, cpu_regs[reg]); tcg_gen_add_i64(cpu_T0, cpu_T0, carry_in); tcg_gen_ext32u_i64(cpu_regs[reg], cpu_T0); tcg_gen_shri_i64(carry_out, cpu_T0, 32); break; #endif default: /* Otherwise compute the carry-out in two steps. */ zero = tcg_const_tl(0); tcg_gen_add2_tl(cpu_T0, carry_out, cpu_T0, zero, carry_in, zero); tcg_gen_add2_tl(cpu_regs[reg], carry_out, cpu_regs[reg], carry_out, cpu_T0, zero); tcg_temp_free(zero); break; } set_cc_op(s, end_op); } break; case 0x1f7: /* shlx Gy, Ey, By */ case 0x2f7: /* sarx Gy, Ey, By */ case 0x3f7: /* shrx Gy, Ey, By */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); if (ot == MO_64) { tcg_gen_andi_tl(cpu_T1, cpu_regs[s->vex_v], 63); } else { tcg_gen_andi_tl(cpu_T1, cpu_regs[s->vex_v], 31); } if (b == 0x1f7) { tcg_gen_shl_tl(cpu_T0, cpu_T0, cpu_T1); } else if (b == 0x2f7) { if (ot != MO_64) { tcg_gen_ext32s_tl(cpu_T0, cpu_T0); } tcg_gen_sar_tl(cpu_T0, cpu_T0, cpu_T1); } else { if (ot != MO_64) { tcg_gen_ext32u_tl(cpu_T0, cpu_T0); } tcg_gen_shr_tl(cpu_T0, cpu_T0, cpu_T1); } gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x0f3: case 0x1f3: case 0x2f3: case 0x3f3: /* Group 17 */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); switch (reg & 7) { case 1: /* blsr By,Ey */ tcg_gen_neg_tl(cpu_T1, cpu_T0); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_T1); gen_op_mov_reg_v(ot, s->vex_v, cpu_T0); gen_op_update2_cc(); set_cc_op(s, CC_OP_BMILGB + ot); break; case 2: /* blsmsk By,Ey */ tcg_gen_mov_tl(cpu_cc_src, cpu_T0); tcg_gen_subi_tl(cpu_T0, cpu_T0, 1); tcg_gen_xor_tl(cpu_T0, cpu_T0, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s, CC_OP_BMILGB + ot); break; case 3: /* blsi By, Ey */ tcg_gen_mov_tl(cpu_cc_src, cpu_T0); tcg_gen_subi_tl(cpu_T0, cpu_T0, 1); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s, CC_OP_BMILGB + ot); break; default: goto unknown_op; } break; default: goto unknown_op; } break; case 0x03a: case 0x13a: b = modrm; modrm = cpu_ldub_code(env, s->pc++); rm = modrm & 7; reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (b1 >= 2) { goto unknown_op; } sse_fn_eppi = sse_op_table7[b].op[b1]; if (!sse_fn_eppi) { goto unknown_op; } if (!(s->cpuid_ext_features & sse_op_table7[b].ext_mask)) goto illegal_op; if (sse_fn_eppi == SSE_SPECIAL) { ot = mo_64_32(s->dflag); rm = (modrm & 7) | REX_B(s); if (mod != 3) gen_lea_modrm(env, s, modrm); reg = ((modrm >> 3) & 7) | rex_r; val = cpu_ldub_code(env, s->pc++); switch (b) { case 0x14: /* pextrb */ tcg_gen_ld8u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_B(val & 15))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_UB); } break; case 0x15: /* pextrw */ tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_W(val & 7))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_LEUW); } break; case 0x16: if (ot == MO_32) { /* pextrd */ tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); if (mod == 3) { tcg_gen_extu_i32_tl(cpu_regs[rm], cpu_tmp2_i32); } else { tcg_gen_qemu_st_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } } else { /* pextrq */ #ifdef TARGET_X86_64 tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(val & 1))); if (mod == 3) { tcg_gen_mov_i64(cpu_regs[rm], cpu_tmp1_i64); } else { tcg_gen_qemu_st_i64(cpu_tmp1_i64, cpu_A0, s->mem_index, MO_LEQ); } #else goto illegal_op; #endif } break; case 0x17: /* extractps */ tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_LEUL); } break; case 0x20: /* pinsrb */ if (mod == 3) { gen_op_mov_v_reg(MO_32, cpu_T0, rm); } else { tcg_gen_qemu_ld_tl(cpu_T0, cpu_A0, s->mem_index, MO_UB); } tcg_gen_st8_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_B(val & 15))); break; case 0x21: /* insertps */ if (mod == 3) { tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State,xmm_regs[rm] .ZMM_L((val >> 6) & 3))); } else { tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State,xmm_regs[reg] .ZMM_L((val >> 4) & 3))); if ((val >> 0) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(0))); if ((val >> 1) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(1))); if ((val >> 2) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(2))); if ((val >> 3) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(3))); break; case 0x22: if (ot == MO_32) { /* pinsrd */ if (mod == 3) { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[rm]); } else { tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); } else { /* pinsrq */ #ifdef TARGET_X86_64 if (mod == 3) { gen_op_mov_v_reg(ot, cpu_tmp1_i64, rm); } else { tcg_gen_qemu_ld_i64(cpu_tmp1_i64, cpu_A0, s->mem_index, MO_LEQ); } tcg_gen_st_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(val & 1))); #else goto illegal_op; #endif } break; } return; } if (b1) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod == 3) { op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]); } else { op2_offset = offsetof(CPUX86State,xmm_t0); gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, op2_offset); } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod == 3) { op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } else { op2_offset = offsetof(CPUX86State,mmx_t0); gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, op2_offset); } } val = cpu_ldub_code(env, s->pc++); if ((b & 0xfc) == 0x60) { /* pcmpXstrX */ set_cc_op(s, CC_OP_EFLAGS); if (s->dflag == MO_64) { /* The helper must use entire 64-bit gp registers */ val |= 1 << 8; } } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_eppi(cpu_env, cpu_ptr0, cpu_ptr1, tcg_const_i32(val)); break; case 0x33a: /* Various integer extensions at 0f 3a f[0-f]. */ b = modrm | (b1 << 8); modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; switch (b) { case 0x3f0: /* rorx Gy,Ey, Ib */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); b = cpu_ldub_code(env, s->pc++); if (ot == MO_64) { tcg_gen_rotri_tl(cpu_T0, cpu_T0, b & 63); } else { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); tcg_gen_rotri_i32(cpu_tmp2_i32, cpu_tmp2_i32, b & 31); tcg_gen_extu_i32_tl(cpu_T0, cpu_tmp2_i32); } gen_op_mov_reg_v(ot, reg, cpu_T0); break; default: goto unknown_op; } break; default: unknown_op: gen_unknown_opcode(env, s); return; } } else { /* generic MMX or SSE operation */ switch(b) { case 0x70: /* pshufx insn */ case 0xc6: /* pshufx insn */ case 0xc2: /* compare insns */ s->rip_offset = 1; break; default: break; } if (is_xmm) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod != 3) { int sz = 4; gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,xmm_t0); switch (b) { case 0x50 ... 0x5a: case 0x5c ... 0x5f: case 0xc2: /* Most sse scalar operations. */ if (b1 == 2) { sz = 2; } else if (b1 == 3) { sz = 3; } break; case 0x2e: /* ucomis[sd] */ case 0x2f: /* comis[sd] */ if (b1 == 0) { sz = 2; } else { sz = 3; } break; } switch (sz) { case 2: /* 32 bit access */ gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); break; case 3: /* 64 bit access */ gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.ZMM_D(0))); break; default: /* 128 bit access */ gen_ldo_env_A0(s, op2_offset); break; } } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,mmx_t0); gen_ldq_env_A0(s, op2_offset); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } } switch(b) { case 0x0f: /* 3DNow! data insns */ val = cpu_ldub_code(env, s->pc++); sse_fn_epp = sse_op_table5[val]; if (!sse_fn_epp) { goto unknown_op; } if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) { goto illegal_op; } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x70: /* pshufx insn */ case 0xc6: /* pshufx insn */ val = cpu_ldub_code(env, s->pc++); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); /* XXX: introduce a new table? */ sse_fn_ppi = (SSEFunc_0_ppi)sse_fn_epp; sse_fn_ppi(cpu_ptr0, cpu_ptr1, tcg_const_i32(val)); break; case 0xc2: /* compare insns */ val = cpu_ldub_code(env, s->pc++); if (val >= 8) goto unknown_op; sse_fn_epp = sse_op_table4[val][b1]; tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0xf7: /* maskmov : we must prepare A0 */ if (mod != 3) goto illegal_op; tcg_gen_mov_tl(cpu_A0, cpu_regs[R_EDI]); gen_extu(s->aflag, cpu_A0); gen_add_A0_ds_seg(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); /* XXX: introduce a new table? */ sse_fn_eppt = (SSEFunc_0_eppt)sse_fn_epp; sse_fn_eppt(cpu_env, cpu_ptr0, cpu_ptr1, cpu_A0); break; default: tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; } if (b == 0x2e || b == 0x2f) { set_cc_op(s, CC_OP_EFLAGS); } } }
797
10,279
0
ft_lookup_glyph_renderer( FT_GlyphSlot slot ) { FT_Face face = slot->face; FT_Library library = FT_FACE_LIBRARY( face ); FT_Renderer result = library->cur_renderer; if ( !result || result->glyph_format != slot->format ) result = FT_Lookup_Renderer( library, slot->format, 0 ); return result; }
798
91,916
0
f_midi_complete(struct usb_ep *ep, struct usb_request *req) { struct f_midi *midi = ep->driver_data; struct usb_composite_dev *cdev = midi->func.config->cdev; int status = req->status; switch (status) { case 0: /* normal completion */ if (ep == midi->out_ep) { /* We received stuff. req is queued again, below */ f_midi_handle_out_data(ep, req); } else if (ep == midi->in_ep) { /* Our transmit completed. See if there's more to go. * f_midi_transmit eats req, don't queue it again. */ req->length = 0; f_midi_transmit(midi); return; } break; /* this endpoint is normally active while we're configured */ case -ECONNABORTED: /* hardware forced ep reset */ case -ECONNRESET: /* request dequeued */ case -ESHUTDOWN: /* disconnect from host */ VDBG(cdev, "%s gone (%d), %d/%d\n", ep->name, status, req->actual, req->length); if (ep == midi->out_ep) { f_midi_handle_out_data(ep, req); /* We don't need to free IN requests because it's handled * by the midi->in_req_fifo. */ free_ep_req(ep, req); } return; case -EOVERFLOW: /* buffer overrun on read means that * we didn't provide a big enough buffer. */ default: DBG(cdev, "%s complete --> %d, %d/%d\n", ep->name, status, req->actual, req->length); break; case -EREMOTEIO: /* short read */ break; } status = usb_ep_queue(ep, req, GFP_ATOMIC); if (status) { ERROR(cdev, "kill %s: resubmit %d bytes --> %d\n", ep->name, req->length, status); usb_ep_set_halt(ep); /* FIXME recover later ... somehow */ } }
799