#include "ui/console.h"
#include "ui/input.h"
#include "sysemu/sysemu.h"
-
#include "trace.h"
+#ifdef CONFIG_MARU
+/* to guarantee safe serialization of input event by Munkyu Im */
+#include "qemu/thread.h"
+static QemuMutex mutex;
+#endif
+
/* debug PC keyboard */
//#define DEBUG_KBD
while (s->common.queue.count < PS2_QUEUE_SIZE - 4) {
/* if not remote, send event. Multiple events are sent if
too big deltas */
+#ifdef CONFIG_MARU
+/* to guarantee safe serialization of input event by Munkyu Im */
+ qemu_mutex_lock(&mutex);
ps2_mouse_send_packet(s);
+ qemu_mutex_unlock(&mutex);
+#else
+ ps2_mouse_send_packet(s);
+#endif
if (s->mouse_dx == 0 && s->mouse_dy == 0 && s->mouse_dz == 0)
break;
}
qemu_input_handler_register((DeviceState *)s,
&ps2_mouse_handler);
qemu_register_reset(ps2_mouse_reset, s);
+#ifdef CONFIG_MARU
+ /* to guarantee safe serialization of input event by Munkyu Im */
+ qemu_mutex_init(&mutex);
+#endif
return s;
}