本文整理汇总了C++中MobiCoreDevice::checkLoad方法的典型用法代码示例。如果您正苦于以下问题:C++ MobiCoreDevice::checkLoad方法的具体用法?C++ MobiCoreDevice::checkLoad怎么用?C++ MobiCoreDevice::checkLoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MobiCoreDevice
的用法示例。
在下文中一共展示了MobiCoreDevice::checkLoad方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processLoadCheck
//------------------------------------------------------------------------------
mcResult_t MobiCoreDriverDaemon::processLoadCheck(mcSpid_t spid, void *blob, uint32_t size)
{
// Device required
MobiCoreDevice *device = getDevice(MC_DEVICE_ID_DEFAULT);
if (device == NULL) {
LOG_E(" No device found");
return MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN;
}
// Get service blob from registry
regObject_t *regObj = mcRegistryMemGetServiceBlob(spid, blob, size);
if (NULL == regObj) {
LOG_E(" mcRegistryMemGetServiceBlob failed");
return MC_DRV_ERR_TRUSTLET_NOT_FOUND;
}
if (regObj->len == 0) {
free(regObj);
LOG_E("mcRegistryMemGetServiceBlob returned registry object with length equal to zero");
return MC_DRV_ERR_TRUSTLET_NOT_FOUND;
}
LOG_I(" Sharing Service loaded at %p with Secure World", (addr_t)(regObj->value));
CWsm_ptr pWsm = device->registerWsmL2((addr_t)(regObj->value), regObj->len, 0);
if (pWsm == NULL) {
// Free memory occupied by Trustlet data
free(regObj);
LOG_E("allocating WSM for Trustlet failed");
return MC_DRV_ERR_DAEMON_KMOD_ERROR;
}
// Initialize information data of open session command
loadDataOpenSession_t loadDataOpenSession;
loadDataOpenSession.baseAddr = pWsm->physAddr;
loadDataOpenSession.offs = ((uintptr_t) regObj->value) & 0xFFF;
loadDataOpenSession.len = regObj->len;
loadDataOpenSession.tlHeader = (mclfHeader_ptr) (regObj->value + regObj->tlStartOffset);
mcDrvRspOpenSession_t rspOpenSession;
mcResult_t ret = device->checkLoad(
&loadDataOpenSession,
&rspOpenSession.payload);
// Unregister physical memory from kernel module.
LOG_I(" Service buffer was copied to Secure world and processed. Stop sharing of buffer.");
// This will also destroy the WSM object.
if (!device->unregisterWsmL2(pWsm)) {
// Free memory occupied by Trustlet data
free(regObj);
LOG_E("deallocating WSM for Trustlet failed");
return MC_DRV_ERR_DAEMON_KMOD_ERROR;
}
// Free memory occupied by Trustlet data
free(regObj);
if (ret != MC_DRV_OK) {
LOG_E("TA could not be loaded.");
return ret;
} else {
return MC_DRV_OK;
}
}