Commit 2d7a3b9d7bf8959077ad19951d7f30dc87da9838
1 parent
7c206a75
qruncom compile fixes (initial patch by Even Rouault)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1722 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
32 additions
and
11 deletions
tests/Makefile
... | ... | @@ -71,7 +71,7 @@ runcom: runcom.c |
71 | 71 | |
72 | 72 | # NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu |
73 | 73 | qruncom: qruncom.c ../i386-user/libqemu.a |
74 | - $(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user \ | |
74 | + $(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \ | |
75 | 75 | -o $@ $< -L../i386-user -lqemu -lm |
76 | 76 | |
77 | 77 | # arm test | ... | ... |
tests/qruncom.c
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | #include <fcntl.h> |
11 | 11 | #include <sys/mman.h> |
12 | 12 | #include <signal.h> |
13 | +#include <malloc.h> | |
13 | 14 | |
14 | 15 | #include "cpu.h" |
15 | 16 | |
... | ... | @@ -86,6 +87,26 @@ void *qemu_malloc(size_t size) |
86 | 87 | return malloc(size); |
87 | 88 | } |
88 | 89 | |
90 | +void *qemu_mallocz(size_t size) | |
91 | +{ | |
92 | + void *ptr; | |
93 | + ptr = qemu_malloc(size); | |
94 | + if (!ptr) | |
95 | + return NULL; | |
96 | + memset(ptr, 0, size); | |
97 | + return ptr; | |
98 | +} | |
99 | + | |
100 | +void *qemu_vmalloc(size_t size) | |
101 | +{ | |
102 | + return memalign(4096, size); | |
103 | +} | |
104 | + | |
105 | +void qemu_vfree(void *ptr) | |
106 | +{ | |
107 | + free(ptr); | |
108 | +} | |
109 | + | |
89 | 110 | void qemu_printf(const char *fmt, ...) |
90 | 111 | { |
91 | 112 | va_list ap; |
... | ... | @@ -204,20 +225,20 @@ int main(int argc, char **argv) |
204 | 225 | seg = (COM_BASE_ADDR - 0x100) >> 4; |
205 | 226 | |
206 | 227 | cpu_x86_load_seg_cache(env, R_CS, seg, |
207 | - (uint8_t *)(seg << 4), 0xffff, 0); | |
228 | + (seg << 4), 0xffff, 0); | |
208 | 229 | cpu_x86_load_seg_cache(env, R_SS, seg, |
209 | - (uint8_t *)(seg << 4), 0xffff, 0); | |
230 | + (seg << 4), 0xffff, 0); | |
210 | 231 | cpu_x86_load_seg_cache(env, R_DS, seg, |
211 | - (uint8_t *)(seg << 4), 0xffff, 0); | |
232 | + (seg << 4), 0xffff, 0); | |
212 | 233 | cpu_x86_load_seg_cache(env, R_ES, seg, |
213 | - (uint8_t *)(seg << 4), 0xffff, 0); | |
234 | + (seg << 4), 0xffff, 0); | |
214 | 235 | cpu_x86_load_seg_cache(env, R_FS, seg, |
215 | - (uint8_t *)(seg << 4), 0xffff, 0); | |
236 | + (seg << 4), 0xffff, 0); | |
216 | 237 | cpu_x86_load_seg_cache(env, R_GS, seg, |
217 | - (uint8_t *)(seg << 4), 0xffff, 0); | |
238 | + (seg << 4), 0xffff, 0); | |
218 | 239 | |
219 | 240 | /* exception support */ |
220 | - env->idt.base = (void *)idt_table; | |
241 | + env->idt.base = (unsigned long)idt_table; | |
221 | 242 | env->idt.limit = sizeof(idt_table) - 1; |
222 | 243 | set_idt(0, 0); |
223 | 244 | set_idt(1, 0); |
... | ... | @@ -263,7 +284,7 @@ int main(int argc, char **argv) |
263 | 284 | case EXCP0D_GPF: |
264 | 285 | { |
265 | 286 | int int_num, ah; |
266 | - int_num = *(env->segs[R_CS].base + env->eip + 1); | |
287 | + int_num = *(uint8_t *)(env->segs[R_CS].base + env->eip + 1); | |
267 | 288 | if (int_num != 0x21) |
268 | 289 | goto unknown_int; |
269 | 290 | ah = (env->regs[R_EAX] >> 8) & 0xff; |
... | ... | @@ -291,7 +312,7 @@ int main(int argc, char **argv) |
291 | 312 | default: |
292 | 313 | unknown_int: |
293 | 314 | fprintf(stderr, "unsupported int 0x%02x\n", int_num); |
294 | - cpu_dump_state(env, stderr, 0); | |
315 | + cpu_dump_state(env, stderr, fprintf, 0); | |
295 | 316 | // exit(1); |
296 | 317 | } |
297 | 318 | env->eip += 2; |
... | ... | @@ -299,7 +320,7 @@ int main(int argc, char **argv) |
299 | 320 | break; |
300 | 321 | default: |
301 | 322 | fprintf(stderr, "unhandled cpu_exec return code (0x%x)\n", ret); |
302 | - cpu_dump_state(env, stderr, 0); | |
323 | + cpu_dump_state(env, stderr, fprintf, 0); | |
303 | 324 | exit(1); |
304 | 325 | } |
305 | 326 | } | ... | ... |