Revision 640f42e4

b/configure
1770 1770
    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1771 1771
    then
1772 1772
      echo "CONFIG_KQEMU=yes" >> $config_mak
1773
      echo "#define USE_KQEMU 1" >> $config_h
1773
      echo "#define CONFIG_KQEMU 1" >> $config_h
1774 1774
    fi
1775 1775
    if test "$kvm" = "yes" ; then
1776 1776
      echo "CONFIG_KVM=yes" >> $config_mak
......
1786 1786
    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1787 1787
    then
1788 1788
      echo "CONFIG_KQEMU=yes" >> $config_mak
1789
      echo "#define USE_KQEMU 1" >> $config_h
1789
      echo "#define CONFIG_KQEMU 1" >> $config_h
1790 1790
    fi
1791 1791
    if test "$kvm" = "yes" ; then
1792 1792
      echo "CONFIG_KVM=yes" >> $config_mak
b/cpu-all.h
846 846
#endif
847 847

  
848 848
/* address in the RAM (different from a physical address) */
849
#ifdef USE_KQEMU
849
#ifdef CONFIG_KQEMU
850 850
typedef uint32_t ram_addr_t;
851 851
#else
852 852
typedef unsigned long ram_addr_t;
b/cpu-exec.c
314 314
                }
315 315
                env->exception_index = -1;
316 316
            }
317
#ifdef USE_KQEMU
317
#ifdef CONFIG_KQEMU
318 318
            if (kqemu_is_ok(env) && env->interrupt_request == 0 && env->exit_request == 0) {
319 319
                int ret;
320 320
                env->eflags = env->eflags | helper_cc_compute_all(CC_OP) | (DF & DF_MASK);
......
594 594
                   jump. */
595 595
                {
596 596
                    if (next_tb != 0 &&
597
#ifdef USE_KQEMU
597
#ifdef CONFIG_KQEMU
598 598
                        (env->kqemu_enabled != 2) &&
599 599
#endif
600 600
                        tb->page_addr[1] == -1) {
......
651 651
                }
652 652
                /* reset soft MMU for next block (it can currently
653 653
                   only be set by a memory fault) */
654
#if defined(USE_KQEMU)
654
#if defined(CONFIG_KQEMU)
655 655
#define MIN_CYCLE_BEFORE_SWITCH (100 * 1000)
656 656
                if (kqemu_is_ok(env) &&
657 657
                    (cpu_get_time_fast() - env->last_io_time) >= MIN_CYCLE_BEFORE_SWITCH) {
b/exec-all.h
352 352
}
353 353
#endif
354 354

  
355
#ifdef USE_KQEMU
355
#ifdef CONFIG_KQEMU
356 356
#define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))
357 357

  
358 358
#define MSR_QPI_COMMBASE 0xfabe0010
b/exec.c
71 71
#define TARGET_VIRT_ADDR_SPACE_BITS 42
72 72
#elif defined(TARGET_PPC64)
73 73
#define TARGET_PHYS_ADDR_SPACE_BITS 42
74
#elif defined(TARGET_X86_64) && !defined(USE_KQEMU)
74
#elif defined(TARGET_X86_64) && !defined(CONFIG_KQEMU)
75 75
#define TARGET_PHYS_ADDR_SPACE_BITS 42
76
#elif defined(TARGET_I386) && !defined(USE_KQEMU)
76
#elif defined(TARGET_I386) && !defined(CONFIG_KQEMU)
77 77
#define TARGET_PHYS_ADDR_SPACE_BITS 36
78 78
#else
79 79
/* Note: for compatibility with kqemu, we use 32 bits for x86_64 */
......
1760 1760

  
1761 1761
    memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));
1762 1762

  
1763
#ifdef USE_KQEMU
1763
#ifdef CONFIG_KQEMU
1764 1764
    if (env->kqemu_enabled) {
1765 1765
        kqemu_flush(env, flush_global);
1766 1766
    }
......
1809 1809

  
1810 1810
    tlb_flush_jmp_cache(env, addr);
1811 1811

  
1812
#ifdef USE_KQEMU
1812
#ifdef CONFIG_KQEMU
1813 1813
    if (env->kqemu_enabled) {
1814 1814
        kqemu_flush_page(env, addr);
1815 1815
    }
......
1861 1861
    if (length == 0)
1862 1862
        return;
1863 1863
    len = length >> TARGET_PAGE_BITS;
