Remove support for command-line args

We no longer support passing string arguments to a VM. Any
customization needed can be done by having the host communicate with
the VM after it starts.

Also start adding a header to provide the entry-point prototype for
better safety.

Bug: 249064104
Bug: 243513572
Test: atest MicrodroidTests MicrodroidHostTestCases
Change-Id: I0a1775f3b6a0b11c71c4831f6c380d96bb637c00
diff --git a/tests/benchmark/Android.bp b/tests/benchmark/Android.bp
index e3f4685..88e4d41 100644
--- a/tests/benchmark/Android.bp
+++ b/tests/benchmark/Android.bp
@@ -30,6 +30,7 @@
 cc_library_shared {
     name: "MicrodroidIdleNativeLib",
     srcs: ["src/native/idlebinary.cpp"],
+    header_libs: ["vm_payload_headers"],
     shared_libs: [
         "libbase",
     ],
diff --git a/tests/benchmark/src/native/benchmarkbinary.cpp b/tests/benchmark/src/native/benchmarkbinary.cpp
index 4e3c14d..842d713 100644
--- a/tests/benchmark/src/native/benchmarkbinary.cpp
+++ b/tests/benchmark/src/native/benchmarkbinary.cpp
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <unistd.h>
+#include <vm_main.h>
 #include <vm_payload.h>
 
 #include <binder_rpc_unstable.hpp>
@@ -172,7 +173,7 @@
 }
 } // Anonymous namespace
 
-extern "C" int android_native_main(int /* argc */, char* /* argv */[]) {
+extern "C" int AVmPayload_main() {
     if (auto res = run_io_benchmark_tests(); !res.ok()) {
         LOG(ERROR) << "IO benchmark test failed: " << res.error() << "\n";
         return EXIT_FAILURE;
diff --git a/tests/benchmark/src/native/idlebinary.cpp b/tests/benchmark/src/native/idlebinary.cpp
index a74e7bf..9499d94 100644
--- a/tests/benchmark/src/native/idlebinary.cpp
+++ b/tests/benchmark/src/native/idlebinary.cpp
@@ -15,8 +15,9 @@
  */
 
 #include <unistd.h>
+#include <vm_main.h>
 
-extern "C" int android_native_main(int /* argc */, char* /* argv */[]) {
+extern "C" int AVmPayload_main() {
     // do nothing; just leave it alive. good night.
     for (;;) {
         sleep(1000);
diff --git a/tests/testapk/Android.bp b/tests/testapk/Android.bp
index e738930..bb17058 100644
--- a/tests/testapk/Android.bp
+++ b/tests/testapk/Android.bp
@@ -51,6 +51,7 @@
 
 cc_library_shared {
     name: "MicrodroidTestNativeCrashLib",
+    header_libs: ["vm_payload_headers"],
     srcs: ["src/native/crashbinary.cpp"],
 }
 
diff --git a/tests/testapk/src/native/crashbinary.cpp b/tests/testapk/src/native/crashbinary.cpp
index 9f80fd0..a0edc40 100644
--- a/tests/testapk/src/native/crashbinary.cpp
+++ b/tests/testapk/src/native/crashbinary.cpp
@@ -17,8 +17,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "vm_main.h"
+
 // A VM payload that crashes as soon as it starts, to allow us to exercise that error path.
-extern "C" int android_native_main(int /* argc */, char* /* argv */[]) {
+extern "C" int AVmPayload_main() {
     printf("test crash!!!!\n");
     abort();
 }
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
index 003aca8..d810e3c 100644
--- a/tests/testapk/src/native/testbinary.cpp
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -27,6 +27,7 @@
 #include <sys/ioctl.h>
 #include <sys/system_properties.h>
 #include <unistd.h>
+#include <vm_main.h>
 #include <vm_payload.h>
 
 #include <binder_rpc_unstable.hpp>
@@ -146,20 +147,13 @@
 
 } // Anonymous namespace
 
-extern "C" int android_native_main(int argc, char* argv[]) {
+extern "C" int AVmPayload_main() {
     // disable buffering to communicate seamlessly
     setvbuf(stdin, nullptr, _IONBF, 0);
     setvbuf(stdout, nullptr, _IONBF, 0);
     setvbuf(stderr, nullptr, _IONBF, 0);
 
-    printf("Hello Microdroid ");
-    for (int i = 0; i < argc; i++) {
-        printf("%s", argv[i]);
-        bool last = i == (argc - 1);
-        if (!last) {
-            printf(" ");
-        }
-    }
+    printf("Hello Microdroid");
     testlib_sub();
     printf("\n");