diff --git a/tools/ssvm/ssvmr.cpp b/tools/ssvm/ssvmr.cpp index 42d0730d50b4f1a2d48cfceb443f955913979a26..2736f3defe3479c00b191d7bfc29ff6e43c01ca8 100644 --- a/tools/ssvm/ssvmr.cpp +++ b/tools/ssvm/ssvmr.cpp @@ -46,6 +46,11 @@ int main(int Argc, const char *Argv[]) { PO::Option SIMD(PO::Description("Enable SIMD"sv)); PO::Option All(PO::Description("Enable all features"sv)); + PO::List MemLim( + PO::Description( + "Limitation of pages(as size of 64 KiB) in every memory instance. Upper bound can be specified as --memory-page-limit `PAGE_COUNT`."sv), + PO::MetaVar("PAGE_COUNT"sv)); + PO::List AllowCmd( PO::Description( "Allow commands called from ssvm_process host functions. Each command can be specified as --allow-command `COMMAND`."sv), @@ -63,6 +68,7 @@ int main(int Argc, const char *Argv[]) { .add_option("enable-reference-types"sv, ReferenceTypes) .add_option("enable-simd"sv, SIMD) .add_option("enable-all"sv, All) + .add_option("memory-page-limit"sv, MemLim) .add_option("allow-command"sv, AllowCmd) .add_option("allow-command-all"sv, AllowCmdAll) .parse(Argc, Argv)) { @@ -88,6 +94,9 @@ int main(int Argc, const char *Argv[]) { Conf.addProposal(SSVM::Proposal::ReferenceTypes); Conf.addProposal(SSVM::Proposal::SIMD); } + if (MemLim.value().size() > 0) { + Conf.setMaxMemoryPage(MemLim.value().back()); + } Conf.addHostRegistration(SSVM::HostRegistration::Wasi); Conf.addHostRegistration(SSVM::HostRegistration::SSVM_Process);