From 24204cc964cf7d56b1a20c12ece08eecab1093fa Mon Sep 17 00:00:00 2001 From: Tim Baverstock Date: Thu, 25 Nov 2010 11:37:43 +0000 Subject: Augment the auto-loadvm behaviour with corresponding auto-savevm-on-exit behaviour. Autosave fires when loadvm would have been tried - whether it succeeded or not - in order to bootstrap from an empty snapshot file. - New autosave behaviour inhibited with -no_snapshot_save flag. - Underlying behaviour implemented with a new qemu option -savevm_on_exit Change-Id: If64d89f004565ecbb431bc7e96ecc37e27876d67 --- vl-android.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'vl-android.c') diff --git a/vl-android.c b/vl-android.c index 1f65c3b..6d99d6d 100644 --- a/vl-android.c +++ b/vl-android.c @@ -394,6 +394,10 @@ extern int android_display_bpp; extern void dprint( const char* format, ... ); +#if CONFIG_ANDROID_SNAPSHOTS +const char* savevm_on_exit = NULL; +#endif + #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) /* Reports the core initialization failure to the error stdout and to the UI @@ -3234,8 +3238,14 @@ static void main_loop(void) if (no_shutdown) { vm_stop(0); no_shutdown = 0; - } else + } else { +#if CONFIG_ANDROID_SNAPSHOTS + if (savevm_on_exit != NULL) { + do_savevm(cur_mon, savevm_on_exit); + } +#endif break; + } } if (qemu_reset_requested()) { pause_all_vcpus(); @@ -4292,9 +4302,14 @@ int main(int argc, char **argv, char **envp) parallel_devices[parallel_device_index] = optarg; parallel_device_index++; break; - case QEMU_OPTION_loadvm: - loadvm = optarg; - break; + case QEMU_OPTION_loadvm: + loadvm = optarg; + break; +#if CONFIG_ANDROID_SNAPSHOTS + case QEMU_OPTION_savevm_on_exit: + savevm_on_exit = optarg; + break; +#endif case QEMU_OPTION_full_screen: full_screen = 1; break; -- cgit v1.1