sencha: add WaitForCli property
Change-Id: I3618cb99969d189d30a749d701242c8db4463574
diff --git a/sencha.resc b/sencha.resc
index ce9b76f..b77b779 100644
--- a/sencha.resc
+++ b/sencha.resc
@@ -63,6 +63,7 @@
# Override cli_port to enable the command line interface on the specified port.
$cli_port?= -1
sysbus.cpu1 CliPort $cli_port
+sysbus.cpu1 WaitForCli true
# Setup ram_smc to coordinate with cpu1
sysbus.ram_smc CpuLibraryPath $cheriotLibrary
diff --git a/shodan_infrastructure/MpactCheriotCPU.cs b/shodan_infrastructure/MpactCheriotCPU.cs
index 281d260..072ddaa 100644
--- a/shodan_infrastructure/MpactCheriotCPU.cs
+++ b/shodan_infrastructure/MpactCheriotCPU.cs
@@ -119,12 +119,14 @@
config_values.Add("0x" + memorySize.ToString("X"));
config_values.Add("0x" + revocationMemBase.ToString("X"));
config_values.Add("0x" + clintBase.ToString("X"));
+
if (cli_port != -1) {
config_names.Add("cliPort");
config_values.Add("0x" + cli_port.ToString("X"));
config_names.Add("waitForCLI");
- config_values.Add("0x1");
+ config_values.Add("0x" + Convert.ToInt32(wait_for_cli).ToString("X"));
}
+
Int32 cfg_res = set_config(mpact_id, config_names.ToArray(), config_values.ToArray(), config_names.Count);
if (cfg_res < 0) {
LogAndThrowRE("Failed to set configuration information");
@@ -181,6 +183,11 @@
}
public int CliPort { get => cli_port; set => cli_port = value; }
+ public bool WaitForCli
+ {
+ get => wait_for_cli;
+ set => wait_for_cli = value;
+ }
public override ulong ExecutedInstructions => totalExecutedInstructions;
@@ -494,6 +501,7 @@
private string cpuLibraryPath;
private bool cpuLibraryRegistered;
private int cli_port = -1;
+ private bool wait_for_cli = false;
private NativeBinder binder;
private readonly object nativeLock;
private readonly Int32 maxStringLen = 32;