HRESULT Library_spot_native_Microsoft_SPOT_Reflection::GetAssemblyInfo___STATIC__BOOLEAN__SZARRAY_U1__MicrosoftSPOTReflectionAssemblyInfo( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* array = NULL; CLR_RT_Assembly* assm = NULL; CLR_RECORD_ASSEMBLY* header; array = stack.Arg0().DereferenceArray(); FAULT_ON_NULL(array); header = (CLR_RECORD_ASSEMBLY*)array->GetFirstElement(); if(header->GoodAssembly()) { CLR_RT_HeapBlock* dst = stack.Arg1().Dereference(); FAULT_ON_NULL(dst); TINYCLR_CHECK_HRESULT(CLR_RT_Assembly::CreateInstance( header, assm )); TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_String::CreateInstance( dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyInfo::FIELD__m_name ], assm->m_szName )); { CLR_RT_HeapBlock& refs = dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyInfo::FIELD__m_refs ]; CLR_UINT32 numRef = assm->m_pTablesSize[ TBL_AssemblyRef ]; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( refs, numRef, g_CLR_RT_WellKnownTypes.m_UInt32 )); { const CLR_RECORD_ASSEMBLYREF* ar = assm->GetAssemblyRef( 0 ); CLR_UINT32* dst = (CLR_UINT32*)refs.DereferenceArray()->GetFirstElement(); while(numRef--) { *dst++ = assm->ComputeAssemblyHash( ar++ ); } } } dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyInfo::FIELD__m_flags ].SetInteger( assm->m_header->flags , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyInfo::FIELD__m_size ].SetInteger( ROUNDTOMULTIPLE(assm->m_header->TotalSize(), CLR_INT32), DATATYPE_I4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyInfo::FIELD__m_hash ].SetInteger( assm->ComputeAssemblyHash() , DATATYPE_U4 ); stack.SetResult_Boolean( true ); } else { stack.SetResult_Boolean( false ); } TINYCLR_CLEANUP(); if(assm) { assm->DestroyInstance(); } TINYCLR_CLEANUP_END(); }
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_HardwareProvider::NativeSupportsNonStandardBaudRate___BOOLEAN__I4( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_UINT32 port; port = stack.Arg1().NumericByRef().u4; if (::CPU_USART_SupportNonStandardBaudRate( port )==TRUE) stack.SetResult_Boolean( true ); else stack.SetResult_Boolean( false ); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiVerify::VerifyInternal___BOOLEAN__SZARRAY_U1__I4__I4__SZARRAY_U1__I4__I4( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_RT_HeapBlock* pThis = stack.This(); CLR_RT_HeapBlock_Array* pData = stack.Arg1().DereferenceArray(); CLR_INT32 offset = stack.Arg2().NumericByRef().s4; CLR_INT32 len = stack.Arg3().NumericByRef().s4; CLR_RT_HeapBlock_Array* pSig = stack.Arg4().DereferenceArray(); CLR_INT32 sigOff = stack.Arg5().NumericByRef().s4; CLR_INT32 sigLen = stack.Arg6().NumericByRef().s4; CLR_RT_HeapBlock* pSession = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference(); CK_SESSION_HANDLE hSession; bool retVal = false; CK_RV result; FAULT_ON_NULL_ARG(pData); FAULT_ON_NULL_ARG(pSig); if((offset + len ) > (CLR_INT32)pData->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if((sigOff + sigLen) > (CLR_INT32)pSig->m_numOfElements ) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); hSession = (CK_SESSION_HANDLE)pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().s4; if(hSession == CK_SESSION_HANDLE_INVALID) TINYCLR_SET_AND_LEAVE(CLR_E_OBJECT_DISPOSED); result = C_Verify(hSession, pData->GetElement(offset), len, pSig->GetElement(sigOff), sigLen); retVal = CKR_OK == result; stack.SetResult_Boolean(retVal); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_update_native_Microsoft_SPOT_MFUpdate_MFNativeUpdate::AddPacket___STATIC__BOOLEAN__I4__I4__SZARRAY_U1__SZARRAY_U1( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_INT32 handle = stack.Arg0().NumericByRef().s4; CLR_INT32 pktIndex = stack.Arg1().NumericByRef().s4; CLR_RT_HeapBlock_Array* pPacket = stack.Arg2().DereferenceArray(); CLR_RT_HeapBlock_Array* pValidation = stack.Arg3().DereferenceArray(); CLR_UINT8* pValidData; CLR_INT32 validLen; FAULT_ON_NULL(pPacket); if(pValidation == NULL) { pValidData = NULL; validLen = 0; } else { pValidData = pValidation->GetFirstElement(); validLen = pValidation->m_numOfElements; } stack.SetResult_Boolean(TRUE == MFUpdate_AddPacket(handle, pktIndex, pPacket->GetFirstElement(), pPacket->m_numOfElements, pValidData, validLen)); TINYCLR_NOCLEANUP(); }
void Library_corlib_native_System_Threading_WaitHandle::Set( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); CLR_RT_HeapBlock* pThis = stack.This(); CLR_RT_HeapBlock_WaitForObject::SignalObject( *pThis ); stack.SetResult_Boolean( true ); }
HRESULT Library_corlib_native_System_Delegate::Equals___BOOLEAN__OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); stack.SetResult_Boolean( CLR_RT_HeapBlock::Compare_Unsigned_Values( stack.Arg0(), stack.Arg1() ) == 0 ); TINYCLR_NOCLEANUP_NOLABEL(); }
void Library_corlib_native_System_Threading_WaitHandle::Reset( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); CLR_RT_HeapBlock* pThis = stack.This(); pThis->ResetFlags( CLR_RT_HeapBlock::HB_Signaled ); stack.SetResult_Boolean( true ); }
HRESULT Library_corlib_native_System_Double::IsNaN___STATIC__BOOLEAN__R8( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); stack.SetResult_Boolean(false); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_corlib_native_System_Object::Equals___BOOLEAN__OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); stack.SetResult_Boolean( CLR_RT_HeapBlock::ObjectsEqual( stack.Arg0(), stack.Arg1(), true ) ); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_spot_native_Microsoft_SPOT_Reflection::IsTypeLoaded___STATIC__BOOLEAN__mscorlibSystemType( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_TypeDef_Instance inst; stack.SetResult_Boolean( CLR_RT_ReflectionDef_Index::Convert( stack.Arg0(), inst, NULL ) ); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_spot_native_Microsoft_SPOT_Hardware_SystemInfo::get_IsBigEndian___STATIC__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); { volatile CLR_UINT16 val = 0x0100; stack.SetResult_Boolean((*(volatile CLR_UINT8*)&val) == 1); } TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_corlib_native_System_BitConverter::get_IsLittleEndian___STATIC__BOOLEAN(CLR_RT_StackFrame& stack) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); DWORD x = 0x12345678; BYTE* p = reinterpret_cast<BYTE*>(&x); stack.SetResult_Boolean(*p == 0x78); TINYCLR_NOCLEANUP(); }
HRESULT Library_corlib_native_System_Threading_WaitHandle::WaitOne___BOOLEAN__I4__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); TINYCLR_CHECK_HRESULT(Wait( stack, stack.Arg1(), stack.Arg2(), &stack.ThisRef(), 1, false )); stack.SetResult_Boolean( stack.m_owningThread->m_waitForObject_Result != CLR_RT_Thread::TH_WAIT_RESULT_TIMEOUT ); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_net_native_Microsoft_SPOT_Net_SocketNative::poll___STATIC__BOOLEAN__OBJECT__I4__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_NETWORK(); TINYCLR_HEADER(); CLR_RT_HeapBlock* socket = stack.Arg0().Dereference(); CLR_INT32 handle; CLR_INT32 mode = stack.Arg1().NumericByRef().s4; CLR_INT32 timeout_us = stack.Arg2().NumericByRef().s4; CLR_RT_HeapBlock hbTimeout; CLR_INT32 timeout_ms; CLR_INT32 res = 0; bool fRes = true; CLR_INT64* timeout; FAULT_ON_NULL(socket); handle = socket[ FIELD__m_Handle ].NumericByRef().s4; /* Because we could have been a rescheduled call due to a prior call that would have blocked, we need to see * if our handle has been shutdown before continuing. */ if (handle == DISPOSED_HANDLE) { ThrowError( stack, CLR_E_OBJECT_DISPOSED ); TINYCLR_SET_AND_LEAVE (CLR_E_PROCESS_EXCEPTION); } if(timeout_us < 0) timeout_ms = -1; else timeout_ms = timeout_us / 1000; hbTimeout.SetInteger( timeout_ms ); TINYCLR_CHECK_HRESULT(stack.SetupTimeout( hbTimeout, timeout )); while(fRes) { res = Helper__SelectSocket( handle, mode ); if(res != 0) break; TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.WaitEvents( stack.m_owningThread, *timeout, CLR_RT_ExecutionEngine::c_Event_Socket, fRes )); } stack.PopValue(); //timer TINYCLR_CHECK_HRESULT(ThrowOnError( stack, res )); stack.SetResult_Boolean( res == 1 ); TINYCLR_NOCLEANUP(); }
HRESULT Library_corlib_native_System_Double::IsPositiveInfinity___STATIC__BOOLEAN__R8( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); double d = stack.Arg0().NumericByRefConst().r8; bool res = System::Double::IsPositiveInfinity( d ); stack.SetResult_Boolean( res ); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_corlib_native_System_WeakReference::get_IsAlive___BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_WeakReference* weak; weak = (CLR_RT_HeapBlock_WeakReference*)stack.This(); FAULT_ON_NULL(weak); stack.SetResult_Boolean( weak->m_targetDirect != NULL ); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_update_native_Microsoft_SPOT_MFUpdate_MFNativeUpdate::Authenticate___STATIC__BOOLEAN__I4__SZARRAY_U1( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_INT32 handle = stack.Arg0().NumericByRef().s4; CLR_RT_HeapBlock_Array* paArgs = stack.Arg1().DereferenceArray(); CLR_UINT8* pArgs = paArgs == NULL ? NULL : paArgs->GetFirstElement(); CLR_INT32 argsLen = paArgs == NULL ? 0 : paArgs->m_numOfElements; stack.SetResult_Boolean(TRUE == MFUpdate_Authenticate(handle, pArgs, argsLen)); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_HardwareProvider::NativeIsSupportedBaudRate___BOOLEAN__I4__BYREF_U4( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_RT_HeapBlock hbBR; CLR_UINT32 port; CLR_UINT32 SupportedBaudrate; port = stack.Arg1().NumericByRef().u4; TINYCLR_CHECK_HRESULT(hbBR.LoadFromReference( stack.Arg2() )); SupportedBaudrate = hbBR.NumericByRef().u4; if (CPU_USART_IsBaudrateSupported(port,SupportedBaudrate) == TRUE) stack.SetResult_Boolean( true ); else stack.SetResult_Boolean( false ); hbBR.SetInteger( (CLR_UINT32)SupportedBaudrate ); TINYCLR_CHECK_HRESULT(hbBR.StoreToReference( stack.Arg2(), 0 )); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_update_native_Microsoft_SPOT_MFUpdate_MFNativeUpdate::DeserializeParameter___STATIC__BOOLEAN__SZARRAY_U1__OBJECT( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_INT32 offset = 0; CLR_RT_HeapBlock_Array* array = stack.Arg0().DereferenceArray(); CLR_RT_HeapBlock& obj = stack.Arg1(); if(!DeserializeObject( &obj, array->GetFirstElement(), offset, array->m_numOfElements )) TINYCLR_SET_AND_LEAVE(CLR_E_FAIL); stack.SetResult_Boolean(true); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_update_native_Microsoft_SPOT_MFUpdate_MFNativeUpdate::AuthCommand___STATIC__BOOLEAN__I4__I4__SZARRAY_U1__BYREF_SZARRAY_U1( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_INT32 handle = stack.Arg0().NumericByRef().s4; CLR_INT32 cmd = stack.Arg1().NumericByRef().s4; CLR_RT_HeapBlock_Array* paArgs = stack.Arg2().DereferenceArray(); CLR_RT_HeapBlock_Array* paResp = stack.Arg3().Dereference()->DereferenceArray(); CLR_UINT8* pResp = paResp == NULL ? NULL : paResp->GetFirstElement(); CLR_INT32 respLen = paResp == NULL ? 0 : paResp->m_numOfElements; FAULT_ON_NULL_ARG(paArgs); stack.SetResult_Boolean(TRUE == MFUpdate_AuthCommand(handle, cmd, paArgs->GetFirstElement(), paArgs->m_numOfElements, pResp, respLen)); TINYCLR_NOCLEANUP(); }
HRESULT Library_windows_devices_native_Windows_Devices_Gpio_GpioPin::InitNative___BOOLEAN__I4( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); GPIO_PIN portId = GPIO_PIN_NONE; bool pinAllocated = false; CLR_RT_HeapBlock* pThis = stack.This(); FAULT_ON_NULL(pThis); portId = stack.Arg1().NumericByRef().u4; // Ensure the pin exists. if (::CPU_GPIO_Attributes( portId ) == 0) { TINYCLR_SET_AND_LEAVE(S_OK); } // Reserve the pin. If this fails, it's already in use. pinAllocated = !!::CPU_GPIO_ReservePin( portId, TRUE ); if (!pinAllocated) { TINYCLR_SET_AND_LEAVE(S_OK); } // Initialize the default drive mode. if (!::CPU_GPIO_EnableInputPin2( portId, false, NULL, NULL, GPIO_INT_NONE, RESISTOR_DISABLED )) { TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_OPERATION); } pThis[ FIELD__m_pinNumber ].NumericByRef().u4 = portId; TINYCLR_CLEANUP(); if (FAILED(hr)) { if (pinAllocated) { ::CPU_GPIO_ReservePin( portId, FALSE ); } } stack.SetResult_Boolean( pinAllocated ); TINYCLR_CLEANUP_END(); }
HRESULT Library_spot_update_native_Microsoft_SPOT_MFUpdate_MFNativeUpdate::SetUpdateProperty___STATIC__BOOLEAN__I4__STRING__SZARRAY_U1( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_INT32 handle = stack.Arg0().NumericByRef().s4; LPCSTR szProperty = stack.Arg1().StringText(); CLR_RT_HeapBlock_Array* pData; int dataLen; FAULT_ON_NULL(szProperty); pData = stack.Arg2().DereferenceArray(); FAULT_ON_NULL_ARG(pData); dataLen = pData->m_numOfElements; stack.SetResult_Boolean(TRUE == MFUpdate_SetProperty(handle, szProperty, pData->GetFirstElement(), dataLen)); TINYCLR_NOCLEANUP(); }
HRESULT Library_corlib_native_System_BitConverter::ToBoolean___STATIC__BOOLEAN__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index; index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); BYTE* p; p = pArray->GetFirstElement(); stack.SetResult_Boolean(*reinterpret_cast<bool*>(p + index)); TINYCLR_NOCLEANUP(); }
HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiVerify::VerifyFinalInternal___BOOLEAN__SZARRAY_U1__I4__I4( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_RT_HeapBlock* pThis = stack.This(); CLR_RT_HeapBlock_Array* pSig = stack.Arg1().DereferenceArray(); CLR_INT32 sigOff = stack.Arg2().NumericByRef().s4; CLR_INT32 sigLen = stack.Arg3().NumericByRef().s4; CLR_RT_HeapBlock* pSession = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference(); CK_SESSION_HANDLE hSession; bool retVal = false; CK_RV result; FAULT_ON_NULL_ARG(pSig); if((sigOff + sigLen) > (CLR_INT32)pSig->m_numOfElements ) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); hSession = pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().s4; if(hSession == CK_SESSION_HANDLE_INVALID) TINYCLR_SET_AND_LEAVE(CLR_E_OBJECT_DISPOSED); result = C_VerifyFinal(hSession, pSig->GetElement(sigOff), sigLen); switch(result) { case CKR_SIGNATURE_INVALID: retVal = false; break; case CKR_OK: retVal = true; break; case CKR_SIGNATURE_LEN_RANGE: TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); default: CRYPTOKI_CHECK_RESULT(stack, result); break; } stack.SetResult_Boolean(retVal); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_Port::ReservePin___STATIC__BOOLEAN__MicrosoftSPOTHardwareCpuPin__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); CLR_UINT32 portId; bool fReserve; portId = stack.Arg0().NumericByRef().u4; fReserve = stack.Arg1().NumericByRef().u1 != 0; if(!::CPU_GPIO_ReservePin( portId, fReserve )) { TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_OPERATION); } stack.SetResult_Boolean( true ); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_Port::Read___BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); CLR_UINT32 state; CLR_RT_HeapBlock* pThis = stack.This(); FAULT_ON_NULL(pThis); if(pThis[ Library_spot_hardware_native_Microsoft_SPOT_Hardware_NativeEventDispatcher::FIELD__m_disposed ].NumericByRef().s1 != 0) { TINYCLR_SET_AND_LEAVE(CLR_E_OBJECT_DISPOSED); } // Read state from Hardware state = ::CPU_GPIO_GetPinState( pThis[ FIELD__m_portId ].NumericByRefConst().u4 ); // Return value to the managed application. stack.SetResult_Boolean( state == 0 ? false : true ) ; TINYCLR_NOCLEANUP(); }
HRESULT Library_corlib_native_System_Reflection_MethodBase::CheckFlags( CLR_RT_StackFrame& stack, CLR_UINT32 mask, CLR_UINT32 flag ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_MethodDef_Instance md; bool fRes; CLR_RT_HeapBlock* hbMeth = stack.Arg0().Dereference(); TINYCLR_CHECK_HRESULT(GetMethodDescriptor( stack, *hbMeth, md )); if((md.m_target->flags & mask) == flag) { fRes = true; } else { fRes = false; } stack.SetResult_Boolean( fRes ); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_native_Microsoft_SPOT_Reflection::GetAssemblyMemoryInfo___STATIC__BOOLEAN__mscorlibSystemReflectionAssembly__MicrosoftSPOTReflectionAssemblyMemoryInfo( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_Assembly_Instance assm; const CLR_RECORD_ASSEMBLY* header = NULL; TINYCLR_CHECK_HRESULT(Library_corlib_native_System_Reflection_Assembly::GetTypeDescriptor( *stack.Arg0().Dereference(), assm )); header = assm.m_assm->m_header; if(header->GoodAssembly()) { CLR_RT_HeapBlock* dst = stack.Arg1().Dereference(); FAULT_ON_NULL(dst); CLR_RT_Assembly::Offsets offsets; offsets.iBase = ROUNDTOMULTIPLE(sizeof(CLR_RT_Assembly) , CLR_UINT32); offsets.iAssemblyRef = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_AssemblyRef ] * sizeof(CLR_RT_AssemblyRef_CrossReference), CLR_UINT32); offsets.iTypeRef = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_TypeRef ] * sizeof(CLR_RT_TypeRef_CrossReference ), CLR_UINT32); offsets.iFieldRef = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_FieldRef ] * sizeof(CLR_RT_FieldRef_CrossReference ), CLR_UINT32); offsets.iMethodRef = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_MethodRef ] * sizeof(CLR_RT_MethodRef_CrossReference ), CLR_UINT32); offsets.iTypeDef = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_TypeDef ] * sizeof(CLR_RT_TypeDef_CrossReference ), CLR_UINT32); offsets.iFieldDef = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_FieldDef ] * sizeof(CLR_RT_FieldDef_CrossReference ), CLR_UINT32); offsets.iMethodDef = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_MethodDef ] * sizeof(CLR_RT_MethodDef_CrossReference ), CLR_UINT32); #if !defined(TINYCLR_APPDOMAINS) offsets.iStaticFields = ROUNDTOMULTIPLE(assm.m_assm->m_iStaticFields * sizeof(CLR_RT_HeapBlock ), CLR_UINT32); #endif #if defined(TINYCLR_ENABLE_SOURCELEVELDEBUGGING) offsets.iDebuggingInfoMethods = ROUNDTOMULTIPLE(assm.m_assm->m_pTablesSize[ TBL_MethodDef ] * sizeof(CLR_RT_MethodDef_DebuggingInfo ), CLR_UINT32); #endif //#if defined(TINYCLR_ENABLE_SOURCELEVELDEBUGGING) size_t iTotalRamSize = offsets.iBase + offsets.iAssemblyRef + offsets.iTypeRef + offsets.iFieldRef + offsets.iMethodRef + offsets.iTypeDef + offsets.iFieldDef + offsets.iMethodDef; #if !defined(TINYCLR_APPDOMAINS) iTotalRamSize += offsets.iStaticFields; #endif #if defined(TINYCLR_ENABLE_SOURCELEVELDEBUGGING) iTotalRamSize += offsets.iDebuggingInfoMethods; #endif //#if defined(TINYCLR_ENABLE_SOURCELEVELDEBUGGING) size_t iMetaData = header->SizeOfTable( TBL_AssemblyRef ) + header->SizeOfTable( TBL_TypeRef ) + header->SizeOfTable( TBL_FieldRef ) + header->SizeOfTable( TBL_MethodRef ) + header->SizeOfTable( TBL_TypeDef ) + header->SizeOfTable( TBL_FieldDef ) + header->SizeOfTable( TBL_MethodDef ) + header->SizeOfTable( TBL_Attributes ) + header->SizeOfTable( TBL_TypeSpec ) + header->SizeOfTable( TBL_Signatures ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__RamSize ].SetInteger( iTotalRamSize , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__RomSize ].SetInteger( ROUNDTOMULTIPLE(assm.m_assm->m_header->TotalSize(), CLR_INT32) , DATATYPE_I4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__MetadataSize ].SetInteger( iMetaData , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__AssemblyRef ].SetInteger( offsets.iAssemblyRef , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__AssemblyRefElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_AssemblyRef ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__TypeRef ].SetInteger( offsets.iTypeRef , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__TypeRefElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_TypeRef ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__FieldRef ].SetInteger( offsets.iFieldRef , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__FieldRefElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_FieldRef ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__MethodRef ].SetInteger( offsets.iMethodRef , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__MethodRefElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_MethodRef ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__TypeDef ].SetInteger( offsets.iTypeDef , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__TypeDefElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_TypeDef ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__FieldDef ].SetInteger( offsets.iFieldDef , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__FieldDefElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_FieldDef ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__MethodDef ].SetInteger( offsets.iMethodDef , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__MethodDefElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_MethodDef ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__StaticFields ].SetInteger( assm.m_assm->m_iStaticFields , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__Attributes ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_Attributes ] * sizeof(CLR_RECORD_ATTRIBUTE), DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__AttributesElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_Attributes ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__TypeSpec ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_TypeSpec ] * sizeof(CLR_RECORD_TYPESPEC ), DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__TypeSpecElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_TypeSpec ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__Resources ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_Resources ] * sizeof(CLR_RECORD_RESOURCE ), DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__ResourcesElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_Resources ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__ResourcesFiles ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_ResourcesFiles ] * sizeof(CLR_RECORD_RESOURCE ), DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__ResourcesFilesElements ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_ResourcesFiles ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__ResourcesData ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_ResourcesData ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__Strings ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_Strings ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__Signatures ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_Signatures ] , DATATYPE_U4 ); dst[ Library_spot_native_Microsoft_SPOT_Reflection__AssemblyMemoryInfo::FIELD__ByteCode ].SetInteger( assm.m_assm->m_pTablesSize[ TBL_ByteCode ] , DATATYPE_U4 ); stack.SetResult_Boolean( true ); } else { stack.SetResult_Boolean( false ); } TINYCLR_NOCLEANUP(); }
void SetResult_bool( CLR_RT_StackFrame &stackFrame, bool value ) { NATIVE_PROFILE_CLR_CORE(); stackFrame.SetResult_Boolean( value ); }
HRESULT Library_spot_native_Microsoft_SPOT_Messaging_EndPoint::Check___BOOLEAN__mscorlibSystemType__U4__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_MESSAGING(); TINYCLR_HEADER(); CLR_RT_HeapBlock* pThis; CLR_RT_HeapBlock_EndPoint::Message* msg; CLR_RT_HeapBlock_EndPoint::Port port; CLR_RT_HeapBlock_EndPoint* ep; CLR_INT64* timeout; bool fRes; CLR_UINT32 seq; pThis = stack.This(); FAULT_ON_NULL(pThis); TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_EndPoint::ExtractInstance( pThis[ FIELD__m_handle ], ep )); if(CLR_RT_ReflectionDef_Index::Convert( stack.Arg1(), port.m_type ) == false) TINYCLR_SET_AND_LEAVE(CLR_E_NULL_REFERENCE); port.m_id = stack.Arg2().NumericByRefConst().u4; TINYCLR_CHECK_HRESULT(stack.SetupTimeout( stack.Arg3(), timeout )); // // Send message. // if(stack.m_customState == 1) { CLR_Messaging_Commands::Messaging_Query rpc; rpc.m_addr.m_from = ep->m_addr; rpc.m_addr.m_seq = ep->m_seq++; rpc.m_addr.m_to = port; // // Push sequence number onto the eval stack to wait for reply. // stack.PushValueI4( rpc.m_addr.m_seq ); CLR_EE_MSG_EVENT_RPC( CLR_Messaging_Commands::c_Messaging_Query, sizeof(rpc), &rpc, WP_Flags::c_NonCritical ); stack.m_customState = 2; } // // Get seq# from stack // seq = stack.m_evalStack[ 1 ].NumericByRef().u4; fRes = true; msg = NULL; while(fRes) { msg = ep->FindMessage( CLR_Messaging_Commands::c_Messaging_Query, &seq ); if(msg) break; TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.WaitEvents( stack.m_owningThread, *timeout, CLR_RT_ExecutionEngine::c_Event_EndPoint, fRes )); } stack.PopValue(); //seq stack.PopValue(); //Timeout fRes = false; if(msg) { fRes = (msg->m_found != 0); msg->Unlink(); CLR_RT_Memory::Release( msg ); } stack.SetResult_Boolean( fRes ); TINYCLR_NOCLEANUP(); }