F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
WasmSequencer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title WasmSequencer.hpp
3 // \author tumbar
4 // \brief hpp file for WasmSequencer component implementation class
5 // ======================================================================
6 
7 #ifndef Svc_WasmSequencer_HPP
8 #define Svc_WasmSequencer_HPP
9 
15 #include "Fw/Types/StringBase.hpp"
28 #include "config/WasmSequencerConfig.hpp"
29 
30 namespace Svc {
31 
33  friend class WasmSequencerTester;
34 
35  public:
36  // ----------------------------------------------------------------------
37  // Component construction and destruction
38  // ----------------------------------------------------------------------
39 
41  WasmSequencer(const char* const compName
42  );
43 
45  ~WasmSequencer() = default;
46 
49  WasmSequencer(const WasmSequencer&) = delete;
50  WasmSequencer& operator=(const WasmSequencer&) = delete;
51 
54  DROP_NEWEST,
55  DROP_OLDEST,
56  ASSERT,
58  };
59 
61  constexpr static FwSizeType SPACEWASM_MEMORY_ALIGNMENT = 8;
62 
66  constexpr static FwSizeType SPACEWASM_IR_PAGE_SIZE = 512;
68  "SpaceWasm does not support dynamic memory pages smaller than a single IR page (512 bytes)");
69 
76  };
77 
80  struct Config {
86 
91 
98 
111 
114 
119 
125  };
126 
129  void configure(const Config& cfg, Fw::MemAllocator& mallocator);
130 
132  void deinit() override;
133 
134  private:
135  // ----------------------------------------------------------------------
136  // Handler implementations for typed input ports
137  // ----------------------------------------------------------------------
138 
142  void checkTimers_handler(FwIndexType portNum,
143  U32 context
144  ) override;
145 
149  void cmdResponseIn_handler(FwIndexType portNum,
150  FwOpcodeType opCode,
151  U32 cmdSeq,
152  const Fw::CmdResponse& response
153  ) override;
154 
158  void seqCancelIn_handler(FwIndexType portNum
159  ) override;
160 
164  void seqRunIn_handler(FwIndexType portNum,
165  const Fw::StringBase& filename,
166  const Svc::SeqArgs& args
167  ) override;
168 
172  void writeTelemetry_handler(FwIndexType portNum,
173  U32 context
174  ) override;
175 
176  private:
177  // ----------------------------------------------------------------------
178  // Handler implementations for serial input ports
179  // ----------------------------------------------------------------------
180 
186  void serialIn_handler(FwIndexType portNum,
187  Fw::LinearBufferBase& buffer
188  ) override;
189 
190  private:
191  // ----------------------------------------------------------------------
192  // Handler implementations for commands
193  // ----------------------------------------------------------------------
194 
208  void RUN_cmdHandler(FwOpcodeType opCode,
209  U32 cmdSeq,
210  const Fw::CmdStringArg& fileName,
211  const Svc::BlockState& block
212  ) override;
213 
220  void LOAD_cmdHandler(FwOpcodeType opCode,
221  U32 cmdSeq,
222  const Fw::CmdStringArg& fileName,
223  const Fw::CmdStringArg& name
224  ) override;
225 
229  void INVOKE_cmdHandler(FwOpcodeType opCode,
230  U32 cmdSeq,
231  const Fw::CmdStringArg& module,
232  const Svc::BlockState& block
233  ) override;
234 
238  void WAIT_cmdHandler(FwOpcodeType opCode,
239  U32 cmdSeq
240  ) override;
241 
246  void CANCEL_cmdHandler(FwOpcodeType opCode,
247  U32 cmdSeq
248  ) override;
249 
257  void PAUSE_cmdHandler(FwOpcodeType opCode,
258  U32 cmdSeq
259  ) override;
260 
264  void CONTINUE_cmdHandler(FwOpcodeType opCode,
265  U32 cmdSeq
266  ) override;
267 
272  void GLOBAL_SET_I32_cmdHandler(FwOpcodeType opCode,
273  U32 cmdSeq,
274  const Fw::CmdStringArg& moduleName,
275  const Fw::CmdStringArg& name,
276  I32 value
277  ) override;
278 
283  void GLOBAL_SET_I64_cmdHandler(FwOpcodeType opCode,
284  U32 cmdSeq,
285  const Fw::CmdStringArg& moduleName,
286  const Fw::CmdStringArg& name,
287  I64 value
288  ) override;
289 
294  void GLOBAL_SET_F32_cmdHandler(FwOpcodeType opCode,
295  U32 cmdSeq,
296  const Fw::CmdStringArg& moduleName,
297  const Fw::CmdStringArg& name,
298  F32 value
299  ) override;
300 
305  void GLOBAL_SET_F64_cmdHandler(FwOpcodeType opCode,
306  U32 cmdSeq,
307  const Fw::CmdStringArg& moduleName,
308  const Fw::CmdStringArg& name,
309  F64 value
310  ) override;
311 
316  void GLOBAL_GET_cmdHandler(FwOpcodeType opCode,
317  U32 cmdSeq,
318  const Fw::CmdStringArg& moduleName,
319  const Fw::CmdStringArg& name
320  ) override;
321 
322  private:
323  // ----------------------------------------------------------------------
324  // Implementations for internal state machine actions
325  // ----------------------------------------------------------------------
326 
330  void Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
331  SmId smId,
334  ) override;
335 
339  void Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
340  SmId smId,
342  ) override;
343 
347  void Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
348  SmId smId,
350  ) override;
351 
356  void Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
357  SmId smId,
360  ) override;
361 
365  void Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
366  SmId smId,
369  ) override;
370 
375  void Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
376  SmId smId,
379  ) override;
380 
384  void Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
385  SmId smId,
387  ) override;
388 
393  void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
394  SmId smId,
397  ) override;
398 
403  void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
404  SmId smId,
407  ) override;
408 
414  void Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
415  SmId smId,
417  const Svc::WasmSequencer_LoadRequest& value
418  ) override;
419 
424  void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
425  SmId smId,
428  ) override;
429 
434  void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
435  SmId smId,
438  ) override;
439 
444  void Svc_WasmSequencer_ControllerStateMachine_action_load(
445  SmId smId,
447  const Svc::WasmSequencer_LoadRequest& value
448  ) override;
449 
453  void Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
454  SmId smId,
457  ) override;
458 
462  void Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
463  SmId smId,
466  ) override;
467 
471  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
472  SmId smId,
475  ) override;
476 
480  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
481  SmId smId,
484  ) override;
485 
490  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
491  SmId smId,
494  ) override;
495 
499  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
500  SmId smId,
503  ) override;
504 
508  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
509  SmId smId,
512  ) override;
513 
517  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
518  SmId smId,
521  ) override;
522 
526  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
527  SmId smId,
530  ) override;
531 
535  void Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
536  SmId smId,
538  ) override;
539 
544  void Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
545  SmId smId,
548  ) override;
549 
553  void Svc_WasmSequencer_InterpreterStateMachine_action_cmdReplyOK(
554  SmId smId,
557  ) override;
558 
562  void Svc_WasmSequencer_InterpreterStateMachine_action_signalEntered(
563  SmId smId,
565  ) override;
566 
570  void Svc_WasmSequencer_InterpreterStateMachine_action_spin(
571  SmId smId,
573  ) override;
574 
578  void Svc_WasmSequencer_InterpreterStateMachine_action_reset(
579  SmId smId,
581  ) override;
582 
584  void Svc_WasmSequencer_InterpreterStateMachine_action_clearExitStatus(
585  SmId smId,
587  ) override;
588 
591  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_FINISHED(
592  SmId smId,
594  ) override;
595 
598  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_TRAP(
599  SmId smId,
601  ) override;
602 
604  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_REPLY_TIMEOUT(
605  SmId smId,
607  ) override;
608 
610  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_HOST_FAILURE(
611  SmId smId,
613  ) override;
614 
617  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_TIMER_INCOMPARABLE(
618  SmId smId,
620  ) override;
621 
624  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_UNEXPECTED_REPLY(
625  SmId smId,
627  ) override;
628 
630  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_CANCEL(
631  SmId smId,
633  ) override;
634 
636  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitCode(
637  SmId smId,
639  I32 value
640  ) override;
641 
643  void Svc_WasmSequencer_InterpreterStateMachine_action_setTrapReason(
644  SmId smId,
646  const Svc::WasmSequencer_TrapReason& value
647  ) override;
648 
650  void Svc_WasmSequencer_InterpreterStateMachine_action_setLastHostFunction(
651  SmId smId,
653  ) override;
654 
659  void Svc_WasmSequencer_InterpreterStateMachine_action_finish(
660  SmId smId,
662  ) override;
663 
667  void Svc_WasmSequencer_InterpreterStateMachine_action_reportPaused(
668  SmId smId,
670  ) override;
671 
675  void Svc_WasmSequencer_InterpreterStateMachine_action_clearPause(
676  SmId smId,
678  ) override;
679 
683  void Svc_WasmSequencer_InterpreterStateMachine_action_dispatchPendingHostFunction(
684  SmId smId,
686  ) override;
687 
691  void Svc_WasmSequencer_InterpreterStateMachine_action_clearPendingHostFunction(
692  SmId smId,
694  ) override;
695 
699  void Svc_WasmSequencer_InterpreterStateMachine_action_setContext(
700  SmId smId,
703  ) override;
704 
708  void Svc_WasmSequencer_InterpreterStateMachine_action_clearContext(
709  SmId smId,
711  ) override;
712 
716  void Svc_WasmSequencer_InterpreterStateMachine_action_resume(
717  SmId smId,
719  ) override;
720 
724  void Svc_WasmSequencer_InterpreterStateMachine_action_resumeI32(
725  SmId smId,
727  I32 value
728  ) override;
729 
733  void Svc_WasmSequencer_InterpreterStateMachine_action_checkSleepTimers(
734  SmId smId,
736  ) override;
737 
741  void Svc_WasmSequencer_InterpreterStateMachine_action_checkTimeout(
742  SmId smId,
744  ) override;
745 
749  void Svc_WasmSequencer_InterpreterStateMachine_action_dequeueSerialAndResume(
750  SmId smId,
752  const FwIndexType& value
753  ) override;
754 
755  private:
756  // ----------------------------------------------------------------------
757  // Implementations for internal state machine guards
758  // ----------------------------------------------------------------------
759 
763  bool Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
764  SmId smId,
766  ) const override;
767 
771  bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
772  SmId smId,
775  ) const override;
776 
780  bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
781  SmId smId,
784  ) const override;
785 
789  bool Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
790  SmId smId,
793  ) const override;
794 
798  bool Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
799  SmId smId,
801  ) const override;
802 
806  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingPause(
807  SmId smId,
809  ) const override;
810 
814  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunction(
815  SmId smId,
817  ) const override;
818 
822  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunctionIsSleep(
823  SmId smId,
825  ) const override;
826 
830  bool Svc_WasmSequencer_InterpreterStateMachine_guard_blockingSerialIn(
831  SmId smId,
833  const FwIndexType& value
834  ) const override;
835 
839  bool Svc_WasmSequencer_InterpreterStateMachine_guard_dequeueSucceeded(
840  SmId smId,
842  ) const override;
843 
844  private:
846  U8* globalAlloc(U32 size, U32 align);
847  void globalDealloc(const U8* ptr);
848 
850  static U8* globalAllocCallback(void* userdata, size_t size, size_t align);
851  static void globalDeallocCallback(void* userdata, U8* ptr, size_t size, size_t align);
852 
854  U8* guestAlloc(FwSizeType size, U32 align);
855  U8* guestRealloc(U8* ptr, FwSizeType oldSize, FwSizeType newSize, U32 align);
856  void guestDealloc(const U8* ptr, FwSizeType size);
857 
858  // Guest allocator callbacks passed to C API
859  static U8* guestAllocCallback(void* userdata, size_t size, size_t align);
860  static U8* guestReallocCallback(void* userdata, U8* ptr, size_t old_size, size_t new_size, size_t align);
861  static void guestDeallocCallback(void* userdata, U8* ptr, size_t size, size_t align);
862 
865  void createStore();
866 
868  void destroyStore();
869 
871  void takeAllocatorLock();
872 
874  void releaseAllocatorLock();
875 
877  static Svc::WasmSequencer_TrapReason::T mapTrapReason(spacewasm_trap_t trap);
878 
882  void setSequenceName(const Fw::StringBase& filePath, const Fw::StringBase& moduleName);
883 
887  static const char* pathBaseName(const char* path, FwSizeType len, FwSizeType& outLen);
888 
892  static bool pathHasParentTraversal(const Fw::StringBase& path);
893 
898  bool resolveSequencePath(const Fw::StringBase& fileName, Fw::String& filePath);
899 
902  Fw::Success readGuestMemory(WasmSequencer_HostFunction::T kind, U32 addr, U8* dst, FwSizeType len);
903 
906  Fw::Success writeGuestMemory(WasmSequencer_HostFunction::T kind, U32 addr, const U8* src, FwSizeType len);
907 
908  Fw::MemAllocator* m_allocator = nullptr;
909 
911  Config m_config;
912 
916  U8** m_heapPages;
917 
919  FwSizeType m_heapPagesUsed;
920 
924  bool m_heapPoisoned;
925 
929  U8* m_guestPool;
930 
932  FwSizeType m_guestPoolOffset;
933 
935  spacewasm_t* m_wasm;
936 
938  spacewasm_allocator_t* m_guest_allocator;
939 
941  struct WaitingCmd {
942  FwOpcodeType opCode;
943  U32 cmdSeq;
944 
945  WaitingCmd() : opCode(0), cmdSeq(0) {}
946  WaitingCmd(FwOpcodeType opCode_, U32 cmdSeq_) : opCode(opCode_), cmdSeq(cmdSeq_) {}
947  };
948 
951 
953  Fw::FileNameString m_lastLoadFileName;
954 
955  WasmSequencer_RequestContext m_executingContext;
956  bool m_hasExecutingContext;
957 
959  Fw::Time m_pendingTimer;
960  bool m_hasPendingTimer;
961 
965  Fw::Time m_hostFunctionStart;
966  bool m_hasHostFunctionStart;
967 
968  bool m_dequeueSucceeded;
969 
971  spacewasm_status_t m_invokeStatus;
972 
974  bool m_pendingPause;
975 
977  bool m_cancelRequested;
978 
981  struct Telemetry {
983  U64 sequencesSucceeded{0};
984 
986  U64 sequencesFailed{0};
987 
989  U64 sequencesCancelled{0};
990 
992  U64 commandsDispatched{0};
993 
995  U64 commandsFailed{0};
996 
998  Fw::FileNameString sequenceName{""};
999  };
1000 
1001  Telemetry m_tlm;
1002 
1007  U32 m_sequencesStarted;
1008 
1013  U32 makeCmdUid() const;
1014 
1017  struct ExitStatus {
1020  WasmSequencer_ExitReason reason{WasmSequencer_ExitReason::UNKNOWN};
1021 
1023  I32 code{0};
1024 
1026  WasmSequencer_HostFunction lastHostFunction{WasmSequencer_HostFunction::NONE};
1027 
1029  WasmSequencer_TrapReason lastTrapReason{WasmSequencer_TrapReason::NONE};
1030  };
1031 
1033  ExitStatus m_exit;
1034 
1036  Fw::ExternalSerializeBuffer m_serialOutBuffer;
1037 
1041 
1043  Os::Mutex m_serialInMutex;
1044 
1048  struct PendingHostFunction {
1049  PendingHostFunction() = default;
1050  bool isPending() const { return kind != WasmSequencer_HostFunction::NONE; }
1051  void clear() { kind = WasmSequencer_HostFunction::NONE; }
1052 
1053  WasmSequencer_HostFunction kind{WasmSequencer_HostFunction::NONE};
1054 
1055  // Handle that holds the Wasm guest memory pointer
1056  spacewasm_caller_t* caller{nullptr};
1057 
1059  union Args {
1060  // COMMAND: encoded command payload in guest memory
1061  struct {
1062  U32 ptr;
1063  U32 len;
1064  } command;
1065 
1066  // TELEMETRY: channel id plus where to write the serialized time and value
1067  struct {
1069  U32 timePtr;
1070  U32 timeLen;
1073  } telemetry;
1074 
1075  // PARAMETER: parameter id plus where to write the serialized value
1076  struct {
1078  U32 ptr;
1079  U32 len;
1080  } parameter;
1081 
1082  // EVENT: raw guest-requested severity (may be out of range) plus the message
1083  struct {
1085  U32 msgPtr;
1086  U32 msgLen;
1087  } event;
1088 
1089  // RSLEEP: relative sleep duration
1090  struct {
1091  U64 us;
1092  } rsleep;
1093 
1094  // ASLEEP: absolute sleep time
1095  struct {
1096  U64 us;
1097  } asleep;
1098 
1099  // TIME: where to write the serialized current time
1100  struct {
1101  U32 ptr;
1102  U32 len;
1103  } time;
1104 
1105  // SERIAL_OUT: serial output port index plus payload in guest memory
1106  struct {
1107  U32 index;
1108  U32 ptr;
1109  U32 len;
1110  } serialOut;
1111 
1112  // SERIAL_RECV: Read a message from the serialIn port queue given a port index
1113  struct {
1114  U32 index;
1115  U32 dataPtr;
1119  } serialRecv;
1120 
1121  Args() : command{0, 0} {}
1122  } u;
1123  };
1124 
1125  PendingHostFunction m_pendingHostFunction;
1126 
1128  spacewasm_status_t validateModuleMain(WasmSequencer_ModuleIdx moduleIdx) const;
1129 
1135  void reportSequenceRuntimeFailure(WasmSequencer_ModuleIdx moduleIdx, WasmSequencer_SequencePhase phase);
1136 
1138  void respondToRequest(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1139 
1141  void respondToWaiting(const Fw::CmdResponse& response);
1142 
1149  void reportSeqDone(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1150 
1154  void reportSeqAborted(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1155 
1157  spacewasm_status_t setGlobal(const Fw::StringBase& moduleName, const Fw::StringBase& name, spacewasm_value_t value);
1158 
1160  spacewasm_status_t getGlobal(const Fw::StringBase& moduleName,
1161  const Fw::StringBase& name,
1162  spacewasm_value_t& value);
1163 
1165  void hostFprimeV1(spacewasm_host_t*);
1166 
1168  spacewasm_hostcall_result_t wasmExit(struct spacewasm_caller_t* caller,
1169  const struct spacewasm_value_t* params,
1170  size_t n_params,
1171  struct spacewasm_value_t* out_result);
1172 
1173  spacewasm_hostcall_result_t wasmPanic(struct spacewasm_caller_t* caller,
1174  const struct spacewasm_value_t* params,
1175  size_t n_params,
1176  struct spacewasm_value_t* out_result);
1177 
1178  spacewasm_hostcall_result_t wasmArgs(struct spacewasm_caller_t* caller,
1179  const struct spacewasm_value_t* params,
1180  size_t n_params,
1181  struct spacewasm_value_t* out_result);
1182 
1183  spacewasm_hostcall_result_t wasmTime(struct spacewasm_caller_t* caller,
1184  const struct spacewasm_value_t* params,
1185  size_t n_params,
1186  struct spacewasm_value_t* out_result);
1187 
1188  spacewasm_hostcall_result_t wasmReadTelemetry(struct spacewasm_caller_t* caller,
1189  const struct spacewasm_value_t* params,
1190  size_t n_params,
1191  struct spacewasm_value_t* out_result);
1192 
1193  spacewasm_hostcall_result_t wasmReadParameter(struct spacewasm_caller_t* caller,
1194  const struct spacewasm_value_t* params,
1195  size_t n_params,
1196  struct spacewasm_value_t* out_result);
1197 
1198  spacewasm_hostcall_result_t wasmCommand(struct spacewasm_caller_t* caller,
1199  const struct spacewasm_value_t* params,
1200  size_t n_params,
1201  struct spacewasm_value_t* out_result);
1202 
1203  spacewasm_hostcall_result_t wasmEvent(struct spacewasm_caller_t* caller,
1204  const struct spacewasm_value_t* params,
1205  size_t n_params,
1206  struct spacewasm_value_t* out_result);
1207 
1208  spacewasm_hostcall_result_t wasmRsleep(struct spacewasm_caller_t* caller,
1209  const struct spacewasm_value_t* params,
1210  size_t n_params,
1211  struct spacewasm_value_t* out_result);
1212 
1213  spacewasm_hostcall_result_t wasmAsleep(struct spacewasm_caller_t* caller,
1214  const struct spacewasm_value_t* params,
1215  size_t n_params,
1216  struct spacewasm_value_t* out_result);
1217 
1218  spacewasm_hostcall_result_t wasmSerialOut(struct spacewasm_caller_t* caller,
1219  const struct spacewasm_value_t* params,
1220  size_t n_params,
1221  struct spacewasm_value_t* out_result);
1222 
1223  spacewasm_hostcall_result_t wasmSerialRecv(struct spacewasm_caller_t* caller,
1224  const struct spacewasm_value_t* params,
1225  size_t n_params,
1226  struct spacewasm_value_t* out_result);
1227 
1229  void dispatchCommand();
1230 
1232  void dispatchTelemetry();
1233 
1235  void dispatchParameter();
1236 
1238  void dispatchEvent();
1239 
1241  void dispatchRelativeSleep();
1242 
1244  void dispatchAbsoluteSleep();
1245 
1247  void dispatchTime();
1248 
1250  void dispatchSerialOut();
1251 
1253  void dispatchSerialRecv();
1254 
1255  // A global static lock. This is needed to allow the global allocator in spacewasm
1256  // to not require to pass context to fine grained context to allocations.
1257  // Read more about this in the SDD.
1258  static Os::Mutex* getGlobalAllocatorLock();
1259 };
1260 
1261 } // namespace Svc
1262 
1263 #endif
struct Svc::WasmSequencer::PendingHostFunction::Args::@775 asleep
struct Svc::WasmSequencer::PendingHostFunction::Args::@774 rsleep
FwIdType FwOpcodeType
The type of a command opcode.
PlatformSizeType FwSizeType
Auto-generated base for WasmSequencer component.
constexpr FwSizeType SPACEWASM_PAGE_SIZE
U8 maxGuestModules
Maximum number of Wasm modules that may be loaded into the sequencer's store.
FwIdType FwPrmIdType
The type of a parameter identifier.
Link-time delegating Mutex implementation.
WasmSequencer(const char *const compName)
Construct WasmSequencer object.
struct spacewasm_caller_t spacewasm_caller_t
Definition: spacewasm.h:369
SerialInQueueFullBehavior
Configuration to select what happens when a serialIn fills.
Enum representing a command response.
void deinit() override
Tear down the allocations made by configure()
~WasmSequencer()=default
Destroy WasmSequencer object.
WasmSequencer & operator=(const WasmSequencer &)=delete
T
The raw enum type.
struct Svc::WasmSequencer::PendingHostFunction::Args::@772 parameter
struct Svc::WasmSequencer::PendingHostFunction::Args::@778 serialRecv
static constexpr FwSizeType SPACEWASM_MEMORY_ALIGNMENT
SpaceWasm has a hard-coded memory alignment requirement.
float F32
32-bit floating point
Definition: BasicTypes.h:84
spacewasm_trap_t
Definition: spacewasm.h:266
SerialInQueueFullBehavior fullBehavior
Overflow policy applied when a new frame does not fit.
Per-port serialIn queue configuration.
struct Svc::WasmSequencer::PendingHostFunction::Args::@773 event
SerialInQueueConfig serialIn[NUM_SERIALIN_INPUT_PORTS]
void configure(const Config &cfg, Fw::MemAllocator &mallocator)
External serialize buffer with no copy semantics.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
Sequencer blocking state.
struct Svc::WasmSequencer::PendingHostFunction::Args::@771 telemetry
struct Svc::WasmSequencer::PendingHostFunction::Args::@770 command
spacewasm_hostcall_result_t
Definition: spacewasm.h:160
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Trigger an assertion if the queue fills and cannot process another message.
Per-kind call arguments. Only the arm matching kind is live.
Drop the latest message if it cannot fit in the remaining queue space.
struct spacewasm_t spacewasm_t
Definition: spacewasm.h:361
Memory Allocation base class.
spacewasm_status_t
Definition: spacewasm.h:37
friend class WasmSequencerTester
PlatformIndexType FwIndexType
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
Definition: BasicTypes.h:86
Fw::MallocAllocator mallocator
Definition: RefTopology.cpp:23
struct Svc::WasmSequencer::PendingHostFunction::Args::@777 serialOut
RateGroupDivider component implementation.
Defines a base class for a memory allocator for classes.
Declares F Prime string base class.
A struct holding the context needed to reply to a command request.
static constexpr FwSizeType SPACEWASM_IR_PAGE_SIZE
struct Svc::WasmSequencer::PendingHostFunction::Args::@776 time
struct spacewasm_allocator_t spacewasm_allocator_t
Definition: spacewasm.h:355
Success/Failure.
FwSizeType size
Queue size in bytes. A port left at size 0 gets no queue (all inbound frames on that index are droppe...
We did not explicitely set the exit reason, bug?