obj-y += hw/$(TARGET_BASE_ARCH)/
endif
- GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h qmp-commands-old.h
+ GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h
+# Makefile for TIZEN-maru
+ifdef CONFIG_MARU
+obj-y += tizen/src/
+endif
+##
+
endif # CONFIG_SOFTMMU
# Workaround for http://gcc.gnu.org/PR55489, see configure.
#include "sysemu/qtest.h"
#include "hw/xen/xen.h"
#include "qom/object.h"
- #include "hw/boards.h"
+#include "sysemu/hax.h"
+#include "qemu/error-report.h"
int tcg_tb_size;
static bool tcg_allowed = true;
QemuOpts *opts;
Error *local_err = NULL;
const char *filename;
+ bool use_aio;
int ret;
+ DWORD overlapped;
+ int access_flags;
s->type = FTYPE_FILE;
s->hfile = CreateFile(filename, access_flags,
FILE_SHARE_READ, NULL,
OPEN_EXISTING, overlapped, NULL);
- if (s->hfile == INVALID_HANDLE_VALUE) {
+ if (s->hfile == INVALID_HANDLE_VALUE) {
int err = GetLastError();
+ error_setg_win32(errp, err, "Could not open '%s'", filename);
if (err == ERROR_ACCESS_DENIED) {
ret = -EACCES;
} else {
static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states =
QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states);
- static int do_open_tray(const char *device, bool force, Error **errp);
+#ifdef CONFIG_MARU
+#include "tizen/src/util/exported_strings.h"
+#endif
+
+ static int do_open_tray(const char *blk_name, const char *qdev_id,
+ bool force, Error **errp);
static const char *const if_name[IF_COUNT] = {
[IF_NONE] = "none",
vhost_net="no"
vhost_scsi="no"
+ vhost_vsock="no"
kvm="no"
+hax="no"
+ colo="yes"
rdma=""
gprof="no"
debug_tcg="no"
numa=""
tcmalloc="no"
jemalloc="no"
+ replication="yes"
+yagl="no"
+yagl_stats="no"
+glx=""
+vigs="no"
+libtizenusb="no"
+
+# for TIZEN-maru
+maru="no"
+winver="0x501"
+libav=""
+libpng="no"
+dxva2=""
+vaapi=""
+qt="no"
+qtabi="5.0"
+extension_path=""
+#
+
# parse CC options first
for opt do
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
;;
--enable-kvm) kvm="yes"
;;
+ --disable-hax) hax="no"
+ ;;
+ --enable-hax) hax="yes"
+ ;;
+ --disable-colo) colo="no"
+ ;;
+ --enable-colo) colo="yes"
+ ;;
--disable-tcg-interpreter) tcg_interpreter="no"
;;
--enable-tcg-interpreter) tcg_interpreter="yes"
;;
--enable-jemalloc) jemalloc="yes"
;;
+ --disable-replication) replication="no"
+ ;;
+ --enable-replication) replication="yes"
+ ;;
+# for TIZEN-maru
+ --enable-maru) maru="yes"
+ ;;
+ --winver=*) winver="$optarg"
+ ;;
+ --enable-libav) libav="yes"
+ ;;
+ --disable-libav) libav="no"
+ ;;
+ --enable-libpng) libpng="yes"
+ ;;
+ --enable-dxva2) dxva2="yes"
+ ;;
+ --disable-dxva2) dxva2="no"
+ ;;
+ --enable-vaapi) vaapi="yes"
+ ;;
+ --disable-vaapi) vaapi="no"
+ ;;
+ --disable-qt) qt="no"
+ ;;
+ --enable-qt) qt="yes"
+ ;;
+ --extension-path=*) extension_path="$optarg"
+ ;;
+#
*)
echo "ERROR: unknown option $opt"
echo "Try '$0 --help' for more information"
numa libnuma support
tcmalloc tcmalloc support
jemalloc jemalloc support
+ replication replication support
+
+ qt Qt5 UI
+ hax HAX acceleration support
+ yagl YaGL device
+ yagl-stats YaGL stats
+ vigs VIGS device
+
+TIZEN-maru options:
+ --enable-maru enable maru board
+ --winver=WINVER set WINVER
+ --enable-libav enable libav library
+ --disable-libav disable libav library
+ --enable-libpng enable png library
+ --enable-dxva2 enable dxva2 support
+ --disable-dxva2 disable dxva2 support
+ --ensable-vaapi enable vaapi support
+ --disable-vaapi disable vaapi support
+ --extension-path=PATH set extension path
+
NOTE: The object files are built at the place where configure is launched
EOF
exit 0
##########################################
# avx2 optimization requirement check
-
- if test "$static" = "no" ; then
- cat > $TMPC << EOF
+ cat > $TMPC << EOF
+#ifndef __clang__
#pragma GCC push_options
#pragma GCC target("avx2")
#include <cpuid.h>
#include <immintrin.h>
-
static int bar(void *a) {
- return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a, (__m256i){0}));
+ __m256i x = *(__m256i *)a;
+ return _mm256_testz_si256(x, x);
}
- static void *bar_ifunc(void) {return (void*) bar;}
- int foo(void *a) __attribute__((ifunc("bar_ifunc")));
- int main(int argc, char *argv[]) { return foo(argv[0]);}
+ int main(int argc, char *argv[]) { return bar(argv[0]); }
+#endif //__clang__
EOF
- if compile_object "" ; then
- if has readelf; then
- if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
- avx2_opt="yes"
- fi
- fi
- fi
+ if compile_object "" ; then
+ avx2_opt="yes"
fi
#########################################
echo "tcmalloc support $tcmalloc"
echo "jemalloc support $jemalloc"
echo "avx2 optimization $avx2_opt"
+ echo "replication support $replication"
+echo "Qt support $qt"
+echo "HAX support $hax"
+echo "YaGL support $yagl"
+echo "YaGL stats $yagl_stats"
+echo "VIGS support $vigs"
+
+# for TIZEN-maru
+if test "$maru" = "yes"; then
+echo "TIZEN-maru options:"
+echo "maru enabled $maru"
+ if test "$mingw32" = "yes"; then
+echo "WINVER $winver"
+ fi
+echo "libav support $libav"
+echo "libpng support $libpng"
+echo "DXVA2 support $dxva2"
+echo "vaapi support $vaapi"
+echo "libtizenusb support $libtizenusb"
+echo "extension path $extension_path"
+fi
+#
+
if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
fi
if (cpu_handle_exception(cpu, &ret)) {
break;
}
-
+#ifdef CONFIG_HAX
+ if (hax_enabled() && !hax_vcpu_exec(cpu)) {
+ break;
+ }
+#endif
- cpu->tb_flushed = false; /* reset before first TB lookup */
for(;;) {
cpu_handle_interrupt(cpu, &last_tb);
- tb = tb_find_fast(cpu, &last_tb, tb_exit);
+ tb = tb_find(cpu, last_tb, tb_exit);
cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc);
+#ifdef CONFIG_HAX
+ if (hax_enabled() && hax_stop_emulation(cpu))
+ cpu_loop_exit(cpu);
+#endif
/* Try to align the host and virtual clocks
if the guest is in advance */
align_clocks(&sc, cpu);
-> { "execute": "set_link", "arguments": { "name": "e1000.0", "up": false } }
<- { "return": {} }
- EQMP
-
-
- {
- .name = "get_link",
- .args_type = "name:s",
- .mhandler.cmd_new = qmp_marshal_get_link,
- },
-
- SQMP
+get_link
+--------
+
+Get the link status of a network adapter.
+
+Arguments:
+
+- "name": network device name (json-string)
+
+Example:
+
+-> { "execute": "get_link", "arguments": { "name": "e1000.0" } }
+<- { "return": {on|off} }
+
- EQMP
-
- {
- .name = "getfd",
- .args_type = "fdname:s",
- .params = "getfd name",
- .help = "receive a file descriptor via SCM rights and assign it a name",
- .mhandler.cmd_new = qmp_marshal_getfd,
- },
-
- SQMP
getfd
-----
if (new_block->host) {
qemu_ram_setup_dump(new_block->host, new_block->max_length);
qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
+ /* MADV_DONTFORK is also needed by KVM in absence of synchronous MMU */
qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
- if (kvm_enabled()) {
- kvm_setup_guest_memory(new_block->host, new_block->max_length);
- }
+#ifdef CONFIG_HAX
+ /*
+ * In Hax, the qemu allocate the virtual address, and HAX kernel
+ * populate the memory with physical memory. Currently we have no
+ * paging, so user should make sure enough free memory in advance
+ */
+ if (hax_enabled()) {
+ int ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host,
+ new_block->max_length);
+ if (ret < 0) {
+ fprintf(stderr, "HAX failed to populate ram\n");
+ exit(-1);
+ }
+ }
+#endif
}
}
@findex set_link
Switch link @var{name} on (i.e. up) or off (i.e. down).
ETEXI
+
{
- .mhandler.cmd = hmp_get_link,
+ .name = "get_link",
+ .args_type = "name:s",
+ .params = "name",
+ .help = "get the link status of a network adapter",
++ .cmd = hmp_get_link,
+ },
+
+STEXI
+
+@item get_link @var{name}
+@findex get_link
+Get the link status of @var{name}.
+ETEXI
+
+ {
.name = "watchdog_action",
.args_type = "action:s",
.params = "[reset|shutdown|poweroff|pause|debug|none]",
#include "qapi-visit.h"
#include "qom/cpu.h"
#include "hw/nmi.h"
+ #include "hw/i386/intel_iommu.h"
+#include "sysemu/hax.h"
+
/* debug PC/ISA interrupts */
//#define DEBUG_IRQ
void audio_init(void);
int kvm_available(void);
int xen_available(void);
+int hax_available(void);
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
+ CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
+ CpuModelInfo *mode,
+ Error **errp);
+ CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela,
+ CpuModelInfo *modelb,
+ Error **errp);
+ CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *modela,
+ CpuModelInfo *modelb,
+ Error **errp);
#endif
monitor_flush(opaque);
}
++#ifdef CONFIG_MARU
++static QLIST_HEAD(, ErrorReporter) error_reporters =
++ QLIST_HEAD_INITIALIZER(error_reporters);
++
++void add_error_reporter(ErrorReporter *new_reporter)
++{
++ QLIST_INSERT_HEAD(&error_reporters, new_reporter, node);
++}
++
++static void report_to_clients(const char *fmt, va_list ap)
++{
++ ErrorReporter *reporter;
++ QLIST_FOREACH(reporter, &error_reporters, node) {
++ if (reporter->report) {
++ (*(reporter->report))(fmt, ap);
++ }
++ }
++}
++#endif
++
+ /*
+ * Print to current monitor if we have one, else to stderr.
+ * TODO should return int, so callers can calculate width, but that
+ * requires surgery to monitor_vprintf(). Left for another day.
+ */
+ void error_vprintf(const char *fmt, va_list ap)
+ {
+ if (cur_mon && !monitor_cur_is_qmp()) {
+ monitor_vprintf(cur_mon, fmt, ap);
+ } else {
++#ifdef CONFIG_MARU
++ va_list ap_copy;
++ va_copy(ap_copy, ap);
++ vfprintf(stderr, fmt, ap_copy);
++ va_end(ap_copy);
++ report_to_clients(fmt, ap);
++#else
+ vfprintf(stderr, fmt, ap);
++#endif
+ }
+ }
+
+ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
+ {
+ if (cur_mon && !monitor_cur_is_qmp()) {
+ monitor_vprintf(cur_mon, fmt, ap);
+ }
+ }
+
static void __attribute__((constructor)) monitor_lock_init(void)
{
qemu_mutex_init(&monitor_lock);
}
}
+ /* The action method for the About menu item */
+ - (IBAction) do_about_menu_item: (id) sender
+ {
+ [about_window makeKeyAndOrderFront: nil];
+ }
+
+ /* Create and display the about dialog */
+ - (void)make_about_window
+ {
+ /* Make the window */
+ int x = 0, y = 0, about_width = 400, about_height = 200;
+ NSRect window_rect = NSMakeRect(x, y, about_width, about_height);
+ about_window = [[NSWindow alloc] initWithContentRect:window_rect
+ styleMask:NSTitledWindowMask | NSClosableWindowMask |
+ NSMiniaturizableWindowMask
+ backing:NSBackingStoreBuffered
+ defer:NO];
+ [about_window setTitle: @"About"];
+ [about_window setReleasedWhenClosed: NO];
+ [about_window center];
+ NSView *superView = [about_window contentView];
+
+ /* Create the dimensions of the picture */
+ int picture_width = 80, picture_height = 80;
+ x = (about_width - picture_width)/2;
+ y = about_height - picture_height - 10;
+ NSRect picture_rect = NSMakeRect(x, y, picture_width, picture_height);
+
+ /* Get the path to the QEMU binary */
+ NSString *binary_name = [NSString stringWithCString: gArgv[0]
+ encoding: NSASCIIStringEncoding];
+ binary_name = [binary_name lastPathComponent];
+ NSString *program_path = [[NSString alloc] initWithFormat: @"%@/%@",
+ [[NSBundle mainBundle] bundlePath], binary_name];
+
+ /* Make the picture of QEMU */
+ NSImageView *picture_view = [[NSImageView alloc] initWithFrame:
+ picture_rect];
+ NSImage *qemu_image = [[NSWorkspace sharedWorkspace] iconForFile:
+ program_path];
+ [picture_view setImage: qemu_image];
+ [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown];
+ [superView addSubview: picture_view];
+
+ /* Make the name label */
+ x = 0;
+ y = y - 25;
+ int name_width = about_width, name_height = 20;
+ NSRect name_rect = NSMakeRect(x, y, name_width, name_height);
+ NSTextField *name_label = [[NSTextField alloc] initWithFrame: name_rect];
+ [name_label setEditable: NO];
+ [name_label setBezeled: NO];
+ [name_label setDrawsBackground: NO];
+ [name_label setAlignment: NSCenterTextAlignment];
+ NSString *qemu_name = [[NSString alloc] initWithCString: gArgv[0]
+ encoding: NSASCIIStringEncoding];
+ qemu_name = [qemu_name lastPathComponent];
+ [name_label setStringValue: qemu_name];
+ [superView addSubview: name_label];
+
+ /* Set the version label's attributes */
+ x = 0;
+ y = 50;
+ int version_width = about_width, version_height = 20;
+ NSRect version_rect = NSMakeRect(x, y, version_width, version_height);
+ NSTextField *version_label = [[NSTextField alloc] initWithFrame:
+ version_rect];
+ [version_label setEditable: NO];
+ [version_label setBezeled: NO];
+ [version_label setAlignment: NSCenterTextAlignment];
+ [version_label setDrawsBackground: NO];
+
+ /* Create the version string*/
+ NSString *version_string;
+ version_string = [[NSString alloc] initWithFormat:
+ @"QEMU emulator version %s%s", QEMU_VERSION, QEMU_PKGVERSION];
+ [version_label setStringValue: version_string];
+ [superView addSubview: version_label];
+
+ /* Make copyright label */
+ x = 0;
+ y = 35;
+ int copyright_width = about_width, copyright_height = 20;
+ NSRect copyright_rect = NSMakeRect(x, y, copyright_width, copyright_height);
+ NSTextField *copyright_label = [[NSTextField alloc] initWithFrame:
+ copyright_rect];
+ [copyright_label setEditable: NO];
+ [copyright_label setBezeled: NO];
+ [copyright_label setDrawsBackground: NO];
+ [copyright_label setAlignment: NSCenterTextAlignment];
+ [copyright_label setStringValue: [NSString stringWithFormat: @"%s",
+ QEMU_COPYRIGHT]];
+ [superView addSubview: copyright_label];
+ }
+
@end
+#ifdef CONFIG_MARU
+int cocoa_main (int argc, const char * argv[]);
+#define main cocoa_main
+#endif
int main (int argc, const char * argv[]) {
#include "qemu/mmap-alloc.h"
+ #ifdef CONFIG_DEBUG_STACK_USAGE
+ #include "qemu/error-report.h"
+ #endif
+
+#ifdef CONFIG_MARU
+#include "qemu/error-report.h"
+#include "../../tizen/src/emulator_common.h"
+#endif
+
int qemu_get_thread_id(void)
{
#if defined(__linux__)
#include "audio/audio.h"
#include "migration/migration.h"
#include "sysemu/cpus.h"
+ #include "migration/colo.h"
#include "sysemu/kvm.h"
+#include "sysemu/hax.h"
#include "qapi/qmp/qjson.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "crypto/init.h"
#include "sysemu/replay.h"
#include "qapi/qmp/qerror.h"
+ #include "sysemu/iothread.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
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 */
+ module_call_init(MODULE_INIT_TRACE);
+
+ qemu_init_cpu_list();
qemu_init_cpu_loop();
qemu_mutex_lock_iothread();
os_setup_post();
- trace_init_vcpu_events();
+#ifdef CONFIG_MARU
+ enable_print_backtrace_at_normal_exit();
+#endif
main_loop();
replay_disable_events();
+ iothread_stop_all();
bdrv_close_all();
pause_all_vcpus();