#ifdef CONFIG_SDL
#if defined(__APPLE__) || defined(main)
#include <SDL.h>
+#ifndef CONFIG_MARU
int qemu_main(int argc, char **argv, char **envp);
int main(int argc, char **argv)
{
#undef main
#define main qemu_main
#endif
+#endif
#endif /* CONFIG_SDL */
#ifdef CONFIG_COCOA
#define main qemu_main
#endif /* CONFIG_COCOA */
+#ifdef CONFIG_MARU
+#ifdef main
+#undef main
+#endif
+int qemu_main(int argc, char **argv, char **envp);
+#define main qemu_main
+#endif
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "migration/migration.h"
#include "sysemu/cpus.h"
#include "sysemu/kvm.h"
+#include "sysemu/hax.h"
#include "qapi/qmp/qjson.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "sysemu/replay.h"
#include "qapi/qmp/qerror.h"
+#ifdef CONFIG_MARU
+#include "tizen/src/emulator.h"
+#include "tizen/src/emul_state.h"
+#include "tizen/src/ui/qt5.h"
+#include "tizen/src/util/ui_operations.h"
+#include "tizen/src/ecs/ecs.h"
+#include "tizen/src/util/error_handler.h"
+#include "tizen/src/util/exported_strings.h"
+
+inline static bool is_maru_machine(MachineClass *mc) {
+ return g_str_has_prefix(mc->name, "maru");
+}
+#endif
+
#define MAX_VIRTIO_CONSOLES 1
#define MAX_SCLP_CONSOLES 1
shutdown_pid = pid;
no_shutdown = 0;
+#ifdef CONFIG_MARU
+ if (current_machine &&
+ is_maru_machine(MACHINE_GET_CLASS(current_machine))) {
+ qemu_system_graceful_shutdown_request(TIMEOUT_FOR_SHUTDOWN);
+ }
+#else
/* Cannot call qemu_system_shutdown_request directly because
* we are in a signal handler.
*/
shutdown_requested = 1;
qemu_notify_event();
+#endif
}
void qemu_system_shutdown_request(void)
#ifdef CONFIG_PROFILER
int64_t ti;
#endif
+
+ hax_sync_vcpus();
+
do {
- nonblocking = !kvm_enabled() && !xen_enabled() && last_io > 0;
+ nonblocking = !kvm_enabled() && !xen_enabled() && !hax_enabled() && last_io > 0;
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
DT_SDL,
DT_COCOA,
DT_GTK,
+#ifdef CONFIG_MARU
+ DT_MARU_REMOTE_SPICE,
+# ifdef CONFIG_QT
+ DT_MARU_QT_ONSCREEN,
+ DT_MARU_QT_OFFSCREEN,
+# endif
+#endif
DT_NONE,
} DisplayType;
error_report("GTK support is disabled");
exit(1);
#endif
+#ifdef CONFIG_MARU
+ } else if (strstart(p, "maru_remote_spice", &opts)) {
+# ifdef CONFIG_SPICE
+ display = DT_MARU_REMOTE_SPICE;
+# else
+ fprintf(stderr, "maru_remote_spice is disabled\n");
+ exit(1);
+# endif
+ } else if (strstart(p, "maru_qt", &opts)) {
+# ifdef CONFIG_QT
+ display = DT_MARU_QT_ONSCREEN;
+ while (*opts) {
+ const char *nextopt;
+ if (strstart(opts, ",rendering=", &nextopt)) {
+ opts = nextopt;
+ if (strstart(opts, "onscreen", &nextopt)) {
+ display = DT_MARU_QT_ONSCREEN;
+ } else if (strstart(opts, "offscreen", &nextopt)) {
+ display = DT_MARU_QT_OFFSCREEN;
+ } else {
+ goto invalid_maru_qt_args;
+ }
+ } else if (strstart(opts, ",resolution=", &nextopt)) {
+ opts = nextopt;
+ char *endptr = NULL;
+ // Resolution should be formed "640x480" or "640*480".
+ int width = (int)g_ascii_strtoll(opts, &endptr, 10);
+ int height = (int)g_ascii_strtoll(++endptr, &endptr, 10);
+ if (width <= 0 || height <= 0) {
+ goto invalid_maru_qt_args;
+ }
+ set_initial_display_resolution(width, height);
+ nextopt = endptr;
+ } else if (strstart(opts, ",dpi=", &nextopt)) {
+ opts = nextopt;
+ char *endptr = NULL;
+ int dpi = (int)g_ascii_strtoll(opts, &endptr, 10);
+ if (dpi <= 0) {
+ goto invalid_maru_qt_args;
+ }
+ set_display_pixel_density(dpi);
+ nextopt = endptr;
+ } else {
+ invalid_maru_qt_args:
+ error_report(FAILED_TO_DISPLAY_PARSING);
+ exit(1);
+ }
+ opts = nextopt;
+ }
+# else
+ error_report("maru_qt is disabled.\n");
+
+ exit(1);
+# endif
+#endif /* CONFIG_MARU */
} else if (strstart(p, "none", &opts)) {
display = DT_NONE;
} else {
return 0;
}
+#ifdef CONFIG_MARU
+// W/A for preserve larger continuous heap for RAM.
+extern void *preallocated_ram_ptr;
+extern int preallocated_ram_size;
+// FIXME
+extern bool nodisplay;
+#endif
+
int main(int argc, char **argv, char **envp)
{
int i;
Error *main_loop_err = NULL;
Error *err = NULL;
bool list_data_dirs = false;
+#ifdef CONFIG_YAGL
+ static bool yagl_enabled = false;
+#endif /* CONFIG_YAGL */
+#ifdef CONFIG_VIGS
+ static bool vigs_enabled = false;
+ static char *vigs_backend = NULL;
+#endif /* CONFIG_VIGS */
qemu_init_cpu_loop();
qemu_mutex_lock_iothread();
olist = qemu_find_opts("machine");
qemu_opts_parse_noisily(olist, "accel=kvm", false);
break;
+ case QEMU_OPTION_enable_yagl:
+#if defined(CONFIG_YAGL)
+ yagl_enabled = true;
+#else
+ fprintf(stderr, "YaGL openGLES passthrough support is disabled,"
+ " ignoring -enable-yagl\n");
+#endif
+ break;
+ case QEMU_OPTION_enable_vigs:
+#if defined(CONFIG_VIGS)
+ vigs_enabled = true;
+#else
+ fprintf(stderr, "VIGS support is disabled,"
+ " ignoring -enable-vigs\n");
+#endif
+ break;
+ case QEMU_OPTION_vigs_backend:
+#if defined(CONFIG_VIGS)
+ vigs_backend = g_strdup(optarg);
+#else
+ fprintf(stderr, "VIGS support is disabled,"
+ " ignoring -vigs-backend\n");
+#endif
+ break;
case QEMU_OPTION_M:
case QEMU_OPTION_machine:
olist = qemu_find_opts("machine");
exit(1);
}
break;
+ case QEMU_OPTION_enable_hax:
+ olist = qemu_find_opts("machine");
+ qemu_opts_parse_noisily(olist, "accel=hax", false);
+ break;
case QEMU_OPTION_add_fd:
#ifndef _WIN32
opts = qemu_opts_parse_noisily(qemu_find_opts("add-fd"),
exit(1);
#endif
break;
+#if defined(CONFIG_MARU)
+ case QEMU_OPTION_enable_suspend:
+ ecs_set_suspend_state(SUSPEND_UNLOCK);
+ break;
+#endif
case QEMU_OPTION_object:
opts = qemu_opts_parse_noisily(qemu_find_opts("object"),
optarg, true);
machine_class = select_machine();
+#if defined(CONFIG_MARU)
+ if (is_maru_machine(machine_class)) {
+ preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL);
+ if (preallocated_ram_ptr) {
+ preallocated_ram_size = ram_size;
+ }
+ }
+#endif
+
set_memory_options(&ram_slots, &maxram_size, machine_class);
os_daemonize();
exit(1);
}
+#ifdef CONFIG_MARU
+# if defined(CONFIG_QT)
+ if (display_type == DT_MARU_QT_ONSCREEN) {
+ maru_early_qt5_display_init(true);
+ } else if (display_type == DT_MARU_QT_OFFSCREEN) {
+ maru_early_qt5_display_init(false);
+ }
+# endif
+#endif
+
page_size_init();
socket_init();
exit(1);
}
- configure_accelerator(current_machine);
-
if (qtest_chrdev) {
qtest_init(qtest_chrdev, qtest_log, &error_fatal);
}
cpu_ticks_init();
if (icount_opts) {
- if (kvm_enabled() || xen_enabled()) {
+ if (kvm_enabled() || xen_enabled() || hax_enabled()) {
error_report("-icount is not allowed with kvm or xen");
exit(1);
}
current_machine->boot_order = boot_order;
current_machine->cpu_model = cpu_model;
+ configure_accelerator(current_machine);
+
+#if defined(CONFIG_MARU)
+ if (is_maru_machine(machine_class)) {
+ kernel_cmdline = qemu_opt_get(machine_opts, "append");
+ // Returned variable points different address from input variable.
+ kernel_cmdline = prepare_maru(kernel_cmdline);
+ qemu_opt_set(qemu_get_machine_opts(), "append",
+ kernel_cmdline, &error_abort);
+
+ current_machine->kernel_cmdline = (char *)kernel_cmdline;
+ if (display_type == DT_NONE) {
+ nodisplay = true;
+ }
+ }
+#endif
+
machine_class->init(current_machine);
realtime_init();
+ // TODO: Check about it...
audio_init();
cpu_synchronize_all_post_init();
exit(1);
}
+ if (hax_enabled()) {
+ hax_sync_vcpus();
+ }
+
/* init USB devices */
if (machine_usb(current_machine)) {
if (foreach_device_config(DEV_USB, usb_parse) < 0)
}
rom_reset_order_override();
+#if defined(CONFIG_MARU)
+ if (is_maru_machine(machine_class)) {
+ prepare_maru_after_device_init();
+ }
+#endif
+#ifdef CONFIG_VIGS
+ // To support legacy VIGS options
+ if (vigs_enabled) {
+ PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL);
+ PCIDevice *pci_dev = pci_create(pci_bus, -1, "vigs");
+ if (vigs_backend) {
+ qdev_prop_set_string(&pci_dev->qdev, "backend", vigs_backend);
+ } else {
+ qdev_prop_set_string(&pci_dev->qdev, "backend", "gl");
+ }
+ qdev_prop_set_string(&pci_dev->qdev, "wsi", "wsi0");
+ qdev_init_nofail(&pci_dev->qdev);
+ }
+#endif
+#ifdef CONFIG_YAGL
+ // To support legacy YaGL options
+ if (yagl_enabled) {
+ PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL);
+ PCIDevice *pci_dev = pci_create(pci_bus, -1, "yagl");
+ if (vigs_enabled) {
+ qdev_prop_set_string(&pci_dev->qdev, "wsi", "wsi0");
+ }
+ qdev_init_nofail(&pci_dev->qdev);
+ }
+#endif
+
/* Did we create any drives that we failed to create a device for? */
drive_check_orphaned();
case DT_GTK:
gtk_display_init(ds, full_screen, grab_on_hover);
break;
+#if defined(CONFIG_MARU)
+ #if defined(CONFIG_QT)
+ case DT_MARU_QT_ONSCREEN:
+ case DT_MARU_QT_OFFSCREEN:
+ if (!is_maru_machine(machine_class)) {
+ error_report("maru_qt can not work"
+ " without maru machine");
+ exit(1);
+ }
+ maru_qt5_display_init(ds, full_screen);
+ break;
+ #endif
+#endif
default:
break;
}
os_setup_post();
+#ifdef CONFIG_MARU
+ enable_print_backtrace_at_normal_exit();
+#endif
trace_init_vcpu_events();
main_loop();
replay_disable_events();