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/launcher/main.cpp b/launcher/main.cpp
index 4ecef3f..18a768d 100644
--- a/launcher/main.cpp
+++ b/launcher/main.cpp
@@ -14,13 +14,14 @@
* limitations under the License.
*/
+#include <android/dlext.h>
#include <dlfcn.h>
#include <cstdlib>
#include <iostream>
#include <string>
-#include <android/dlext.h>
+#include "vm_main.h"
extern "C" {
enum {
@@ -37,10 +38,12 @@
static void* load(const std::string& libname);
+constexpr char entrypoint_name[] = "AVmPayload_main";
+
int main(int argc, char* argv[]) {
- if (argc < 2) {
+ if (argc != 2) {
std::cout << "Usage:\n";
- std::cout << " " << argv[0] << " LIBNAME [ARGS...]\n";
+ std::cout << " " << argv[0] << " LIBNAME\n";
return EXIT_FAILURE;
}
@@ -51,14 +54,13 @@
return EXIT_FAILURE;
}
- int (*entry)(int argc, char* argv[]) = nullptr;
- entry = reinterpret_cast<decltype(entry)>(dlsym(handle, "android_native_main"));
+ AVmPayload_main_t* entry = reinterpret_cast<decltype(entry)>(dlsym(handle, entrypoint_name));
if (entry == nullptr) {
- std::cerr << "Failed to find entrypoint `android_native_main`: " << dlerror() << "\n";
+ std::cerr << "Failed to find entrypoint `" << entrypoint_name << "`: " << dlerror() << "\n";
return EXIT_FAILURE;
}
- return entry(argc - 1, argv + 1);
+ return entry();
}
// Create a new linker namespace whose search path is set to the directory of the library. Then