win32 port (Kazu)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@702 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2004-04-04 12:56:28 +00:00
parent 6eaee46144
commit 40c3bac35a
3 changed files with 34 additions and 8 deletions

View file

@ -1215,6 +1215,19 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
error("unsupported i386 relocation (%d)", type); error("unsupported i386 relocation (%d)", type);
} }
#elif defined(CONFIG_FORMAT_COFF) #elif defined(CONFIG_FORMAT_COFF)
{
char *temp_name;
int j;
EXE_SYM *sym;
temp_name = get_sym_name(symtab + *(uint32_t *)(rel->r_reloc->r_symndx));
if (!strcmp(temp_name, ".data")) {
for (j = 0, sym = symtab; j < nb_syms; j++, sym++) {
if (strstart(sym->st_name, sym_name, NULL)) {
addend -= sym->st_value;
}
}
}
}
type = rel->r_type; type = rel->r_type;
switch(type) { switch(type) {
case DIR32: case DIR32:

24
vl.c
View file

@ -238,7 +238,7 @@ char *pstrcat(char *buf, int buf_size, const char *s)
int load_image(const char *filename, uint8_t *addr) int load_image(const char *filename, uint8_t *addr)
{ {
int fd, size; int fd, size;
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0) if (fd < 0)
return -1; return -1;
size = lseek(fd, 0, SEEK_END); size = lseek(fd, 0, SEEK_END);
@ -453,7 +453,9 @@ QEMUClock *rt_clock;
QEMUClock *vm_clock; QEMUClock *vm_clock;
static QEMUTimer *active_timers[2]; static QEMUTimer *active_timers[2];
#ifndef _WIN32 #ifdef _WIN32
static MMRESULT timerID;
#else
/* frequency of the times() clock tick */ /* frequency of the times() clock tick */
static int timer_freq; static int timer_freq;
#endif #endif
@ -653,11 +655,11 @@ static void init_timers(void)
#ifdef _WIN32 #ifdef _WIN32
{ {
int count=0; int count=0;
MMRESULT timerID = timeSetEvent(10, // interval (ms) timerID = timeSetEvent(10, // interval (ms)
0, // resolution 0, // resolution
host_alarm_handler, // function host_alarm_handler, // function
(DWORD)&count, // user parameter (DWORD)&count, // user parameter
TIME_PERIODIC | TIME_CALLBACK_FUNCTION); TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
if( !timerID ) { if( !timerID ) {
perror("failed timer alarm"); perror("failed timer alarm");
exit(1); exit(1);
@ -695,6 +697,13 @@ static void init_timers(void)
#endif #endif
} }
void quit_timers(void)
{
#ifdef _WIN32
timeKillEvent(timerID);
#endif
}
/***********************************************************/ /***********************************************************/
/* serial device */ /* serial device */
@ -2136,5 +2145,6 @@ int main(int argc, char **argv)
} }
term_init(); term_init();
main_loop(); main_loop();
quit_timers();
return 0; return 0;
} }

5
vl.h
View file

@ -39,6 +39,9 @@
#ifndef O_LARGEFILE #ifndef O_LARGEFILE
#define O_LARGEFILE 0 #define O_LARGEFILE 0
#endif #endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
#ifdef _WIN32 #ifdef _WIN32
#define lseek64 lseek #define lseek64 lseek
@ -447,7 +450,7 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device,
/* monitor.c */ /* monitor.c */
void monitor_init(void); void monitor_init(void);
void term_printf(const char *fmt, ...); void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
void term_flush(void); void term_flush(void);
void term_print_help(void); void term_print_help(void);