summaryrefslogtreecommitdiff
path: root/exec.c
AgeCommit message (Collapse)AuthorFilesLines
2009-12-05Allocate physical memory in low virtual address spaceAlexander Graf1-0/+6
KVM on S390x requires the virtual address space of the guest's RAM to be within the first 256GB. The general direction I'd like to see KVM on S390 move is that this requirement is losened, but for now that's what we're stuck with. So let's just hack up qemu_ram_alloc until KVM behaves nicely :-). Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-11-29Add support for GNU/kFreeBSDAurelien Jarno1-1/+1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-10-15ksm supportIzik Eidus1-0/+3
Call MADV_MERGEABLE on guest memory allocations. MADV_MERGABLE will be available starting in Linux 2.6.32. This system call registers a region of virtual address space with Linux as a candidate for transparent memory sharing. Patchworks-ID: 35447 Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05fix comment on cpu_register_physical_memory_offsetMichael S. Tsirkin1-2/+3
We don't require full pages in cpu_register_physical_memory, except for RAM. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05vmstate: remove const from pre_save() functionsJuan Quintela1-2/+2
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05vmstate: add version_id argument to post_loadJuan Quintela1-1/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01Revert "Get rid of _t suffix"Anthony Liguori1-109/+109
In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01Get rid of _t suffixmalc1-109/+109
Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
2009-09-12Fix sys-queue.h conflict for goodBlue Swirl1-25/+25
Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-11vmstate: port cpu_comonJuan Quintela1-14/+25
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-03microblaze: Trap on bus accesses to unmapped areas.Edgar E. Iglesias1-6/+6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-08-27kvm: Simplify cpu_synchronize_state()Avi Kivity1-2/+2
cpu_synchronize_state() is a little unreadable since the 'modified' argument isn't self-explanatory. Simplify it by making it always synchronize the kernel state into qemu, and automatically flush the registers back to the kernel if they've been synchronized on this exit. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25Make CPURead/WriteFunc structure 'const'Blue Swirl1-14/+14
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-08-24Unbreak large mem support by removing kqemuAnthony Liguori1-89/+2
kqemu introduces a number of restrictions on the i386 target. The worst is that it prevents large memory from working in the default build. Furthermore, kqemu is fundamentally flawed in a number of ways. It relies on the TSC as a time source which will not be reliable on a multiple processor system in userspace. Since most modern processors are multicore, this severely limits the utility of kqemu. kvm is a viable alternative for people looking to accelerate qemu and has the benefit of being supported by the upstream Linux kernel. If someone can implement work arounds to remove the restrictions introduced by kqemu, I'm happy to avoid and/or revert this patch. N.B. kqemu will still function in the 0.11 series but this patch removes it from the 0.12 series. Paul, please Ack or Nack this patch. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-31Fix Sparse warnings: "Using plain integer as NULL pointer"Blue Swirl1-3/+4
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-27rename USE_NPTL to CONFIG_USE_NPTLJuan Quintela1-1/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27Remove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32Filip Navara1-1/+2
On Win32 the setvbuf function requires the last parameter to be size between 2 and INT_MAX bytes, so the calls always failed. Since the whole point of the calls is to set line-buffered mode for the file handle and that's not supported on Win32 anyway, conditionally remove them. Signed-off-by: Filip Navara <filip.navara@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-20Fix most warnings (errors with -Werror) when debugging is enabledBlue Swirl1-22/+3
I used the following command to enable debugging: perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * */* */*/* Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-16tlb flush cleanupIgor Kovalenko1-6/+9
Use static empty variable s_cputlb_empty_entry to clear entries, also reset addend member when clearing entries. This helps running with valgrind/memcheck Signed-off-by: igor.v.kovalenko@gmail.com -- Kind regards, Igor V. Kovalenko Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16Update to a hopefully more future proof FSF addressBlue Swirl1-2/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-29cpu_unregister_map_client: fix memory leak.Isaku Yamahata1-1/+2
fix memory leak in cpu_unregister_map_client() and cpu_notify_map_clients(). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Win32: Reduce section alignment for Windows.Stefan Weil1-0/+4
Maximum alignment for Win32 is 16, so don't try to set it to 32. Otherwise the compiler complains: exec.c:102: warning: alignment of 'code_gen_prologue' is greater than maximum object file alignment. Using 16 Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16exec.c: remove unnecessary #if NB_MMU_MODESIsaku Yamahata1-76/+23
remove unnecessary #if NB_MMU_MODES by using loop. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16provide cpu_index to env mappingGlauber Costa1-0/+13
There are some people interested in, given a cpu number, pick its CPUState. KVM is an example, although not yet in tree. This patch provides a way of doing that. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16Rearrange io_mem_init()Avi Kivity1-26/+21
Move io_mem_init() downwards to avoid a forward declaration. No code change. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16Remove io_index argument from cpu_register_io_memory()Avi Kivity1-9/+22
The parameter is always zero except when registering the three internal io regions (ROM, unassigned, notdirty). Remove the parameter to reduce the API's power, thus facilitating future change. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16linux-user: implemented ELF coredump support for ARM targetMika Westerberg1-23/+46
When target process is killed with signal (such signal that should dump core) a coredump file is created. This file is similar than coredump generated by Linux (there are few exceptions though). Riku Voipio: added support for rlimit Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-04fix gdbstub support for multiple threads in usermode, v3Nathan Froyd1-1/+1
When debugging multi-threaded programs, QEMU's gdb stub would report the correct number of threads (the qfThreadInfo and qsThreadInfo packets). However, the stub was unable to actually switch between threads (the T packet), since it would report every thread except the first as being dead. Furthermore, the stub relied upon cpu_index as a reliable means of assigning IDs to the threads. This was a bad idea; if you have this sequence of events: initial thread created new thread #1 new thread #2 thread #1 exits new thread #3 thread #3 will have the same cpu_index as thread #1, which would confuse GDB. (This problem is partly due to the remote protocol not having a good way to send thread creation/destruction events.) We fix this by using the host thread ID for the identifier passed to GDB when debugging a multi-threaded userspace program. The thread ID might wrap, but the same sort of problems with wrapping thread IDs would come up with debugging programs natively, so this doesn't represent a problem. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
2009-05-22kvm: Add missing bits to support live migrationJan Kiszka1-0/+6
This patch adds the missing hooks to allow live migration in KVM mode. It adds proper synchronization before/after saving/restoring the VCPU states (note: PPC is untested), hooks into cpu_physical_memory_set_dirty_tracking() to enable dirty memory logging at KVM level, and synchronizes that drity log into QEMU's view before running ram_live_save(). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-22kvm: Rework dirty bitmap synchronizationJan Kiszka1-2/+6
Extend kvm_physical_sync_dirty_bitmap() so that is can sync across multiple slots. Useful for updating the whole dirty log during migration. Moreover, properly pass down errors the whole call chain. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-03Fix typos in comments in exec.cStuart Brady1-8/+8
This patch fixes several typos in comments in exec.c: longet -> longer recommanded -> recommended ajustments -> adjustments inconsistancies -> inconsistencies phsical -> physical positionned -> positioned succesfully -> successfully regon_offset -> region_offset and also: start_region -> start_addr Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
2009-05-01kvm: Avoid COW if KVM MMU is asynchronousJan Kiszka1-0/+3
Avi Kivity wrote: > Suggest wrapping in a function and hiding it deep inside kvm-all.c. > Done in v2: ----------> If the KVM MMU is asynchronous (kernel does not support MMU_NOTIFIER), we have to avoid COW for the guest memory. Otherwise we risk serious breakage when guest pages change there physical locations due to COW after fork. Seen when forking smbd during runtime via -smb. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-04-30Remove cpu_get_io_memory_{read,write}.Paul Brook1-12/+1
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-04-24qemu: introduce qemu_cpu_kick (Marcelo Tosatti)aliguori1-0/+11
To notify cpu of pending interrupt. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7243 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-21added -numa cmdline parameter parser (Andre Przywara)aliguori1-0/+1
adds a -numa command line parameter and sets a QEMU global array with the memory sizes. The CPU-to-node assignemnt is written into the CPUState. If no specific values for memory and CPUs are given, all resources will be split equally across all nodes. This code currently support only up to 64 virtual CPUs. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7210 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-19kqemu: merge CONFIG_KQEMU and USE_KQEMUblueswir11-14/+14
Basically a recursive ":%s/USE_KQEMU/CONFIG_KQEMU/g". Signed-off-by: Paul Bolle <pebolle@tiscali.nl> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7189 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-11Implement dynamic guest ram allocation.pbrook1-14/+116
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7088 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-11Remove code phys_ram_base uses.pbrook1-19/+41
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7085 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-09Cleanup SPARC/TCX framebuffer allocation.pbrook1-0/+8
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7059 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-07Allow 5 mmu indexes.aurel321-5/+25
This is necessary for alpha because it has 4 protection levels and pal mode. Signed-off-by: Tristan Gingold <gingold@adacore.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7028 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05Fix some win32 compile warningsblueswir11-1/+0
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-28ROM write access for debugging (Jan Kiszka)aliguori1-3/+8
Enhance cpu_memory_rw_debug so that it can write even to ROM regions. This allows to modify ROM via gdb (I see no point in denying this to the user), and it will enable us to drop kvm_patch_opcode_byte(). Credits go to Avi for suggesting this. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6905 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-16Delete some unused macros detected with -Wp,-Wunused-macros useblueswir11-3/+0
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6856 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-12Guest debugging support for KVM (Jan Kiszka)aliguori1-3/+7
This is a backport of the guest debugging support for the KVM accelerator that is now part of the KVM tree. It implements the reworked KVM kernel API for guest debugging (KVM_CAP_SET_GUEST_DEBUG) which is not yet part of any mainline kernel but will probably be 2.6.30 stuff. So far supported is x86, but PPC is expected to catch up soon. Core features are: - unlimited soft-breakpoints via code patching - hardware-assisted x86 breakpoints and watchpoints Changes in this version: - use generic hook cpu_synchronize_state to transfer registers between user space and kvm - push kvm_sw_breakpoints into KVMState Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6825 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07Use a dedicated function to request exit from execution loopaurel321-24/+32
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6762 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07Clear CPU_INTERRUPT_EXIT on VM loadaurel321-0/+1
CPU_INTERRUPT_EXIT is not set anymore in env->interrupt_request since revision 6728. Make sure the bit is cleared on VM load. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6756 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07Support for DragonFly BSD (Hasso Tepper)blueswir11-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6746 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07Sparse fixes: NULL use, header order, ANSI prototypes, staticblueswir11-1/+1
Fix Sparse warnings: * use NULL instead of plain 0 * rearrange header include order to avoid redefining types accidentally * ANSIfy SLIRP * avoid "restrict" keyword * add static git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07The _exit syscall is used for both thread termination in NPTL applications,pbrook1-0/+6
and process termination in legacy applications. Try to guess which we want based on the presence of multiple threads. Also implement locking when modifying the CPU list. Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6735 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-06Fix race condition on access to env->interrupt_requestaurel321-5/+6
env->interrupt_request is accessed as the bit level from both main code and signal handler, making a race condition possible even on CISC CPU. This causes freeze of QEMU under high load when running the dyntick clock. The patch below move the bit corresponding to CPU_INTERRUPT_EXIT in a separate variable, declared as volatile sig_atomic_t, so it should be work even on RISC CPU. We may want to move the cpu_interrupt(env, CPU_INTERRUPT_EXIT) case in its own function and get rid of CPU_INTERRUPT_EXIT. That can be done later, I wanted to keep the patch short for easier review. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6728 c046a42c-6fe2-441c-8c8c-71466251a162