aboutsummaryrefslogtreecommitdiffstats
path: root/vl-android.c
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2012-01-12 13:37:40 -0800
committerVladimir Chtchetkine <vchtchetkine@google.com>2012-01-13 08:16:05 -0800
commitdb450d73092add519efddcd6d55c7a0e7541ec70 (patch)
treea4de5f7d4c9d1fb35a376dcd198da8c06c846b4f /vl-android.c
parentaa1af37d8b3c3a21eb4cac4a225225425b50d08c (diff)
downloadexternal_qemu-db450d73092add519efddcd6d55c7a0e7541ec70.zip
external_qemu-db450d73092add519efddcd6d55c7a0e7541ec70.tar.gz
external_qemu-db450d73092add519efddcd6d55c7a0e7541ec70.tar.bz2
Respect HW configs when loading VM from snapshots.
Changing HW configuration properties may cause emulator / guest system crash on condition that VM has been loaded from a snapshot. This CL addresses this issue in the following way: 1. Each time a snapshot is saved, a backup copy of HW config is saved with it. 2. Each time a snapshot is loaded, emulator finds an appropriate HW config backup, and compares current HW config with the one that was saved in the backup, and if configs are different, emulator exits with an appropriate error. Change-Id: I730bec0afbe166e88189fdcc4804b76e109e4422
Diffstat (limited to 'vl-android.c')
-rw-r--r--vl-android.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/vl-android.c b/vl-android.c
index 322ddca..8f439ac 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -208,6 +208,8 @@ int qemu_main(int argc, char **argv, char **envp);
#include "android/core-init-utils.h"
#include "android/audio-test.h"
+#include "android/snaphost-android.h"
+
#ifdef CONFIG_STANDALONE_CORE
/* Verbose value used by the standalone emulator core (without UI) */
unsigned long android_verbose;
@@ -235,8 +237,6 @@ extern void android_emulator_set_base_port(int port);
#include "libslirp.h"
#endif
-
-
#define DEFAULT_RAM_SIZE 128
/* Max number of USB devices that can be specified on the commandline. */
@@ -2025,6 +2025,10 @@ static void main_loop(void)
no_shutdown = 0;
} else {
if (savevm_on_exit != NULL) {
+ /* Prior to saving VM to the snapshot file, save HW config
+ * settings for that VM, so we can match them when VM gets
+ * loaded from the snapshot. */
+ snaphost_save_config(savevm_on_exit);
do_savevm(cur_mon, savevm_on_exit);
}
break;
@@ -3511,6 +3515,12 @@ int main(int argc, char **argv, char **envp)
androidHwConfig_init(android_hw, 0);
androidHwConfig_read(android_hw, hw_ini);
+ /* If we're loading VM from a snapshot, make sure that the current HW config
+ * matches the one with which the VM has been saved. */
+ if (loadvm && *loadvm && !snaphost_match_configs(hw_ini, loadvm)) {
+ exit(0);
+ }
+
iniFile_free(hw_ini);
{
@@ -4229,7 +4239,6 @@ int main(int argc, char **argv, char **envp)
stralloc_reset(kernel_config);
}
-
for (env = first_cpu; env != NULL; env = env->next_cpu) {
for (i = 0; i < nb_numa_nodes; i++) {
if (node_cpumask[i] & (1 << env->cpu_index)) {