From: SeokYeon Hwang Date: Tue, 17 Jun 2014 04:40:08 +0000 (+0900) Subject: emulator: fix legacy arguments compatibility issue X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~228^2^2~136 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7133c930629072c48138fc86e54986f0e9691eb;p=sdk%2Femulator%2Fqemu.git emulator: fix legacy arguments compatibility issue Fix legacy arguments compatibility issue. Fix memory break related with RAM preallocation. Change-Id: Ia43f1367a8910f9bf52383ac703123c9998c2f06 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 1d08894cf9..4e43cac90d 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -73,10 +73,10 @@ char tizen_target_img_path[PATH_MAX]; int enable_yagl = 0; int enable_spice = 0; -static int _skin_argc; -static char **_skin_argv; -static int _qemu_argc; -static char **_qemu_argv; +int _skin_argc; +char **_skin_argv; +int _qemu_argc; +char **_qemu_argv; const char *get_log_path(void) { diff --git a/tizen/src/emulator_legacy.c b/tizen/src/emulator_legacy.c index 132d43ff15..e8304eb9f5 100644 --- a/tizen/src/emulator_legacy.c +++ b/tizen/src/emulator_legacy.c @@ -83,10 +83,10 @@ extern char tizen_target_img_path[PATH_MAX]; extern int enable_yagl; extern int enable_spice; -static int _skin_argc; -static char **_skin_argv; -static int _qemu_argc; -static char **_qemu_argv; +extern int _skin_argc; +extern char **_skin_argv; +extern int _qemu_argc; +extern char **_qemu_argv; static void set_bin_path(gchar * exec_argv) { diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 11ff7e2fba..c2bd47c2fb 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -141,13 +141,17 @@ void *qemu_memalign(size_t alignment, size_t size) #ifdef CONFIG_MARU void *preallocated_ram_ptr = NULL; +int preallocated_ram_size = -1; #endif /* alloc shared memory pages */ void *qemu_anon_ram_alloc(size_t size) { #ifdef CONFIG_MARU - if (preallocated_ram_ptr) { - return preallocated_ram_ptr; + if (size == preallocated_ram_size && preallocated_ram_ptr) { + void *ptr = preallocated_ram_ptr; + preallocated_ram_ptr = NULL; + preallocated_ram_size = -1; + return ptr; } #endif size_t align = QEMU_VMALLOC_ALIGN; diff --git a/util/oslib-win32.c b/util/oslib-win32.c index e03c9fe6ca..fed8de3896 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -172,6 +172,7 @@ void *qemu_memalign(size_t alignment, size_t size) #ifdef CONFIG_MARU void *preallocated_ram_ptr = NULL; +int preallocated_ram_size = -1; #endif void *qemu_anon_ram_alloc(size_t size) { @@ -181,8 +182,11 @@ void *qemu_anon_ram_alloc(size_t size) has 64Kb granularity, but at least it guarantees us that the memory is page aligned. */ #ifdef CONFIG_MARU - if (preallocated_ram_ptr) { - return preallocated_ram_ptr; + if (size == preallocated_ram_size && preallocated_ram_ptr) { + void *ptr = preallocated_ram_ptr; + preallocated_ram_ptr = NULL; + preallocated_ram_size = -1; + return ptr; } #endif ptr = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE); diff --git a/vl.c b/vl.c index e424fe82a6..0c0b337ad4 100644 --- a/vl.c +++ b/vl.c @@ -2990,6 +2990,7 @@ int use_qemu_display = 0; //0:use tizen qemu sdl, 1:use original qemu sdl // W/A for preserve larger continuous heap for RAM. extern void *preallocated_ram_ptr; +extern int preallocated_ram_size; #endif int main(int argc, char **argv, char **envp) @@ -4082,6 +4083,9 @@ int main(int argc, char **argv, char **envp) #if defined(CONFIG_MARU) preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size); + if (preallocated_ram_ptr) { + preallocated_ram_size = ram_size; + } kernel_cmdline = qemu_opt_get(qemu_get_machine_opts(), "append"); // Returned variable points different address from input variable.