]> git.proxmox.com Git - mirror_qemu.git/blobdiff - vl.c
Bail out if -append or -initrd is specified without -kernel, by
[mirror_qemu.git] / vl.c
diff --git a/vl.c b/vl.c
index 00d43eeeee02b49863053398836280a2c6913ef9..c8db57983b146ffb138896e554fd4771b569899a 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -239,9 +239,9 @@ struct drive_opt {
 static CPUState *cur_cpu;
 static CPUState *next_cpu;
 static int event_pending = 1;
-/* Conversion factor from emulated instrctions to virtual clock ticks.  */
+/* Conversion factor from emulated instructions to virtual clock ticks.  */
 static int icount_time_shift;
-/* Arbitrarily pick 1MIPS as the minimum alowable speed.  */
+/* Arbitrarily pick 1MIPS as the minimum allowable speed.  */
 #define MAX_ICOUNT_SHIFT 10
 /* Compensate for varying guest execution speed.  */
 static int64_t qemu_icount_bias;
@@ -903,7 +903,7 @@ static void rtc_stop_timer(struct qemu_alarm_timer *t);
 #endif /* _WIN32 */
 
 /* Correlation between real and virtual time is always going to be
-   farly approximate, so ignore small variation.
+   fairly approximate, so ignore small variation.
    When the guest is idle real and virtual time will be aligned in
    the IO wait loop.  */
 #define ICOUNT_WOBBLE (QEMU_TIMER_BASE / 10)
@@ -6060,6 +6060,8 @@ typedef struct SaveStateEntry {
 
 static SaveStateEntry *first_se;
 
+/* TODO: Individual devices generally have very little idea about the rest
+   of the system, so instance_id should be removed/replaced.  */
 int register_savevm(const char *idstr,
                     int instance_id,
                     int version_id,
@@ -6073,7 +6075,7 @@ int register_savevm(const char *idstr,
     if (!se)
         return -1;
     pstrcpy(se->idstr, sizeof(se->idstr), idstr);
-    se->instance_id = instance_id;
+    se->instance_id = (instance_id == -1) ? 0 : instance_id;
     se->version_id = version_id;
     se->save_state = save_state;
     se->load_state = load_state;
@@ -6082,8 +6084,13 @@ int register_savevm(const char *idstr,
 
     /* add at the end of list */
     pse = &first_se;
-    while (*pse != NULL)
+    while (*pse != NULL) {
+        if (instance_id == -1
+                && strcmp(se->idstr, (*pse)->idstr) == 0
+                && se->instance_id <= (*pse)->instance_id)
+            se->instance_id = (*pse)->instance_id + 1;
         pse = &(*pse)->next;
+    }
     *pse = se;
     return 0;
 }
@@ -7262,7 +7269,7 @@ static int main_loop(void)
                     if (use_icount == 1) {
                         /* When not using an adaptive execution frequency
                            we tend to get badly out of sync with real time,
-                           so just delay for a resonable amount of time.  */
+                           so just delay for a reasonable amount of time.  */
                         delta = 0;
                     } else {
                         delta = cpu_get_icount() - cpu_get_clock();
@@ -7935,7 +7942,7 @@ int main(int argc, char **argv)
     kernel_cmdline = "";
     cyls = heads = secs = 0;
     translation = BIOS_ATA_TRANSLATION_AUTO;
-    monitor_device = "vc:800x600";
+    monitor_device = "vc";
 
     serial_devices[0] = "vc:80Cx24C";
     for(i = 1; i < MAX_SERIAL_PORTS; i++)
@@ -8573,6 +8580,16 @@ int main(int argc, char **argv)
         nb_drives_opt == 0)
         help(1);
 
+    if (!linux_boot && *kernel_cmdline != '\0') {
+        fprintf(stderr, "-append only allowed with -kernel option\n");
+        exit(1);
+    }
+
+    if (!linux_boot && initrd_filename != NULL) {
+        fprintf(stderr, "-initrd only allowed with -kernel option\n");
+        exit(1);
+    }
+
     /* boot to floppy or the default cd if no hard disk defined yet */
     if (!boot_devices[0]) {
         boot_devices = "cad";