1864
#ifdef USE_KQEMU
1864
#ifdef CONFIG_KQEMU
1865 1865
    /* XXX: should not depend on cpu context */
1866 1866
    env = first_cpu;
1867 1867
    if (env->kqemu_enabled) {
......
2328 2328
    ram_addr_t orig_size = size;
2329 2329
    void *subpage;
2330 2330

  
2331
#ifdef USE_KQEMU
2331
#ifdef CONFIG_KQEMU
2332 2332
    /* XXX: should not depend on cpu context */
2333 2333
    env = first_cpu;
2334 2334
    if (env->kqemu_enabled) {
......
2429 2429
        kvm_uncoalesce_mmio_region(addr, size);
2430 2430
}
2431 2431

  
2432
#ifdef USE_KQEMU
2432
#ifdef CONFIG_KQEMU
2433 2433
/* XXX: better than nothing */
2434 2434
static ram_addr_t kqemu_ram_alloc(ram_addr_t size)
2435 2435
{
......
2449 2449
{
2450 2450
    RAMBlock *new_block;
2451 2451

  
2452
#ifdef USE_KQEMU
2452
#ifdef CONFIG_KQEMU
2453 2453
    if (kqemu_phys_ram_base) {
2454 2454
        return kqemu_ram_alloc(size);
2455 2455
    }
......
2494 2494
    RAMBlock **prevp;
2495 2495
    RAMBlock *block;
2496 2496

  
2497
#ifdef USE_KQEMU
2497
#ifdef CONFIG_KQEMU
2498 2498
    if (kqemu_phys_ram_base) {
2499 2499
        return kqemu_phys_ram_base + addr;
2500 2500
    }
......
2532 2532
    RAMBlock *block;
2533 2533
    uint8_t *host = ptr;
2534 2534

  
2535
#ifdef USE_KQEMU
2535
#ifdef CONFIG_KQEMU
2536 2536
    if (kqemu_phys_ram_base) {
2537 2537
        return host - kqemu_phys_ram_base;
2538 2538
    }
......
2642 2642
#endif
2643 2643
    }
2644 2644
    stb_p(qemu_get_ram_ptr(ram_addr), val);
2645
#ifdef USE_KQEMU
2645
#ifdef CONFIG_KQEMU
2646 2646
    if (cpu_single_env->kqemu_enabled &&
2647 2647
        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
2648 2648
        kqemu_modify_page(cpu_single_env, ram_addr);
......
2667 2667
#endif
2668 2668
    }
2669 2669
    stw_p(qemu_get_ram_ptr(ram_addr), val);
2670
#ifdef USE_KQEMU
2670
#ifdef CONFIG_KQEMU
2671 2671
    if (cpu_single_env->kqemu_enabled &&
2672 2672
        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
2673 2673
        kqemu_modify_page(cpu_single_env, ram_addr);
......
2692 2692
#endif
2693 2693
    }
2694 2694
    stl_p(qemu_get_ram_ptr(ram_addr), val);
2695
#ifdef USE_KQEMU
2695
#ifdef CONFIG_KQEMU
2696 2696
    if (cpu_single_env->kqemu_enabled &&
2697 2697
        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
2698 2698
        kqemu_modify_page(cpu_single_env, ram_addr);
......
2993 2993

  
2994 2994
    io_mem_watch = cpu_register_io_memory(0, watch_mem_read,
2995 2995
                                          watch_mem_write, NULL);
2996
#ifdef USE_KQEMU
2996
#ifdef CONFIG_KQEMU
2997 2997
    if (kqemu_phys_ram_base) {
2998 2998
        /* alloc dirty bits array */
2999 2999
        phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS);
b/hw/pc.c
85 85
    /* Note: when using kqemu, it is more logical to return the host TSC
86 86
       because kqemu does not trap the RDTSC instruction for
87 87
       performance reasons */
88
#ifdef USE_KQEMU
88
#ifdef CONFIG_KQEMU
89 89
    if (env->kqemu_enabled) {
90 90
        return cpu_get_real_ticks();
91 91
    } else
b/kqemu.c
41 41
#include "exec-all.h"
42 42
#include "qemu-common.h"
43 43

  
44
#ifdef USE_KQEMU
44
#ifdef CONFIG_KQEMU
45 45

  
46 46
#define DEBUG
47 47
//#define PROFILE
b/monitor.c
1368 1368

  
1369 1369
static void do_info_kqemu(Monitor *mon)
1370 1370
{
1371
#ifdef USE_KQEMU
1371
#ifdef CONFIG_KQEMU
1372 1372
    CPUState *env;
1373 1373
    int val;
1374 1374
    val = 0;
......
1445 1445
    kqemu_ret_int_count = 0;
1446 1446
    kqemu_ret_excp_count = 0;
1447 1447
    kqemu_ret_intr_count = 0;
1448
#ifdef USE_KQEMU
1448
#ifdef CONFIG_KQEMU
1449 1449
    kqemu_record_dump();
1450 1450
#endif
1451 1451
}
b/osdep.c
69 69

  
70 70
#else
71 71

  
72
#if defined(USE_KQEMU)
72
#if defined(CONFIG_KQEMU)
73 73

  
74 74
#ifdef __OpenBSD__
75 75
#include <sys/param.h>
......
197 197
/* alloc shared memory pages */
198 198
void *qemu_vmalloc(size_t size)
199 199
{
200
#if defined(USE_KQEMU)
200
#if defined(CONFIG_KQEMU)
201 201
    if (kqemu_allowed)
202 202
        return kqemu_vmalloc(size);
203 203
#endif
......
206 206

  
207 207
void qemu_vfree(void *ptr)
208 208
{
209
#if defined(USE_KQEMU)
209
#if defined(CONFIG_KQEMU)
210 210
    if (kqemu_allowed)
211 211
        kqemu_vfree(ptr);
212 212
#endif
b/qemu-options.hx
1304 1304
Set the filename for the BIOS.
1305 1305
ETEXI
1306 1306

  
1307
#ifdef USE_KQEMU
1307
#ifdef CONFIG_KQEMU
1308 1308
DEF("kernel-kqemu", 0, QEMU_OPTION_kernel_kqemu, \
1309 1309
    "-kernel-kqemu   enable KQEMU full virtualization (default is user mode only)\n")
1310 1310
#endif
......
1313 1313
Enable KQEMU full virtualization (default is user mode only).
1314 1314
ETEXI
1315 1315

  
1316
#ifdef USE_KQEMU
1316
#ifdef CONFIG_KQEMU
1317 1317
DEF("no-kqemu", 0, QEMU_OPTION_no_kqemu, \
1318 1318
    "-no-kqemu       disable KQEMU kernel module usage\n")
1319 1319
#endif
b/softmmu_template.h
76 76
    res |= (uint64_t)io_mem_read[index][2](io_mem_opaque[index], physaddr + 4) << 32;
77 77
#endif
78 78
#endif /* SHIFT > 2 */
79
#ifdef USE_KQEMU
79
#ifdef CONFIG_KQEMU
80 80
    env->last_io_time = cpu_get_time_fast();
81 81
#endif
82 82
    return res;
......
221 221
    io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val >> 32);
222 222
#endif
223 223
#endif /* SHIFT > 2 */
224
#ifdef USE_KQEMU
224
#ifdef CONFIG_KQEMU
225 225
    env->last_io_time = cpu_get_time_fast();
226 226
#endif
227 227
}
b/sysemu.h
104 104
extern int semihosting_enabled;
105 105
extern int old_param;
106 106

  
107
#ifdef USE_KQEMU
107
#ifdef CONFIG_KQEMU
108 108
extern int kqemu_allowed;
109 109
#endif
110 110

  
b/target-i386/cpu.h
662 662
        uint64_t mask;
663 663
    } mtrr_var[8];
664 664

  
665
#ifdef USE_KQEMU
665
#ifdef CONFIG_KQEMU
666 666
    int kqemu_enabled;
667 667
    int last_io_time;
668 668
#endif
......
820 820
#define X86_DUMP_FPU  0x0001 /* dump FPU state too */
821 821
#define X86_DUMP_CCOP 0x0002 /* dump qemu flag cache */
822 822

  
823
#ifdef USE_KQEMU
823
#ifdef CONFIG_KQEMU
824 824
static inline int cpu_get_time_fast(void)
825 825
{
826 826
    int low, high;
b/target-i386/helper.c
930 930

  
931 931
/* XXX: This value should match the one returned by CPUID
932 932
 * and in exec.c */
933
#if defined(USE_KQEMU)
933
#if defined(CONFIG_KQEMU)
934 934
#define PHYS_ADDR_MASK 0xfffff000LL
935 935
#else
936 936
# if defined(TARGET_X86_64)
......
1630 1630
/* XXX: This value must match the one used in the MMU code. */ 
1631 1631
        if (env->cpuid_ext2_features & CPUID_EXT2_LM) {
1632 1632
            /* 64 bit processor */
1633
#if defined(USE_KQEMU)
1633
#if defined(CONFIG_KQEMU)
1634 1634
            *eax = 0x00003020;	/* 48 bits virtual, 32 bits physical */
1635 1635
#else
1636 1636
/* XXX: The physical address space is limited to 42 bits in exec.c. */
1637 1637
            *eax = 0x00003028;	/* 48 bits virtual, 40 bits physical */
1638 1638
#endif
1639 1639
        } else {
1640
#if defined(USE_KQEMU)
1640
#if defined(CONFIG_KQEMU)
1641 1641
            *eax = 0x00000020;	/* 32 bits physical */
1642 1642
#else
1643 1643
            if (env->cpuid_features & CPUID_PSE36)
......
1689 1689
        return NULL;
1690 1690
    }
1691 1691
    cpu_reset(env);
1692
#ifdef USE_KQEMU
1692
#ifdef CONFIG_KQEMU
1693 1693
    kqemu_init(env);
1694 1694
#endif
1695 1695
    if (kvm_enabled())
b/target-i386/op_helper.c
1119 1119
        env->eflags |= IF_MASK;
1120 1120
        cpu_x86_set_cpl(env, 3);
1121 1121
    }
1122
#ifdef USE_KQEMU
1122
#ifdef CONFIG_KQEMU
1123 1123
    if (kqemu_is_ok(env)) {
1124 1124
        if (env->hflags & HF_LMA_MASK)
1125 1125
            CC_OP = CC_OP_EFLAGS;
......
2478 2478
        SET_ESP(sp, sp_mask);
2479 2479
        EIP = offset;
2480 2480
    }
2481
#ifdef USE_KQEMU
2481
#ifdef CONFIG_KQEMU
2482 2482
    if (kqemu_is_ok(env)) {
2483 2483
        env->exception_index = -1;
2484 2484
        cpu_loop_exit();
......
2764 2764
        helper_ret_protected(shift, 1, 0);
2765 2765
    }
2766 2766
    env->hflags2 &= ~HF2_NMI_MASK;
2767
#ifdef USE_KQEMU
2767
#ifdef CONFIG_KQEMU
2768 2768
    if (kqemu_is_ok(env)) {
2769 2769
        CC_OP = CC_OP_EFLAGS;
2770 2770
        env->exception_index = -1;
......
2776 2776
void helper_lret_protected(int shift, int addend)
2777 2777
{
2778 2778
    helper_ret_protected(shift, 0, addend);
2779
#ifdef USE_KQEMU
2779
#ifdef CONFIG_KQEMU
2780 2780
    if (kqemu_is_ok(env)) {
2781 2781
        env->exception_index = -1;
2782 2782
        cpu_loop_exit();
......
2854 2854
    }
2855 2855
    ESP = ECX;
2856 2856
    EIP = EDX;
2857
#ifdef USE_KQEMU
2857
#ifdef CONFIG_KQEMU
2858 2858
    if (kqemu_is_ok(env)) {
2859 2859
        env->exception_index = -1;
2860 2860
        cpu_loop_exit();
......
3167 3167
        val = env->kernelgsbase;
3168 3168
        break;
3169 3169
#endif
3170
#ifdef USE_KQEMU
3170
#ifdef CONFIG_KQEMU
3171 3171
    case MSR_QPI_COMMBASE:
3172 3172
        if (env->kqemu_enabled) {
3173 3173
            val = kqemu_comm_base;
b/vl.c
435 435
{
436 436
    LOG_IOPORT("outb: %04x %02x\n", addr, val);
437 437
    ioport_write(0, addr, val);
438
#ifdef USE_KQEMU
438
#ifdef CONFIG_KQEMU
439 439
    if (env)
440 440
        env->last_io_time = cpu_get_time_fast();
441 441
#endif
......
445 445
{
446 446
    LOG_IOPORT("outw: %04x %04x\n", addr, val);
447 447
    ioport_write(1, addr, val);
448
#ifdef USE_KQEMU
448
#ifdef CONFIG_KQEMU
449 449
    if (env)
450 450
        env->last_io_time = cpu_get_time_fast();
451 451
#endif
......
455 455
{
456 456
    LOG_IOPORT("outl: %04x %08x\n", addr, val);
457 457
    ioport_write(2, addr, val);
458
#ifdef USE_KQEMU
458
#ifdef CONFIG_KQEMU
459 459
    if (env)
460 460
        env->last_io_time = cpu_get_time_fast();
461 461
#endif
......
466 466
    int val;
467 467
    val = ioport_read(0, addr);
468 468
    LOG_IOPORT("inb : %04x %02x\n", addr, val);
469
#ifdef USE_KQEMU
469
#ifdef CONFIG_KQEMU
470 470
    if (env)
471 471
        env->last_io_time = cpu_get_time_fast();
472 472
#endif
......
478 478
    int val;
479 479
    val = ioport_read(1, addr);
480 480
    LOG_IOPORT("inw : %04x %04x\n", addr, val);
481
#ifdef USE_KQEMU
481
#ifdef CONFIG_KQEMU
482 482
    if (env)
483 483
        env->last_io_time = cpu_get_time_fast();
484 484
#endif
......
490 490
    int val;
491 491
    val = ioport_read(2, addr);
492 492
    LOG_IOPORT("inl : %04x %08x\n", addr, val);
493
#ifdef USE_KQEMU
493
#ifdef CONFIG_KQEMU
494 494
    if (env)
495 495
        env->last_io_time = cpu_get_time_fast();
496 496
#endif
......
1357 1357
        if (env) {
1358 1358
            /* stop the currently executing cpu because a timer occured */
1359 1359
            cpu_exit(env);
1360
#ifdef USE_KQEMU
1360
#ifdef CONFIG_KQEMU
1361 1361
            if (env->kqemu_enabled) {
1362 1362
                kqemu_cpu_interrupt(env);
1363 1363
            }
......
3343 3343
    CPUState *env = cpu_single_env;
3344 3344
    if (env) {
3345 3345
        cpu_exit(env);
3346
#ifdef USE_KQEMU
3346
#ifdef CONFIG_KQEMU
3347 3347
        if (env->kqemu_enabled) {
3348 3348
            kqemu_cpu_interrupt(env);
3349 3349
        }
......
4634 4634

  
4635 4635
                /* On 32-bit hosts, QEMU is limited by virtual address space */
4636 4636
                if (value > (2047 << 20)
4637
#ifndef USE_KQEMU
4637
#ifndef CONFIG_KQEMU
4638 4638
                    && HOST_LONG_BITS == 32
4639 4639
#endif
4640 4640
                    ) {
......
4809 4809
                }
4810 4810
                break;
4811 4811
#endif
4812
#ifdef USE_KQEMU
4812
#ifdef CONFIG_KQEMU
4813 4813
            case QEMU_OPTION_no_kqemu:
4814 4814
                kqemu_allowed = 0;
4815 4815
                break;
......
4820 4820
#ifdef CONFIG_KVM
4821 4821
            case QEMU_OPTION_enable_kvm:
4822 4822
                kvm_allowed = 1;
4823
#ifdef USE_KQEMU
4823
#ifdef CONFIG_KQEMU
4824 4824
                kqemu_allowed = 0;
4825 4825
#endif
4826 4826
                break;
......
4976 4976
        }
4977 4977
    }
4978 4978

  
4979
#if defined(CONFIG_KVM) && defined(USE_KQEMU)
4979
#if defined(CONFIG_KVM) && defined(CONFIG_KQEMU)
4980 4980
    if (kvm_allowed && kqemu_allowed) {
4981 4981
        fprintf(stderr,
4982 4982
                "You can not enable both KVM and kqemu at the same time\n");
......
5055 5055
    }
5056 5056
#endif
5057 5057

  
5058
#ifdef USE_KQEMU
5058
#ifdef CONFIG_KQEMU
5059 5059
    if (smp_cpus > 1)
5060 5060
        kqemu_allowed = 0;
5061 5061
#endif
......
5148 5148
    if (ram_size == 0)
5149 5149
        ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
5150 5150

  
5151
#ifdef USE_KQEMU
5151
#ifdef CONFIG_KQEMU
5152 5152
    /* FIXME: This is a nasty hack because kqemu can't cope with dynamic
5153 5153
       guest ram allocation.  It needs to go away.  */
5154 5154
    if (kqemu_allowed) {

Also available in: Unified diff