aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-04 12:56:28 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-04 12:56:28 +0000
commit40c3bac35a868c275e083cad9ff39d3119847707 (patch)
tree5971aea492fe5ca89b2e13afd876d3f06f97091a /vl.c
parent6eaee4614437e3a99af817485963487efd84e771 (diff)
downloadqemu-40c3bac35a868c275e083cad9ff39d3119847707.zip
qemu-40c3bac35a868c275e083cad9ff39d3119847707.tar.gz
qemu-40c3bac35a868c275e083cad9ff39d3119847707.tar.bz2
win32 port (Kazu)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@702 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/vl.c b/vl.c
index 72238ef..3af8a0e 100644
--- a/vl.c
+++ b/vl.c
@@ -238,7 +238,7 @@ char *pstrcat(char *buf, int buf_size, const char *s)
int load_image(const char *filename, uint8_t *addr)
{
int fd, size;
- fd = open(filename, O_RDONLY);
+ fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0)
return -1;
size = lseek(fd, 0, SEEK_END);
@@ -453,7 +453,9 @@ QEMUClock *rt_clock;
QEMUClock *vm_clock;
static QEMUTimer *active_timers[2];
-#ifndef _WIN32
+#ifdef _WIN32
+static MMRESULT timerID;
+#else
/* frequency of the times() clock tick */
static int timer_freq;
#endif
@@ -653,11 +655,11 @@ static void init_timers(void)
#ifdef _WIN32
{
int count=0;
- MMRESULT timerID = timeSetEvent(10, // interval (ms)
- 0, // resolution
- host_alarm_handler, // function
- (DWORD)&count, // user parameter
- TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
+ timerID = timeSetEvent(10, // interval (ms)
+ 0, // resolution
+ host_alarm_handler, // function
+ (DWORD)&count, // user parameter
+ TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
if( !timerID ) {
perror("failed timer alarm");
exit(1);
@@ -695,6 +697,13 @@ static void init_timers(void)
#endif
}
+void quit_timers(void)
+{
+#ifdef _WIN32
+ timeKillEvent(timerID);
+#endif
+}
+
/***********************************************************/
/* serial device */
@@ -2136,5 +2145,6 @@ int main(int argc, char **argv)
}
term_init();
main_loop();
+ quit_timers();
return 0;
}