#include <SDL.h>
#endif
#include "emulator.h"
+#include "guest_debug.h"
#include "sdb.h"
#include "string.h"
#include "skin/maruskin_server.h"
void maru_display_fini(void);
+char *get_logpath(void)
+{
+ return logpath;
+}
+
void exit_emulator(void)
{
mloop_ev_stop();
void prepare_maru(void);
void check_shdmem(void);
void make_shdmem(void);
+
#endif /* __EMULATOR_H__ */
--- /dev/null
+/*
+ * Emulator
+ *
+ * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * HyunJun Son <hj79.son@samsung.com>
+ * MunKyu Im <munkyu.im@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+/**
+ * @file guest_debug.h
+ * @brief - header of file these are config structures and defines in emulator
+ */
+
+#ifndef __GUEST_DEBUG_H__
+#define __GUEST_DEBUG_H__
+
+#include "memory.h"
+
+char *get_logpath(void);
+MemoryRegion *get_ram_memory(void);
+
+#endif /* __GUEST_DEBUG_H__ */
# include <xen/hvm/hvm_info_table.h>
#endif
+#include "guest_debug.h"
+
#define MAX_IDE_BUS 2
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
}
}
+MemoryRegion *global_ram_memory;
+
+MemoryRegion *get_ram_memory(void)
+{
+ return global_ram_memory;
+}
+
static void maru_x86_machine_init(MemoryRegion *system_memory,
MemoryRegion *system_io,
ram_addr_t ram_size,
pci_enabled ? rom_memory : system_memory, &ram_memory);
}
+ // for ramdump...
+ global_ram_memory = ram_memory;
+
gsi_state = g_malloc0(sizeof(*gsi_state));
gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
#include "hw/maru_pm.h"
#include "sysemu.h"
+// for ramdump
+#include "guest_debug.h"
+
#ifdef CONFIG_WIN32
#include "target-i386/hax-i386.h"
#endif
#endif
if (!mloop_evcmd_get_usbkbd_status()) {
- return;
+ return;
}
int scancode = javakeycode_to_scancode(keycode, event_type, key_location);
mloop_evcmd_usbkbd(on);
}
+#define MAX_PATH 256
+static void dump_ram( void )
+{
+ MemoryRegion* rm = get_ram_memory();
+ char dump_fullpath[MAX_PATH];
+ char dump_filename[MAX_PATH];
+
+ char* dump_path = g_path_get_dirname(get_logpath());
+
+ sprintf(dump_filename, "0x%08x%s", rm->ram_addr, "_RAM.dump");
+ sprintf(dump_fullpath, "%s/%s", dump_path, dump_filename);
+ free(dump_path);
+
+ FILE *dump_file = fopen(dump_fullpath, "w+");
+ if(!dump_file) {
+ fprintf(stderr, "Dump file create failed [%s]\n", dump_fullpath);
+
+ return;
+ }
+
+ size_t written;
+ unsigned int size = rm->size.lo;
+ written = fwrite(qemu_get_ram_ptr(rm->ram_addr), sizeof(char), size, dump_file);
+ fprintf(stdout, "Dump file written [%08x][%d bytes]\n", rm->ram_addr, written);
+ if(written != size) {
+ fprintf(stderr, "Dump file size error [%d, %d, %d]\n", written, size, errno);
+ }
+
+ fprintf(stdout, "Dump file create success [%s, %d bytes]\n", dump_fullpath, size);
+
+ fclose(dump_file);
+}
+
void ram_dump(void) {
INFO("ram dump!\n");
- //TODO:
+ dump_ram();
}
void request_close( void )