| 45 | public: |
| 46 | PollCallbackFunction() {} |
| 47 | WasmEdge::Expect<int32_t> body(const WasmEdge::Runtime::CallingFrame &Frame, |
| 48 | uint32_t __attribute__((unused)) ctx, |
| 49 | uint32_t data, uint32_t data_sz) { |
| 50 | using namespace std; |
| 51 | using WasmEdge::unlikely; |
| 52 | auto *memory = Frame.getMemoryByIndex(0); |
| 53 | if (unlikely(!memory)) { |
| 54 | return WasmEdge::Unexpect(WasmEdge::ErrCode::Value::HostFuncError); |
| 55 | } |
| 56 | if (data_sz < static_cast<uint32_t>(sizeof(uint32_t))) { |
| 57 | return WasmEdge::Unexpect(WasmEdge::ErrCode::Value::HostFuncError); |
| 58 | } |
| 59 | const uint32_t *dataPtr = memory->getSpan<const uint32_t>(data, 1).data(); |
| 60 | if (unlikely(!dataPtr)) { |
| 61 | return WasmEdge::Unexpect(WasmEdge::ErrCode::Value::HostFuncError); |
| 62 | } |
| 63 | EXPECT_EQ(*dataPtr, UINT32_C(0xABCD1234)); |
| 64 | return 0; |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | } // namespace |
nothing calls this directly
no test coverage detected