Commit 40c3bac35a868c275e083cad9ff39d3119847707
1 parent
6eaee461
win32 port (Kazu)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@702 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
34 additions
and
8 deletions
dyngen.c
... | ... | @@ -1215,6 +1215,19 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, |
1215 | 1215 | error("unsupported i386 relocation (%d)", type); |
1216 | 1216 | } |
1217 | 1217 | #elif defined(CONFIG_FORMAT_COFF) |
1218 | + { | |
1219 | + char *temp_name; | |
1220 | + int j; | |
1221 | + EXE_SYM *sym; | |
1222 | + temp_name = get_sym_name(symtab + *(uint32_t *)(rel->r_reloc->r_symndx)); | |
1223 | + if (!strcmp(temp_name, ".data")) { | |
1224 | + for (j = 0, sym = symtab; j < nb_syms; j++, sym++) { | |
1225 | + if (strstart(sym->st_name, sym_name, NULL)) { | |
1226 | + addend -= sym->st_value; | |
1227 | + } | |
1228 | + } | |
1229 | + } | |
1230 | + } | |
1218 | 1231 | type = rel->r_type; |
1219 | 1232 | switch(type) { |
1220 | 1233 | case DIR32: | ... | ... |
vl.c
... | ... | @@ -238,7 +238,7 @@ char *pstrcat(char *buf, int buf_size, const char *s) |
238 | 238 | int load_image(const char *filename, uint8_t *addr) |
239 | 239 | { |
240 | 240 | int fd, size; |
241 | - fd = open(filename, O_RDONLY); | |
241 | + fd = open(filename, O_RDONLY | O_BINARY); | |
242 | 242 | if (fd < 0) |
243 | 243 | return -1; |
244 | 244 | size = lseek(fd, 0, SEEK_END); |
... | ... | @@ -453,7 +453,9 @@ QEMUClock *rt_clock; |
453 | 453 | QEMUClock *vm_clock; |
454 | 454 | |
455 | 455 | static QEMUTimer *active_timers[2]; |
456 | -#ifndef _WIN32 | |
456 | +#ifdef _WIN32 | |
457 | +static MMRESULT timerID; | |
458 | +#else | |
457 | 459 | /* frequency of the times() clock tick */ |
458 | 460 | static int timer_freq; |
459 | 461 | #endif |
... | ... | @@ -653,11 +655,11 @@ static void init_timers(void) |
653 | 655 | #ifdef _WIN32 |
654 | 656 | { |
655 | 657 | int count=0; |
656 | - MMRESULT timerID = timeSetEvent(10, // interval (ms) | |
657 | - 0, // resolution | |
658 | - host_alarm_handler, // function | |
659 | - (DWORD)&count, // user parameter | |
660 | - TIME_PERIODIC | TIME_CALLBACK_FUNCTION); | |
658 | + timerID = timeSetEvent(10, // interval (ms) | |
659 | + 0, // resolution | |
660 | + host_alarm_handler, // function | |
661 | + (DWORD)&count, // user parameter | |
662 | + TIME_PERIODIC | TIME_CALLBACK_FUNCTION); | |
661 | 663 | if( !timerID ) { |
662 | 664 | perror("failed timer alarm"); |
663 | 665 | exit(1); |
... | ... | @@ -695,6 +697,13 @@ static void init_timers(void) |
695 | 697 | #endif |
696 | 698 | } |
697 | 699 | |
700 | +void quit_timers(void) | |
701 | +{ | |
702 | +#ifdef _WIN32 | |
703 | + timeKillEvent(timerID); | |
704 | +#endif | |
705 | +} | |
706 | + | |
698 | 707 | /***********************************************************/ |
699 | 708 | /* serial device */ |
700 | 709 | |
... | ... | @@ -2136,5 +2145,6 @@ int main(int argc, char **argv) |
2136 | 2145 | } |
2137 | 2146 | term_init(); |
2138 | 2147 | main_loop(); |
2148 | + quit_timers(); | |
2139 | 2149 | return 0; |
2140 | 2150 | } | ... | ... |
vl.h
... | ... | @@ -39,6 +39,9 @@ |
39 | 39 | #ifndef O_LARGEFILE |
40 | 40 | #define O_LARGEFILE 0 |
41 | 41 | #endif |
42 | +#ifndef O_BINARY | |
43 | +#define O_BINARY 0 | |
44 | +#endif | |
42 | 45 | |
43 | 46 | #ifdef _WIN32 |
44 | 47 | #define lseek64 lseek |
... | ... | @@ -447,7 +450,7 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device, |
447 | 450 | |
448 | 451 | /* monitor.c */ |
449 | 452 | void monitor_init(void); |
450 | -void term_printf(const char *fmt, ...); | |
453 | +void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); | |
451 | 454 | void term_flush(void); |
452 | 455 | void term_print_help(void); |
453 | 456 | ... | ... |