History | View | Annotate | Download (134.4 kB)
w64: Use uintptr_t in exec.c
Replace all type casts to 'long' or 'unsigned long' by 'intptr_t' or 'uintptr_t'.
For type casts which are only used to extract the lower bits of an addressor to modify those bits, signedness does not matter. There I always use 'uintptr_t'....
w64: Fix data types in cpu-all.h, exec.c
w64 needs uintptr_t instead of unsigned long.For other hosts, nothing changes.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
w64: Use larger alignment for section with generated code
The MinGW-w64 compiler allows attribute((aligned (32)).
exec: provide tb_invalidate_phys_addr function
Allow TB invalidation by its physical address, extract implementationfrom the breakpoint_invalidate function.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Use uintptr_t for various op related functions
Use uintptr_t instead of void * or unsigned long inseveral op related functions, env->mem_io_pc andGETPC macro.
Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
w64: Fix data type of tb_next and other variables used for host addresses
QEMU host addresses must use uintptr_t to be portable for hosts withan unusual size of long (w64).
tb_jmp_offset is an uint16_t value, therefore the local variable offsetin function tb_set_jmp_target was changed from unsigned long to uint16_t....
tcg: Use the GDB JIT debugging interface.
This allows us to generate unwind info for the dynamicly generatedcode in the code_gen_buffer. Only i386 is converted at this point.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
exec: fix guest memory access for Xen
In cpu_physical_memory_rw, a change has been introduced and qemu_get_ram_ptr isno longuer called with the ram addr we want to access, but only with thesection address. This patch fixes this. (All other call to qemu_get_ram_ptr are...
memory: check for watchpoints when getting code ram_addr
The code to get the ram_addr from a (tlb entry, vaddr) pairchecks that the resulting memory is not MMIO, but neglects tocheck whether the region is hidden by a watchpoint page.
Add the missing check....
exec: fix write tlb entry misused as iotlb
A couple of code paths check the lower bits of CPUTLBEntry::addr_writeagainst io_mem_ram as a way of looking for a dirty RAM page. This worksby accident since the value is zero, which matches all clear bits for...
softmmu templates: optionally pass CPUState to memory access functions
Optionally, make memory access helpers take a parameter for CPUStateinstead of relying on global env.
On most targets, perform simple moves to reorder registers. On i386,switch from regparm(3) calling convention to standard stack-based...
Rename CPUState -> CPUArchState
Scripted conversion: for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done...
memory: get rid of cpu_register_io_memory()
The return value of cpu_register_io_memory() is no longer used anywhere, sowe can remove it and all associated data and code.
Signed-off-by: Avi Kivity <avi@redhat.com>
memory: dispatch directly via MemoryRegion
Instead of indirecting via io_mem_region, dispatch directlythrough the MemoryRegion obtained from the iotlb or phys_page_find().
exec: fix code tlb entry misused as iotlb in get_page_addr_code()
get_page_addr_code() reads a code tlb entry, but interprets it as aniotlb entry. This works by accident since the low bits of a RAM codetlb entry are clear, and match a RAM iotlb entry. This accident is...
memory: store section indices in iotlb instead of io indices
A step towards eliminating io indices.
memory: make phys_page_find() return an unadjusted section
We'd like to store the section index in the iotlb, so we can'tadjust it before returning. Return an unadjusted section andinstead introduce section_addr(), which does the adjustment later.
memory: fix I/O port aliases
Commit e58ac72b6a0 ("ioport: change portio_list not to usememory_region_set_offset()") started using aliases of I/O memoryregions. Since the IORange used for the I/O was contained in thetarget region, the alias information (specifically, the offset...
Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
memory: replace phys_page_find_alloc() with phys_page_set()
By giving the function the value we want to set, we make itmore flexible for the next patch.
memory: switch phys_page_set() to a recursive implementation
Setting multiple pages at once requires backtracking to previousnodes; easiest to achieve via recursion.
memory: change phys_page_set() to set multiple pages
memory: unify PhysPageEntry::node and ::leaf
They have the same type, unify them.
memory: allow phys_map tree paths to terminate early
When storing large contiguous ranges in phys_map, all values tend tobe the same pointers to a single MemoryRegionSection. Collapse themby marking nodes with level > 0 as leaves. This reduces tree memory...
memory: unify the two branches of cpu_register_physical_memory_log()
Identical except that the second branch knows its not modifying an existingsubpage.
memory: move tlb flush to MemoryListener commit callback
This way, if we have several changes in a single transaction, we flush justonce.
memory: make phys_page_find() return a MemoryRegionSection
We no longer describe memory in terms of individual pages; use sectionsthroughout instead.
PhysPageDesc no longer used - remove.
memory: give phys_page_find() its own tree search loop
We'll change phys_page_find_alloc() soon, but phys_page_find()doesn't need to bear the consequences.
memory: simplify multipage/subpage registration
Instead of considering subpage on a per-page basis, split each sectioninto a subpage head, multipage body, and subpage tail, and registereach separately. This simplifies the registration functions.
memory: change memory registration to rebuild the memory map on each change
Instead of incrementally building the memory map, rebuild it every time.This allows later simplification, since the code need not consider overlayinga previous mapping. It is also RCU friendly....
memory: remove first level of l1_phys_map
L1 and the lower levels in l1_phys_map are equivalent, except that L1 hasa different size, and is always allocated. Simplify the code by removingL1. This leaves us with a tree composed solely of L2 tables, but that...
memory: unify phys_map last level with intermediate levels
This lays the groundwork for storing leaf data in intermediate levels,saving space.
memory: store MemoryRegionSection pointers in phys_map
Instead of storing PhysPageDesc, store pointers to MemoryRegionSections.The various offsets (phys_offset & ~TARGET_PAGE_MASK,PHYS_OFFSET & TARGET_PAGE_MASK, region_offset) can all be synthesizedfrom the information in a MemoryRegionSection. Adjust phys_page_find()...
memory: compress phys_map node pointers to 16 bits
Use an expanding vector to store nodes. Allocation is baroque to g_renew()potentially invalidating pointers; this will be addressed later.
memory: fix RAM subpages in newly initialized pages
If the first subpage installed in a page is RAM, then we install it asa full page, instead of a subpage. Fix by not special casing RAM.
The issue dates to commit db7b5426a4b4242, which introduced subpages....
memory: don't pass ->readable attribute to cpu_register_physical_memory_log
It can be derived from the MemoryRegion itself (which is why it is notused there).
Signed-off-by: Avi Kivity <avi@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>
memory: use a MemoryListener for core memory map updates too
This transforms memory.c into a library which can then be unit testedeasily, by feeding it inputs and listening to its outputs.
memory: allow MemoryListeners to observe a specific address space
Ignore any regions not belonging to a specified address space.
memory: split memory listener for the two address spaces
The memory and I/O address spaces do different things, so split them intotwo memory listeners.
memory: support stateless memory listeners
Current memory listeners are incremental; that is, they are expected tomaintain their own state, and receive callbacks for changes to that state.
This patch adds support for stateless listeners; these work by receiving...
exec: fix check_watchpoint exiting cpu_loop
In case of BP_STOP_BEFORE_ACCESS watchpoint check_watchpoint intends tosignal EXCP_DEBUG exception on exit from cpu loop, but later overwritesexception code by the cpu_resume_from_signal call.
Use cpu_loop_exit with BP_STOP_BEFORE_ACCESS watchpoints....
exec: let cpu_watchpoint_insert accept larger watchpoints
Make cpu_watchpoint_insert accept watchpoints of any power-of-two sizeup to the target page size.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
exec: add missing breaks to the watch_mem_write
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Reviewed-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Meador Inge <meadori@codesourcery.com>
exec.c: Clarify comment about tlb_flush() flush_global parameter
Clarify the comment about tlb_flush()'s flush_global parameter,so it is clearer what it does and why it is OK that the implementationcurrently ignores it.
Reviewed-by: Andreas F=C3=A4rber <afaerber@suse.de>...
virtio-pci: Fix endianness of virtio config
The virtio config area in PIO space is a bit special. The initialheader is little endian but the rest (device specific) is guestnative endian.
The PIO accessors for PCI on machines that don't have native IO ports...
tcg-arm: fix a typo in comments
ARM still doesn't support 16GB buffers in 32-bit modes, replace the16GB by 16MB in the comment.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Convert IO_MEM_{RAM,ROM,UNASSIGNED,NOTDIRTY} to MemoryRegions
Convert the fixed-address IO_MEM_RAM, IO_MEM_ROM, IO_MEM_UNASSIGNED,and IO_MEM_NOTDIRTY io handlers to MemoryRegions. These aren't realregions, since they are never added to the memory hierarchy, but they...
Switch cpu_register_physical_memory_log() to use MemoryRegions
Still internally using ram_addr.
Convert the subpage wrapper to be a MemoryRegion
Convert IO_MEM_SUBPAGE_RAM to be a MemoryRegion
Convert io_mem_watch to be a MemoryRegion
Direct dispatch through MemoryRegion
Now that all mmio goes through MemoryRegions, we can convertio_mem_opaque to be a MemoryRegion pointer, and remove the thunksthat convert from old-style CPU{Read,Write}MemoryFunc to MemoryRegionOps.
Signed-off-by: Avi Kivity <avi@redhat.com>...
Remove IO_MEM_SUBPAGE
Replace with a MemoryRegion flag.
Drop IO_MEM_ROMD
Unlike ->readonly, ->readable is not inherited from aliase, so we can simplyquery the memory region.
Remove IO_MEM_SHIFT
We no longer use any of the lower bits of a ram_addr, so we might as welluse them for the io table index. This increases the number of potentialI/O handlers by a factor of 8.
memory: obsolete cpu_physical_memory_[gs]et_dirty_tracking()
The getter is no longer used, so it is completely removed.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>
memory: move endianness compensation to memory core
Instead of doing device endianness compensation in cpu_register_io_memory(),do it in the memory core.
exec: make phys_page_find() return a temporary
Instead of returning a PhysPageDesc pointer, return a temporary.This lets us move away from actually storing PhysPageDesc's, andinstead sythesising them when needed.
memory: move mmio access to functions
Currently mmio access goes directly to the io_mem_{read,write} arrays.In preparation for eliminating them, add indirection via a function.
Fix wrong region_offset when overlaying a page with another
cpu_register_physical_memory_log() does not update region_offsetif a page was previously registered for the same address. Thiscould cause mmio accesses going to the wrong place, by using theold region_offset....
Avoid range comparisons on io index types
The code sometimes uses range comparisons on io indexes (e.g.index =< IO_MEM_ROM). Avoid these as they make moving to objects harder.
Uninline get_page_addr_code()
Its use of IO_MEM_ROM and friends will later cause #include loops; and itis too large to merit inlining.
vmstate, memory: decouple vmstate from memory API
Currently creating a memory region automatically registers it forlive migration. This differs from other state (which is enumeratedin a VMStateDescription structure) and ties the live migration codeinto the memory core....
Store MemoryRegion in RAMBlock
As a step in moving live migration from RAMBlocks to MemoryRegions,store the MemoryRegion in a RAMBlock.
Remove cpu_get_physical_page_desc()
No longer used.
memory: remove CPUPhysMemoryClient
memory: add API for observing updates to the physical memory map
Add an API that allows a client to observe changes in the globalmemory map: - region added (possibly with logging enabled) - region removed (possibly with logging enabled) - logging started on a region...
memory: move obsolete exec.c functions to a private header
This will help avoid accidental usage.
memory, xen: pass MemoryRegion to xen_ram_alloc()
Currently xen_ram_alloc() relies on ram_addr, which is going away.Give it something else to use as a cookie.
phys_page_find_alloc: Use correct initial region_offset.
This fixes a common bug with initial region_offset value.Usually, the pages are re-assigned afterwards, so the bughas a very small effect on regular QEMU use flows.
Signed-off-by: Alex Rozenman <Alex_Rozenman@mentor.com>...
exec.c: Fix subpage memory access to RAM MemoryRegion
Commit 95c318f5e1f88d7e5bcc6deac17330fd4806a2d3 (Fix segfault in mmiosubpage handling code.) prevented a segfault by making all subpageregistrations over an existing memory page perform an unassigned access....
tcg/arm: remove fixed map code buffer restriction
On ARM, don't map the code buffer at a fixed location, and fix up thecall/goto tcg routines to let it do long jumps.
Mapping the code buffer at a fixed address could sometimes result in it beingmapped over the top of the heap with pretty random results....
w32: Disable buffering for log file
W32 does not support line buffering, but it supports unbuffered output.
Unbuffered output is better for writing to qemu.log than fully bufferedoutput because it also shows the latest log messages when an applicationcrash occurs....
Error check find_ram_offset
Spotted via code review, we initialize offset to 0 to avoid acompiler warning, but in the unlikely case that offset isnever set to something else, we should abort instead of returna value that will almost certainly cause problems....
Make cpu_single_env thread-local
Make cpu_single_env thread-local. This fixes a regressionin handling of multi-threaded programs in linux-user mode(bug 823902).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>[Peter Maydell: rename tls_cpu_single_env to cpu_single_env]...
exec.c: Remove useless comment
As phys_ram_size had been removed since QEMU 0.12. Remove the uselesscomment.
Signed-off-by: Chen Wen-Ren <chenwj@iis.sinica.edu.tw>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
qemu-timer: move icount to cpus.c
None of this is needed by tools, and most of it can even be made staticinside cpus.c.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Move GETPC from dyngen-exec.h to exec-all.h
GETPC can be used even from outside of helper code. Move the macro toa more accessible location. Avoid a compile warning from redefining it in exec.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Remove qemu_host_page_bits
It was introduced with commit 54936004fddc52c321cb3f9a9a51140e782bed5das host_page_bits but never used.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
fix QLIST usage for RAM list
Spotted while reviewing the migration thread patches.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Integrate I/O memory regions into qemu
get_system_io() returns the root I/O memory region.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Use mmap to allocate execute memory
Use mmap to allocate executable memory on NetBSD as well.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
memory: use signed arithmetic
When trying to map an alias of a ram region, where the alias starts ataddress A and we map it into address B, and A > B, we had an arithmeticunderflow. Because we use unsigned arithmetic, the underflow convertedinto a large number which failed addrrange_intersects() tests....
Avoid allocating TCG resources in non-TCG mode
Do not allocate TCG-only resources like the translation buffer whenrunning over KVM or XEN. Saves a "few" bytes in the qemu address spaceand is also conceptually cleaner.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Merge remote-tracking branch 'agraf/xen-next' into staging
exec.c: initialize memory map
Allocate the root memory region and initialize it.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cpu-common: Have a ram_addr_t of uint64 with Xen.
In Xen case, memory can be bigger than the host memory. that mean a32bits host (and QEMU) should be able to handle a RAM address of 64bits.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>Signed-off-by: Alexander Graf <agraf@suse.de>
exec.c: Use ram_addr_t in cpu_physical_memory_rw(...).
As the variable pd and addr1 inside the function cpu_physical_memory_rware mean to handle a RAM address, they should be of the ram_addr_t typeinstead of unsigned long.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>...
Fix unassigned memory access handling
cea5f9a28faa528b6b1b117c9ab2d8828f473fef exposed bugs in unassigned memoryaccess handling. Fix them by always passing CPUState to the handlers.
Reported-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qemu_ram_ptr_length: take ram_addr_t as arguments
qemu_ram_ptr_length should take ram_addr_t as argument rather thantarget_phys_addr_t because is doing comparisons with RAMBlock addresses.
cpu_physical_memory_map should create a ram_addr_t address to pass to...
xen: Clean up map cache API naming
The map cache is a Xen thing, so its API should make this clear.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Alexander Graf <agraf@suse.de>
xen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XEN
Xen won't be enabled if there is no backend support available for thehost. And that also means the map cache will work. So drop the separateconfig switch and move the required stubs over to xen-stub.c.
exec.c: Fix calculation of code_gen_buffer_max_size
When calculating the point at which we should not try to put anotherTB into the code gen buffer, we have to allow not just for OPC_MAX_SIZEbut OPC_BUF_SIZE. This is because the target translate.c will only...
exec: add endian specific phys ld/st functions
Device code some times needs to access physical memory and does thatthrough the ld./st._phys functions. However, these are the exact samefunctions that the CPU uses to access memory, which means they willbe endianness swapped depending on the target CPU....
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Remove exec-all.h include directives
Most exec-all.h include directives are now useless, remove them.
exec: last_first_tb was only used in !ONLY_USER case
Once there, use a better variable name.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Merge remote-tracking branch 'mst/for_anthony' into staging
Conflicts: hw/usb-uhci.c
xen: mapcache performance improvements
Use qemu_invalidate_entry in cpu_physical_memory_unmap.
Do not lock mapcache entries in qemu_get_ram_ptr if the address falls inthe ramblock with offset == 0. We don't need to do that because thecallers of qemu_get_ram_ptr either try to map an entire block, other...