- Mar 20, 2018
-
-
Luke Shumaker authored
At a fixed distance after the usable memory that init_guest_space maps, for 32-bit ARM targets we also need to map a commpage. The normal init_guest_space logic doesn't keep this in mind when searching for an address range. If !host_start, then try to find a big continuous segment where we can put both the usable memory and the commpage; we then munmap that segment and set current_start to that address; and let the normal code mmap the usable memory and the commpage separately. That is: if we don't have hint of where to start looking for memory, come up with one that is better than NULL. Depending on host_size and guest_start, there may or may not be a gap between the usable memory and the commpage, so this is slightly more restrictive than it needs to be; but it's only a hint, so that's OK. We only do that for !host start, because if host_start, then either: - we got an address passed in with -B, in which case we don't want to interfere with what the user said; - or host_start is based off of the ELF image's loaddr. The check "if (host_start && real_start != current_start)" suggests that we really want lowest available address that is >= loaddr. I don't know why that is, but I'm trusting that Paul Brook knew what he was doing when he wrote the original version of that check in c581deda way back in 2010. Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-11-lukeshu@lukeshu.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Mar 19, 2018
-
-
Igor Mammedov authored
With all targets defining CPU_RESOLVING_TYPE, refactor cpu_parse_cpu_model(type, cpu_model) to parse_cpu_model(cpu_model) so that callers won't have to know internal resolving cpu type. Place it in exec.c so it could be called from both target independed vl.c and *-user/main.c. That allows us to stop abusing cpu type from MachineClass::default_cpu_type as resolver class in vl.c which were confusing part of cpu_parse_cpu_model(). Also with new parse_cpu_model(), the last users of cpu_init() in null-machine.c and bsd/linux-user targets could be switched to cpu_create() API and cpu_init() API will be removed by follow up patch. With no longer users left remove MachineState::cpu_model field, new code should use MachineState::cpu_type instead and leave cpu_model parsing to generic code in vl.c. Signed-off-by:
Igor Mammedov <imammedo@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1518000027-274608-5-git-send-email-imammedo@redhat.com> [ehabkost: Fix bsd-user build error] Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com>
-
- Mar 16, 2018
-
-
Max Filippov authored
Import list of syscalls from the kernel source. Conditionalize code/data that is only used with softmmu. Implement exception handlers. Implement signal hander (only the core registers for now, no coprocessors or TIE). Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com>
-
- Mar 13, 2018
-
-
Max Filippov authored
target_msync is not used, remove its declaration and implementation. Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com>
-
Max Filippov authored
target_mprotect/target_munmap return value goes through get_errno at the call site, thus the functions must either set errno to host error code and return -1 or return negative guest error code. Do the latter. Cc: qemu-stable@nongnu.org Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com>
-
Max Filippov authored
shmdt fails to call mmap_lock/mmap_unlock around page_set_flags, resulting in the following assertion: page_set_flags: Assertion `have_mmap_lock()' failed. Wrap shmdt internals into mmap_lock/mmap_unlock. Cc: qemu-stable@nongnu.org Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com>
-
Max Filippov authored
In linux-user QEMU that runs for a target with TARGET_ABI_BITS bigger than L1_MAP_ADDR_SPACE_BITS an assertion in page_set_flags fires when mmap, munmap, mprotect, mremap or shmat is called for an address outside the guest address space. mmap and mprotect should return ENOMEM in such case. Change definition of GUEST_ADDR_MAX to always be the last valid guest address. Account for this change in open_self_maps. Add macro guest_addr_valid that verifies if the guest address is valid. Add function guest_range_valid that verifies if address range is within guest address space and does not wrap around. Use that macro in mmap/munmap/mprotect/mremap/shmat for error checking. Cc: qemu-stable@nongnu.org Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com>
-
Luke Shumaker authored
Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-10-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Luke Shumaker authored
If the ensure-alignment code gets triggered, then the "if (host_start && real_start != current_start)" check will always trigger, so save 2 syscalls and put that check first. Note that we can't just switch to using MAP_FIXED for that check, because then we couldn't differentiate between a failure because "there isn't enough space" and "there isn't enough space *here*". Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-9-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Luke Shumaker authored
Instead of doing if (check1) { if (check2) { success; } } retry; Do a clearer if (!check1) { goto try_again; } if (!check2) { goto try_again; } success; try_again: retry; Besides being clearer, this makes it easier to insert more checks that need to trigger a retry on check failure, or rearrange them, or anything like that. Because some indentation is changing, "ignore space change" may be useful for viewing this patch. Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-8-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> [lv: modified to try again fi valid == 0, not valid == -1 (error case)] Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Mar 12, 2018
-
-
Thomas Huth authored
Since commit 67a1de0d there is no space anymore between the version number and the parentheses when running configure with --with-pkgversion=foo : $ qemu-system-s390x --version QEMU emulator version 2.11.50(foo) But the space is included when building without that option when building from a git checkout: $ qemu-system-s390x --version QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty) The same confusion exists with the "query-version" QMP command. Let's fix this by introducing a proper QEMU_FULL_VERSION definition that includes the space and parentheses, while the QEMU_PKGVERSION should just cleanly contain the package version string itself. Note that this also changes the behavior of the "query-version" QMP command (the space and parentheses are not included there anymore), but that's supposed to be OK since the strings there are not meant to be parsed by other tools. Fixes: 67a1de0d Buglink: https://bugs.launchpad.net/qemu/+bug/1673373 Signed-off-by:
Thomas Huth <thuth@redhat.com> Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Mar 09, 2018
-
-
Luke Shumaker authored
Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-7-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Luke Shumaker authored
There are 3 parts to this change: - Add a comment showing the relative sizes and positions of the blocks of memory - introduce and use new aligned_{start,size} instead of adjusting real_{start_size} - When we clean up (on failure), munmap(real_start, real_size) instead of munmap(aligned_start, aligned_size). It *shouldn't* make any difference, but I will admit that this does mean we are making the syscall with different values, so this isn't quite a no-op patch. Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-6-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Luke Shumaker authored
init_guest_commpage needs to check if the mapped space, which ends at real_start+real_size overlaps with where it needs to put the commpage, which is (assuming sane qemu_host_page_size) guest_base + 0xffff000, where guest_base is real_start - guest_start. [guest_base][ 0xffff0000 ][commpage] [guest_base][guest_start][real_size] [commpage] [ real_start ][real_size] [commpage] ^ fail if this gap < 0 Since init_guest_commpage wants to do everything relative to guest_base (rather than real_start), it obviously needs to be comparing 0xffff0000 against guest_start+real_size, not just real_size. This bug has been present since 806d1021 in 2012, but guest_start is usually 0, and prior to v2.11 real_size was usually much smaller than 0xffff0000, so it was uncommon for it to have made a difference. Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-5-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Luke Shumaker authored
We'll just exit with an error anyway, so it doesn't really matter, but it is cleaned up in all of the other places were we error out. Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-4-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Luke Shumaker authored
init_guest_commpage is a much more honest description of what the function does. validate_guest_space not only suggests that the function has no side-effects, but also introduces confusion as to why it is only needed on 32-bit ARM targets. Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-3-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Luke Shumaker authored
Instead of defining a bogus validate_guest_space that always returns 1 on targets other than 32-bit ARM, use #if blocks to only call it on 32-bit ARM targets. This makes the "normal" flow control clearer. Signed-off-by:
Luke Shumaker <lukeshu@parabola.nu> Message-Id: <20171228180814.9749-2-lukeshu@lukeshu.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> [lv: fix condition to "!= 1" as requested by Peter] Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Max Filippov authored
target_msync is not used, remove its declaration and implementation. Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180228221609.11265-9-jcmvbkbc@gmail.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Max Filippov authored
target_mprotect/target_munmap return value goes through get_errno at the call site, thus the functions must either set errno to host error code and return -1 or return negative guest error code. Do the latter. Cc: qemu-stable@nongnu.org Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180228221609.11265-8-jcmvbkbc@gmail.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Max Filippov authored
shmdt fails to call mmap_lock/mmap_unlock around page_set_flags, resulting in the following assertion: page_set_flags: Assertion `have_mmap_lock()' failed. Wrap shmdt internals into mmap_lock/mmap_unlock. Cc: qemu-stable@nongnu.org Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180228221609.11265-7-jcmvbkbc@gmail.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Max Filippov authored
In linux-user QEMU that runs for a target with TARGET_ABI_BITS bigger than L1_MAP_ADDR_SPACE_BITS an assertion in page_set_flags fires when mmap, munmap, mprotect, mremap or shmat is called for an address outside the guest address space. mmap and mprotect should return ENOMEM in such case. Change definition of GUEST_ADDR_MAX to always be the last valid guest address. Account for this change in open_self_maps. Add macro guest_addr_valid that verifies if the guest address is valid. Add function guest_range_valid that verifies if address range is within guest address space and does not wrap around. Use that macro in mmap/munmap/mprotect/mremap/shmat for error checking. Cc: qemu-stable@nongnu.org Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Max Filippov <jcmvbkbc@gmail.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180307215010.30706-1-jcmvbkbc@gmail.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Shea Levy authored
Signed-off-by:
Shea Levy <shea@shealevy.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180301111500.15717-1-shea@shealevy.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Peter Maydell authored
Now we've dropped unicore32, all of the architectures we support for linux-user implement the signal handling routines. The dummy "just print a message" versions are unimplemented, so we can drop them entirely. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180308144733.25615-3-peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Peter Maydell authored
We dropped the unicore32-linux-user target in commit 5e2b40f7 in 2016. Nobody has made any attempt to fix the issues that caused us to drop it, so remove the associated code. (The system emulation parts of unicore32 remain.) Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180308144733.25615-2-peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Richard Henderson authored
Depending on the currently selected size of the SVE vector registers, we can either store the data within the "standard" allocation, or we may beedn to allocate additional space with an EXTRA record. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-id: 20180303143823.27055-6-richard.henderson@linaro.org Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Richard Henderson authored
The EXTRA record allows for additional space to be allocated beyon what is currently reserved. Add code to emit and read this record type. Nothing uses extra space yet. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-id: 20180303143823.27055-5-richard.henderson@linaro.org Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Richard Henderson authored
This changes the qemu signal frame layout to be more like the kernel's, in that the various records are dynamically allocated rather than fixed in place by a structure. For now, all of the allocation is out of uc.tuc_mcontext.__reserved, so the allocation is actually trivial. That will change with SVE support. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-id: 20180303143823.27055-4-richard.henderson@linaro.org Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Richard Henderson authored
Split out helpers from target_setup_frame and target_restore_sigframe for dealing with general registers, fpsimd registers, and the end record. When we add support for sve registers, the relative positions of these will change. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-id: 20180303143823.27055-3-richard.henderson@linaro.org Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Richard Henderson authored
As an implementation choice, widening VL has zeroed the previously inaccessible portion of the sve registers. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Acked-by:
Alex Bennée <alex.bennee@linaro.org> Message-id: 20180303143823.27055-2-richard.henderson@linaro.org Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Mar 06, 2018
-
-
Michael Clark authored
Implementation of linux user emulation for RISC-V. Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Sagar Karandikar <sagark@eecs.berkeley.edu> Signed-off-by:
Michael Clark <mjc@sifive.com>
-
- Mar 02, 2018
-
-
Richard Henderson authored
Not enabled anywhere yet. Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-id: 20180228193125.20577-11-richard.henderson@linaro.org Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Richard Henderson authored
Not enabled anywhere yet. Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-id: 20180228193125.20577-2-richard.henderson@linaro.org Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Mar 01, 2018
-
-
Peter Maydell authored
Set the appropriate Linux hwcap bits to tell the guest binary if we have implemented half-precision floating point support. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Feb 25, 2018
-
-
YunQiang Su authored
So here we need to detect the version of binaries and set cpu_model for it. Signed-off-by:
YunQiang Su <syq@debian.org> [lv: original patch modified to move code into cpu_get_model()] Signed-off-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180220173307.25125-5-laurent@vivier.eu>
-
Laurent Vivier authored
M680x0 doesn't support the same set of instructions as ColdFire, so we can't use "any" CPU type to execute m68020 instructions. We select CPU type ("m68040" or "any" for ColdFire) according to the ELF header. If we can't, we use by default the value used until now: "any". Signed-off-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180220173307.25125-4-laurent@vivier.eu>
-
YunQiang Su authored
Add a function to return ELF e_flags and use it to select the CPU model. Signed-off-by:
YunQiang Su <syq@debian.org> [lv: split the patch and some cleanup in get_elf_eflags()] Signed-off-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180220173307.25125-3-laurent@vivier.eu>
-
Laurent Vivier authored
Instead of a sequence of "#if ... #endif" move the selection to a function in linux-user/*/target_elf.h We can't add them in linux-user/*/target_cpu.h because we will need to include "elf.h" to use ELF flags with eflags, and including "elf.h" in "target_cpu.h" introduces some conflicts in elfload.c Suggested-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180220173307.25125-2-laurent@vivier.eu>
-
- Feb 18, 2018
-
-
Peter Maydell authored
Back when we used to support compiling either with or without NPTL threading library support, we used a macro THREAD which would expand either to nothing (no thread support) or to __thread (threads supported). For a long time now we have required thread support, so remove the macro and just use __thread directly as other parts of QEMU do. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180213132246.26844-1-peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Samuel Thibault authored
We properly computed the capped mask size to be put to the application buffer, but didn't actually used it. Also, we need to return the capped mask size instead of 0 on success. Signed-off-by:
Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20180211174704.27441-1-samuel.thibault@ens-lyon.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Guido Günther authored
This unbreaks the testcase from http://lists.nongnu.org/archive/html/qemu-arm/2018-01/msg00514.html Thanks to Laurent Vivier for spotting the 7th one. Signed-off-by:
Guido Günther <agx@sigxcpu.org> Tested-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Suggested-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <671eaa99f4e0bf3a58f76f9151f7cfa24662227f.1517565566.git.agx@sigxcpu.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-