From: Jim Peterson <jspeter@jimsara.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] QEMU Patch
Date: Sat, 2 Sep 2006 20:49:45 -0400 [thread overview]
Message-ID: <200609022049.45864.jspeter@jimsara.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
I'm not quite sure where to send this. I've added a slight modification to
qemu-0.8.2 that allows the user to specify the desired date and time to which
to set the real time clock at startup. The patch is attached. The date is
parsed using the getdate(3) function, so the DATEMSK environment variable
must point to an appropriate file containing the formats to check for.
My need for this comes about as a side effect from the fact that, for some
reason, the "-loadvm" command locks up with an XP image on an Opteron 248
host. (but it does not seem to lock up on an Pentium 4 host)
--Jim
[-- Attachment #2: qemu-0.8.2-setdate.patch --]
[-- Type: text/x-diff, Size: 2981 bytes --]
diff -ruN qemu-0.8.2/hw/pc.c qemu-0.8.2.new/hw/pc.c
--- qemu-0.8.2/hw/pc.c 2006-07-22 13:23:34.000000000 -0400
+++ qemu-0.8.2.new/hw/pc.c 2006-09-02 15:30:49.000000000 -0400
@@ -163,11 +163,16 @@
int i;
/* set the CMOS date */
- time(&ti);
- if (rtc_utc)
- tm = gmtime(&ti);
+ if (rtc_use_time)
+ tm = &rtc_tm;
else
- tm = localtime(&ti);
+ {
+ time(&ti);
+ if (rtc_utc)
+ tm = gmtime(&ti);
+ else
+ tm = localtime(&ti);
+ }
rtc_set_date(s, tm);
val = to_bcd(s, (tm->tm_year / 100) + 19);
diff -ruN qemu-0.8.2/vl.c qemu-0.8.2.new/vl.c
--- qemu-0.8.2/vl.c 2006-07-22 13:23:34.000000000 -0400
+++ qemu-0.8.2.new/vl.c 2006-09-02 20:14:44.000000000 -0400
@@ -128,6 +128,8 @@
QEMUTimer *gui_timer;
int vm_running;
int rtc_utc = 1;
+int rtc_use_time = 0;
+struct tm rtc_tm;
int cirrus_vga_enabled = 1;
#ifdef TARGET_SPARC
int graphic_width = 1024;
@@ -5150,6 +5152,7 @@
" use -soundhw all to enable all of them\n"
#endif
"-localtime set the real time clock to local time [default=utc]\n"
+ "-date [date] set the real time clock to given date using getdate(3)\n"
"-full-screen start in full screen\n"
#ifdef TARGET_I386
"-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n"
@@ -5285,6 +5288,7 @@
QEMU_OPTION_no_code_copy,
QEMU_OPTION_k,
QEMU_OPTION_localtime,
+ QEMU_OPTION_setdate,
QEMU_OPTION_cirrusvga,
QEMU_OPTION_g,
QEMU_OPTION_std_vga,
@@ -5362,6 +5366,7 @@
{ "g", 1, QEMU_OPTION_g },
#endif
{ "localtime", 0, QEMU_OPTION_localtime },
+ { "date", 1, QEMU_OPTION_setdate },
{ "std-vga", 0, QEMU_OPTION_std_vga },
{ "monitor", 1, QEMU_OPTION_monitor },
{ "serial", 1, QEMU_OPTION_serial },
@@ -5607,6 +5612,7 @@
QEMUMachine *machine;
char usb_devices[MAX_USB_CMDLINE][128];
int usb_devices_index;
+ struct tm* tmp_tm;
LIST_INIT (&vm_change_state_head);
#ifndef _WIN32
@@ -5907,6 +5913,16 @@
case QEMU_OPTION_localtime:
rtc_utc = 0;
break;
+ case QEMU_OPTION_setdate:
+ rtc_use_time = 1;
+ tmp_tm = getdate(optarg);
+ if (!tmp_tm)
+ {
+ fprintf (stderr, "qemu: bad date format '%s'\n",optarg);
+ exit(1);
+ }
+ memcpy(&rtc_tm,tmp_tm,sizeof(rtc_tm));
+ break;
case QEMU_OPTION_cirrusvga:
cirrus_vga_enabled = 1;
break;
diff -ruN qemu-0.8.2/vl.h qemu-0.8.2.new/vl.h
--- qemu-0.8.2/vl.h 2006-07-22 13:23:34.000000000 -0400
+++ qemu-0.8.2.new/vl.h 2006-09-02 15:45:25.000000000 -0400
@@ -142,6 +142,8 @@
extern int ram_size;
extern int bios_size;
extern int rtc_utc;
+extern int rtc_use_time;
+extern struct tm rtc_tm;
extern int cirrus_vga_enabled;
extern int graphic_width;
extern int graphic_height;
reply other threads:[~2006-09-03 0:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200609022049.45864.jspeter@jimsara.org \
--to=jspeter@jimsara.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).