Revision 4a1418e0 exec.c
b/exec.c | ||
---|---|---|
70 | 70 |
#define TARGET_VIRT_ADDR_SPACE_BITS 42 |
71 | 71 |
#elif defined(TARGET_PPC64) |
72 | 72 |
#define TARGET_PHYS_ADDR_SPACE_BITS 42 |
73 |
#elif defined(TARGET_X86_64) && !defined(CONFIG_KQEMU)
|
|
73 |
#elif defined(TARGET_X86_64) |
|
74 | 74 |
#define TARGET_PHYS_ADDR_SPACE_BITS 42 |
75 |
#elif defined(TARGET_I386) && !defined(CONFIG_KQEMU)
|
|
75 |
#elif defined(TARGET_I386) |
|
76 | 76 |
#define TARGET_PHYS_ADDR_SPACE_BITS 36 |
77 | 77 |
#else |
78 |
/* Note: for compatibility with kqemu, we use 32 bits for x86_64 */ |
|
79 | 78 |
#define TARGET_PHYS_ADDR_SPACE_BITS 32 |
80 | 79 |
#endif |
81 | 80 |
|
... | ... | |
1763 | 1762 |
|
1764 | 1763 |
memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *)); |
1765 | 1764 |
|
1766 |
#ifdef CONFIG_KQEMU |
|
1767 |
if (env->kqemu_enabled) { |
|
1768 |
kqemu_flush(env, flush_global); |
|
1769 |
} |
|
1770 |
#endif |
|
1771 | 1765 |
tlb_flush_count++; |
1772 | 1766 |
} |
1773 | 1767 |
|
... | ... | |
1801 | 1795 |
tlb_flush_entry(&env->tlb_table[mmu_idx][i], addr); |
1802 | 1796 |
|
1803 | 1797 |
tlb_flush_jmp_cache(env, addr); |
1804 |
|
|
1805 |
#ifdef CONFIG_KQEMU |
|
1806 |
if (env->kqemu_enabled) { |
|
1807 |
kqemu_flush_page(env, addr); |
|
1808 |
} |
|
1809 |
#endif |
|
1810 | 1798 |
} |
1811 | 1799 |
|
1812 | 1800 |
/* update the TLBs so that writes to code in the virtual page 'addr' |
... | ... | |
1854 | 1842 |
if (length == 0) |
1855 | 1843 |
return; |
1856 | 1844 |
len = length >> TARGET_PAGE_BITS; |
1857 |
#ifdef CONFIG_KQEMU |
|
1858 |
/* XXX: should not depend on cpu context */ |
|
1859 |
env = first_cpu; |
|
1860 |
if (env->kqemu_enabled) { |
|
1861 |
ram_addr_t addr; |
|
1862 |
addr = start; |
|
1863 |
for(i = 0; i < len; i++) { |
|
1864 |
kqemu_set_notdirty(env, addr); |
|
1865 |
addr += TARGET_PAGE_SIZE; |
|
1866 |
} |
|
1867 |
} |
|
1868 |
#endif |
|
1869 | 1845 |
mask = ~dirty_flags; |
1870 | 1846 |
p = phys_ram_dirty + (start >> TARGET_PAGE_BITS); |
1871 | 1847 |
for(i = 0; i < len; i++) |
... | ... | |
2322 | 2298 |
ram_addr_t orig_size = size; |
2323 | 2299 |
void *subpage; |
2324 | 2300 |
|
2325 |
#ifdef CONFIG_KQEMU |
|
2326 |
/* XXX: should not depend on cpu context */ |
|
2327 |
env = first_cpu; |
|
2328 |
if (env->kqemu_enabled) { |
|
2329 |
kqemu_set_phys_mem(start_addr, size, phys_offset); |
|
2330 |
} |
|
2331 |
#endif |
|
2332 | 2301 |
if (kvm_enabled()) |
2333 | 2302 |
kvm_set_phys_mem(start_addr, size, phys_offset); |
2334 | 2303 |
|
... | ... | |
2423 | 2392 |
kvm_uncoalesce_mmio_region(addr, size); |
2424 | 2393 |
} |
2425 | 2394 |
|
2426 |
#ifdef CONFIG_KQEMU |
|
2427 |
/* XXX: better than nothing */ |
|
2428 |
static ram_addr_t kqemu_ram_alloc(ram_addr_t size) |
|
2429 |
{ |
|
2430 |
ram_addr_t addr; |
|
2431 |
if ((last_ram_offset + size) > kqemu_phys_ram_size) { |
|
2432 |
fprintf(stderr, "Not enough memory (requested_size = %" PRIu64 ", max memory = %" PRIu64 ")\n", |
|
2433 |
(uint64_t)size, (uint64_t)kqemu_phys_ram_size); |
|
2434 |
abort(); |
|
2435 |
} |
|
2436 |
addr = last_ram_offset; |
|
2437 |
last_ram_offset = TARGET_PAGE_ALIGN(last_ram_offset + size); |
|
2438 |
return addr; |
|
2439 |
} |
|
2440 |
#endif |
|
2441 |
|
|
2442 | 2395 |
ram_addr_t qemu_ram_alloc(ram_addr_t size) |
2443 | 2396 |
{ |
2444 | 2397 |
RAMBlock *new_block; |
2445 | 2398 |
|
2446 |
#ifdef CONFIG_KQEMU |
|
2447 |
if (kqemu_phys_ram_base) { |
|
2448 |
return kqemu_ram_alloc(size); |
|
2449 |
} |
|
2450 |
#endif |
|
2451 |
|
|
2452 | 2399 |
size = TARGET_PAGE_ALIGN(size); |
2453 | 2400 |
new_block = qemu_malloc(sizeof(*new_block)); |
2454 | 2401 |
|
... | ... | |
2491 | 2438 |
RAMBlock **prevp; |
2492 | 2439 |
RAMBlock *block; |
2493 | 2440 |
|
2494 |
#ifdef CONFIG_KQEMU |
|
2495 |
if (kqemu_phys_ram_base) { |
|
2496 |
return kqemu_phys_ram_base + addr; |
|
2497 |
} |
|
2498 |
#endif |
|
2499 |
|
|
2500 | 2441 |
prev = NULL; |
2501 | 2442 |
prevp = &ram_blocks; |
2502 | 2443 |
block = ram_blocks; |
... | ... | |
2529 | 2470 |
RAMBlock *block; |
2530 | 2471 |
uint8_t *host = ptr; |
2531 | 2472 |
|
2532 |
#ifdef CONFIG_KQEMU |
|
2533 |
if (kqemu_phys_ram_base) { |
|
2534 |
return host - kqemu_phys_ram_base; |
|
2535 |
} |
|
2536 |
#endif |
|
2537 |
|
|
2538 | 2473 |
prev = NULL; |
2539 | 2474 |
prevp = &ram_blocks; |
2540 | 2475 |
block = ram_blocks; |
... | ... | |
2639 | 2574 |
#endif |
2640 | 2575 |
} |
2641 | 2576 |
stb_p(qemu_get_ram_ptr(ram_addr), val); |
2642 |
#ifdef CONFIG_KQEMU |
|
2643 |
if (cpu_single_env->kqemu_enabled && |
|
2644 |
(dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK) |
|
2645 |
kqemu_modify_page(cpu_single_env, ram_addr); |
|
2646 |
#endif |
|
2647 | 2577 |
dirty_flags |= (0xff & ~CODE_DIRTY_FLAG); |
2648 | 2578 |
phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; |
2649 | 2579 |
/* we remove the notdirty callback only if the code has been |
... | ... | |
2664 | 2594 |
#endif |
2665 | 2595 |
} |
2666 | 2596 |
stw_p(qemu_get_ram_ptr(ram_addr), val); |
2667 |
#ifdef CONFIG_KQEMU |
|
2668 |
if (cpu_single_env->kqemu_enabled && |
|
2669 |
(dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK) |
|
2670 |
kqemu_modify_page(cpu_single_env, ram_addr); |
|
2671 |
#endif |
|
2672 | 2597 |
dirty_flags |= (0xff & ~CODE_DIRTY_FLAG); |
2673 | 2598 |
phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; |
2674 | 2599 |
/* we remove the notdirty callback only if the code has been |
... | ... | |
2689 | 2614 |
#endif |
2690 | 2615 |
} |
2691 | 2616 |
stl_p(qemu_get_ram_ptr(ram_addr), val); |
2692 |
#ifdef CONFIG_KQEMU |
|
2693 |
if (cpu_single_env->kqemu_enabled && |
|
2694 |
(dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK) |
|
2695 |
kqemu_modify_page(cpu_single_env, ram_addr); |
|
2696 |
#endif |
|
2697 | 2617 |
dirty_flags |= (0xff & ~CODE_DIRTY_FLAG); |
2698 | 2618 |
phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; |
2699 | 2619 |
/* we remove the notdirty callback only if the code has been |
... | ... | |
3044 | 2964 |
|
3045 | 2965 |
io_mem_watch = cpu_register_io_memory(watch_mem_read, |
3046 | 2966 |
watch_mem_write, NULL); |
3047 |
#ifdef CONFIG_KQEMU |
|
3048 |
if (kqemu_phys_ram_base) { |
|
3049 |
/* alloc dirty bits array */ |
|
3050 |
phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS); |
|
3051 |
memset(phys_ram_dirty, 0xff, kqemu_phys_ram_size >> TARGET_PAGE_BITS); |
|
3052 |
} |
|
3053 |
#endif |
|
3054 | 2967 |
} |
3055 | 2968 |
|
3056 | 2969 |
#endif /* !defined(CONFIG_USER_ONLY) */ |
Also available in: Unified diff