#include #include #include // Call Trampoline With String void run(uint32_t cmd, const char *str) { unsigned char *args = (unsigned char *) str; // Send Command fprintf(stderr, "Guest Is Sending: %u: %s\n", cmd, str); uint32_t ret; raw_trampoline(cmd, &ret, strlen(str) + 1, args); fprintf(stderr, "Guest Has Received: %u\n", ret); } // Main #define INFO(str) fprintf(stderr, "==== %s ====\n", str) int main() { // Normal Calls INFO("Testing Normal Trampoline Calls"); run(0, "Hello World!"); run(1, "Bye World!"); // Calls without a return value *may* return control // to guest code before the call has finished. INFO("Testing Trampoline Call That May Return Early"); raw_trampoline(100, NULL, 0, NULL); fprintf(stderr, "Control Returned To Guest\n"); }