Commit 05c2a3e7313870811c8a7ec9837f5e75d40ea080
1 parent
f94f5d71
kqemu/qvm86 must now be compiled outside QEMU
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1750 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
143 additions
and
76 deletions
Makefile
... | ... | @@ -17,13 +17,6 @@ all: dyngen$(EXESUF) $(TOOLS) $(DOCS) |
17 | 17 | for d in $(TARGET_DIRS); do \ |
18 | 18 | $(MAKE) -C $$d $@ || exit 1 ; \ |
19 | 19 | done |
20 | -ifdef CONFIG_KQEMU | |
21 | -ifdef CONFIG_WIN32 | |
22 | - $(MAKE) -C kqemu -f Makefile.winnt | |
23 | -else | |
24 | - $(MAKE) -C kqemu | |
25 | -endif | |
26 | -endif | |
27 | 20 | |
28 | 21 | qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c |
29 | 22 | $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS) |
... | ... | @@ -39,9 +32,6 @@ clean: |
39 | 32 | for d in $(TARGET_DIRS); do \ |
40 | 33 | $(MAKE) -C $$d $@ || exit 1 ; \ |
41 | 34 | done |
42 | -ifdef CONFIG_KQEMU | |
43 | - $(MAKE) -C kqemu clean | |
44 | -endif | |
45 | 35 | |
46 | 36 | distclean: clean |
47 | 37 | rm -f config-host.mak config-host.h |
... | ... | @@ -73,9 +63,6 @@ endif |
73 | 63 | for d in $(TARGET_DIRS); do \ |
74 | 64 | $(MAKE) -C $$d $@ || exit 1 ; \ |
75 | 65 | done |
76 | -ifdef CONFIG_KQEMU | |
77 | - cd kqemu ; ./install.sh | |
78 | -endif | |
79 | 66 | |
80 | 67 | # various test targets |
81 | 68 | test speed test2: all | ... | ... |
configure
... | ... | @@ -85,6 +85,7 @@ fmod_lib="" |
85 | 85 | fmod_inc="" |
86 | 86 | linux="no" |
87 | 87 | kqemu="no" |
88 | +profiler="no" | |
88 | 89 | kernel_path="" |
89 | 90 | cocoa="no" |
90 | 91 | check_gfx="yes" |
... | ... | @@ -197,6 +198,8 @@ for opt do |
197 | 198 | ;; |
198 | 199 | --disable-kqemu) kqemu="no" |
199 | 200 | ;; |
201 | + --enable-profiler) profiler="yes" | |
202 | + ;; | |
200 | 203 | --kernel-path=*) kernel_path=${opt#--kernel-path=} |
201 | 204 | ;; |
202 | 205 | --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no" |
... | ... | @@ -365,7 +368,7 @@ echo " use %M for cpu name [$interp_prefix]" |
365 | 368 | echo " --target-list=LIST set target list [$target_list]" |
366 | 369 | echo "" |
367 | 370 | echo "kqemu kernel acceleration support:" |
368 | -echo " --disable-kqemu disable kqemu build" | |
371 | +echo " --disable-kqemu disable kqemu support" | |
369 | 372 | echo " --kernel-path=PATH set the kernel path (configure probes it)" |
370 | 373 | echo "" |
371 | 374 | echo "Advanced options (experts only):" |
... | ... | @@ -407,48 +410,6 @@ docdir="$prefix/share/doc/qemu" |
407 | 410 | bindir="$prefix/bin" |
408 | 411 | fi |
409 | 412 | |
410 | -# kqemu support | |
411 | -if test $kqemu = "yes" ; then | |
412 | - # test if the source code is installed | |
413 | - if test '!' -f "kqemu/Makefile" ; then | |
414 | - kqemu="no" | |
415 | - fi | |
416 | -fi | |
417 | - | |
418 | -# Linux specific kqemu configuration | |
419 | -if test $kqemu = "yes" -a $linux = "yes" ; then | |
420 | -# find the kernel path | |
421 | -if test -z "$kernel_path" ; then | |
422 | -kernel_version=`uname -r` | |
423 | -kernel_path="/lib/modules/$kernel_version/build" | |
424 | -if test '!' -d "$kernel_path/include" ; then | |
425 | - kernel_path="/usr/src/linux" | |
426 | - if test '!' -d "$kernel_path/include" ; then | |
427 | - echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kqemu module" | |
428 | - kqemu="no" | |
429 | - fi | |
430 | -fi | |
431 | -fi | |
432 | - | |
433 | -if test $kqemu = "yes" ; then | |
434 | - | |
435 | -# test that the kernel config is present | |
436 | -if test '!' -f "$kernel_path/Makefile" ; then | |
437 | - echo "No Makefile file present in $kernel_path - kqemu cannot be built" | |
438 | - kqemu="no" | |
439 | -fi | |
440 | - | |
441 | -# find build system (2.6 or legacy) | |
442 | -kbuild26="yes" | |
443 | -if grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then | |
444 | -kbuild26="no" | |
445 | -fi | |
446 | - | |
447 | -fi # kqemu | |
448 | - | |
449 | -fi # kqemu and linux | |
450 | - | |
451 | - | |
452 | 413 | echo "Install prefix $prefix" |
453 | 414 | echo "BIOS directory $datadir" |
454 | 415 | echo "binary directory $bindir" |
... | ... | @@ -464,6 +425,7 @@ echo "host CPU $cpu" |
464 | 425 | echo "host big endian $bigendian" |
465 | 426 | echo "target list $target_list" |
466 | 427 | echo "gprof enabled $gprof" |
428 | +echo "profiler $profiler" | |
467 | 429 | echo "static build $static" |
468 | 430 | if test "$darwin" = "yes" ; then |
469 | 431 | echo "Cocoa support $cocoa" |
... | ... | @@ -490,17 +452,6 @@ if test "$fmod" = "yes"; then |
490 | 452 | fi |
491 | 453 | echo "" |
492 | 454 | echo "kqemu support $kqemu" |
493 | -if test $kqemu = "yes" -a $linux = "yes" ; then | |
494 | -echo "" | |
495 | -echo "KQEMU Linux module configuration:" | |
496 | -echo "kernel sources $kernel_path" | |
497 | -echo -n "kbuild type " | |
498 | -if test $kbuild26 = "yes"; then | |
499 | -echo "2.6" | |
500 | -else | |
501 | -echo "2.4" | |
502 | -fi | |
503 | -fi | |
504 | 455 | |
505 | 456 | if test $sdl_too_old = "yes"; then |
506 | 457 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |
... | ... | @@ -601,6 +552,9 @@ if test "$static" = "yes" ; then |
601 | 552 | echo "CONFIG_STATIC=yes" >> $config_mak |
602 | 553 | echo "#define CONFIG_STATIC 1" >> $config_h |
603 | 554 | fi |
555 | +if test $profiler = "yes" ; then | |
556 | + echo "#define CONFIG_PROFILER 1" >> $config_h | |
557 | +fi | |
604 | 558 | if test "$slirp" = "yes" ; then |
605 | 559 | echo "CONFIG_SLIRP=yes" >> $config_mak |
606 | 560 | echo "#define CONFIG_SLIRP 1" >> $config_h |
... | ... | @@ -638,15 +592,6 @@ echo -n "#define QEMU_VERSION \"" >> $config_h |
638 | 592 | head $source_path/VERSION >> $config_h |
639 | 593 | echo "\"" >> $config_h |
640 | 594 | |
641 | -if test $kqemu = "yes" ; then | |
642 | - echo "CONFIG_KQEMU=yes" >> $config_mak | |
643 | - if test $linux = "yes" ; then | |
644 | - echo "KERNEL_PATH=$kernel_path" >> $config_mak | |
645 | - if test $kbuild26 = "yes" ; then | |
646 | - echo "CONFIG_KBUILD26=yes" >> $config_mak | |
647 | - fi | |
648 | - fi | |
649 | -fi | |
650 | 595 | echo "SRC_PATH=$source_path" >> $config_mak |
651 | 596 | echo "TARGET_DIRS=$target_list" >> $config_mak |
652 | 597 | |
... | ... | @@ -746,6 +691,9 @@ elif test "$target_cpu" = "x86_64" ; then |
746 | 691 | echo "#define TARGET_X86_64 1" >> $config_h |
747 | 692 | if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then |
748 | 693 | echo "#define USE_KQEMU 1" >> $config_h |
694 | + if test $kqemu_profile = "yes" ; then | |
695 | + echo "#define CONFIG_KQEMU_PROFILE 1" >> $config_h | |
696 | + fi | |
749 | 697 | fi |
750 | 698 | elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then |
751 | 699 | echo "TARGET_ARCH=mips" >> $config_mak | ... | ... |
kqemu.h
0 โ 100644
1 | +/* | |
2 | + * KQEMU header | |
3 | + * | |
4 | + * Copyright (c) 2004-2006 Fabrice Bellard | |
5 | + * | |
6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | + * of this software and associated documentation files (the "Software"), to deal | |
8 | + * in the Software without restriction, including without limitation the rights | |
9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | + * copies of the Software, and to permit persons to whom the Software is | |
11 | + * furnished to do so, subject to the following conditions: | |
12 | + * | |
13 | + * The above copyright notice and this permission notice shall be included in | |
14 | + * all copies or substantial portions of the Software. | |
15 | + * | |
16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | + * THE SOFTWARE. | |
23 | + */ | |
24 | +#ifndef KQEMU_H | |
25 | +#define KQEMU_H | |
26 | + | |
27 | +#define KQEMU_VERSION 0x010300 | |
28 | + | |
29 | +struct kqemu_segment_cache { | |
30 | + uint32_t selector; | |
31 | + unsigned long base; | |
32 | + uint32_t limit; | |
33 | + uint32_t flags; | |
34 | +}; | |
35 | + | |
36 | +struct kqemu_cpu_state { | |
37 | +#ifdef __x86_64__ | |
38 | + unsigned long regs[16]; | |
39 | +#else | |
40 | + unsigned long regs[8]; | |
41 | +#endif | |
42 | + unsigned long eip; | |
43 | + unsigned long eflags; | |
44 | + | |
45 | + uint32_t dummy0, dummy1, dumm2, dummy3, dummy4; | |
46 | + | |
47 | + struct kqemu_segment_cache segs[6]; /* selector values */ | |
48 | + struct kqemu_segment_cache ldt; | |
49 | + struct kqemu_segment_cache tr; | |
50 | + struct kqemu_segment_cache gdt; /* only base and limit are used */ | |
51 | + struct kqemu_segment_cache idt; /* only base and limit are used */ | |
52 | + | |
53 | + unsigned long cr0; | |
54 | + unsigned long dummy5; | |
55 | + unsigned long cr2; | |
56 | + unsigned long cr3; | |
57 | + unsigned long cr4; | |
58 | + uint32_t a20_mask; | |
59 | + | |
60 | + /* sysenter registers */ | |
61 | + uint32_t sysenter_cs; | |
62 | + uint32_t sysenter_esp; | |
63 | + uint32_t sysenter_eip; | |
64 | + uint64_t efer __attribute__((aligned(8))); | |
65 | + uint64_t star; | |
66 | +#ifdef __x86_64__ | |
67 | + unsigned long lstar; | |
68 | + unsigned long cstar; | |
69 | + unsigned long fmask; | |
70 | + unsigned long kernelgsbase; | |
71 | +#endif | |
72 | + uint64_t tsc_offset; | |
73 | + | |
74 | + unsigned long dr0; | |
75 | + unsigned long dr1; | |
76 | + unsigned long dr2; | |
77 | + unsigned long dr3; | |
78 | + unsigned long dr6; | |
79 | + unsigned long dr7; | |
80 | + | |
81 | + uint8_t cpl; | |
82 | + uint8_t user_only; | |
83 | + | |
84 | + uint32_t error_code; /* error_code when exiting with an exception */ | |
85 | + unsigned long next_eip; /* next eip value when exiting with an interrupt */ | |
86 | + unsigned int nb_pages_to_flush; /* number of pages to flush, | |
87 | + KQEMU_FLUSH_ALL means full flush */ | |
88 | +#define KQEMU_MAX_PAGES_TO_FLUSH 512 | |
89 | +#define KQEMU_FLUSH_ALL (KQEMU_MAX_PAGES_TO_FLUSH + 1) | |
90 | + | |
91 | + long retval; | |
92 | + | |
93 | + /* number of ram_dirty entries to update */ | |
94 | + unsigned int nb_ram_pages_to_update; | |
95 | +#define KQEMU_MAX_RAM_PAGES_TO_UPDATE 512 | |
96 | +#define KQEMU_RAM_PAGES_UPDATE_ALL (KQEMU_MAX_RAM_PAGES_TO_UPDATE + 1) | |
97 | + | |
98 | +#define KQEMU_MAX_MODIFIED_RAM_PAGES 512 | |
99 | + unsigned int nb_modified_ram_pages; | |
100 | +}; | |
101 | + | |
102 | +struct kqemu_init { | |
103 | + uint8_t *ram_base; /* must be page aligned */ | |
104 | + unsigned long ram_size; /* must be multiple of 4 KB */ | |
105 | + uint8_t *ram_dirty; /* must be page aligned */ | |
106 | + uint32_t **phys_to_ram_map; /* must be page aligned */ | |
107 | + unsigned long *pages_to_flush; /* must be page aligned */ | |
108 | + unsigned long *ram_pages_to_update; /* must be page aligned */ | |
109 | + unsigned long *modified_ram_pages; /* must be page aligned */ | |
110 | +}; | |
111 | + | |
112 | +#define KQEMU_RET_ABORT (-1) | |
113 | +#define KQEMU_RET_EXCEPTION 0x0000 /* 8 low order bit are the exception */ | |
114 | +#define KQEMU_RET_INT 0x0100 /* 8 low order bit are the interrupt */ | |
115 | +#define KQEMU_RET_SOFTMMU 0x0200 /* emulation needed (I/O or | |
116 | + unsupported INSN) */ | |
117 | +#define KQEMU_RET_INTR 0x0201 /* interrupted by a signal */ | |
118 | +#define KQEMU_RET_SYSCALL 0x0300 /* syscall insn */ | |
119 | + | |
120 | +#ifdef _WIN32 | |
121 | +#define KQEMU_EXEC CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) | |
122 | +#define KQEMU_INIT CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_WRITE_ACCESS) | |
123 | +#define KQEMU_GET_VERSION CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_READ_ACCESS) | |
124 | +#define KQEMU_MODIFY_RAM_PAGES CTL_CODE(FILE_DEVICE_UNKNOWN, 4, METHOD_BUFFERED, FILE_WRITE_ACCESS) | |
125 | +#else | |
126 | +#define KQEMU_EXEC _IOWR('q', 1, struct kqemu_cpu_state) | |
127 | +#define KQEMU_INIT _IOW('q', 2, struct kqemu_init) | |
128 | +#define KQEMU_GET_VERSION _IOR('q', 3, int) | |
129 | +#define KQEMU_MODIFY_RAM_PAGES _IOW('q', 4, int) | |
130 | +#endif | |
131 | + | |
132 | +#endif /* KQEMU_H */ | ... | ... |