summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2018-04-04Merge remote-tracking branch ↵Peter Maydell3-6/+14
'remotes/vivier2/tags/linux-user-for-2.12-pull-request' into staging # gpg: Signature made Tue 03 Apr 2018 11:33:31 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-2.12-pull-request: linux-user: fix TARGET___O_TMPFILE for sparc linux-user: define TARGET_ARCH_HAS_KA_RESTORER linux-user: fix alpha signal emulation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-04-03linux-user: fix TARGET___O_TMPFILE for sparcLaurent Vivier1-0/+1
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180402102453.9883-3-laurent@vivier.eu>
2018-04-03linux-user: define TARGET_ARCH_HAS_KA_RESTORERLaurent Vivier3-4/+11
Sparc as an extended sigaction structure containing the field ka_restorer used in place of sa_restorer. Define TARGET_ARCH_HAS_KA_RESTORER and use it with sparc. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180402102453.9883-2-laurent@vivier.eu>
2018-04-03linux-user: fix alpha signal emulationLaurent Vivier1-2/+2
setup_frame() doesn't set correctly the address of the trampoline code. The offset of retcode array must be added to the stack frame address. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180401204653.14211-1-laurent@vivier.eu>
2018-04-02target/xtensa: linux-user: fix fadvise64 callMax Filippov1-1/+1
fadvise64_64 on xtensa passes advice as the second argument and so must be handled similar to PPC. This fixes glibc testsuite tests posix/tst-posix_fadvise and posix/tst-posix_fadvise64. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-04-01linux-user: implement clock_settimeMax Filippov1-0/+12
This fixes glibc testsuite test rt/tst-clock2. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-04-01linux-user: fix error propagation in clock_gettimeMax Filippov1-1/+1
host_to_target_timespec may return error if target address could not be locked, but it is ignored. Propagate return value of host_to_target_timespec to the caller of clock_gettime. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-04-01target/xtensa: linux-user: fix sysv IPC structuresMax Filippov1-7/+30
- make target_ipc_perm fields match kernel definitions for xtensa; - add target_semid64_ds with proper order of times and reserved fields for little/big endian specific for xtensa; - add missing reserved fields after time fields to the target_shmid_ds; - fix types of shm_cpid, shm_lpid and shm_nattch fields of target_shmid_ds to match kernel definitions for xtensa. These changes fix guest ipcs output and fix glibc testsuite tests sysvipc/test-sysvsem and sysvipc/test-sysvshm. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-03-31linux-user: fix mq_getsetattr implementationMax Filippov1-6/+7
mq_getsetattr implementation does not set errno correctly in case of error. Also in the presence of both 2nd and 3rd arguments it calls both mq_getattr and mq_setattr, whereas only the latter call would suffice. Don't call mq_getattr in the presence of the 2nd argument. Don't copy output back to user in case of error. Use get_errno to set errno value. This fixes test rt/tst-mqueue2 from the glibc testsuite. Cc: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-03-31linux-user: call cpu_copy under clone_lockMax Filippov1-3/+4
cpu_copy adds newly created CPU object to container/machine/unattached, but does it w/o proper locking. As a result when multiple threads create threads rapidly QEMU may abort with the following message: GLib-CRITICAL **: g_hash_table_iter_next: assertion 'ri->version == ri->hash_table->version' failed ERROR:qemu/qom/object.c:1663:object_get_canonical_path_component: code should not be reached E.g. this issue is observed when running glibc test nptl/tst-eintr1. Move cpu_copy invocation under clone_lock to fix that. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-03-31target/xtensa: linux-user: rewind pc for restarted syscallMax Filippov1-0/+3
In case of syscall restart request set pc back to the syscall instruction. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-03-31target/xtensa: fix flush_window_regsMax Filippov1-31/+24
flush_window_regs uses wrong stack frame to save overflow registers in call8 and call12 frames, which results in wrong register values in callers of a function that received a signal. Reimplement flush_window_regs closely following window overflow sequence. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-03-26linux-user/xtensa: remove stray syscall.hMax Filippov1-0/+0
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-03-20linux-user: init_guest_space: Try to make ARM space+commpage continuousLuke Shumaker1-0/+49
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 c581deda322080e8beb88b2e468d4af54454e4b3 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>
2018-03-19Use cpu_create(type) instead of cpu_init(cpu_model)Igor Mammedov1-2/+6
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>
2018-03-17Merge remote-tracking branch 'remotes/xtensa/tags/20180316-xtensa' into stagingPeter Maydell13-4/+1530
target/xtensa linux-user support. - small cleanup for xtensa registers dumping (-d cpu); - add support for debugging linux-user process with xtensa-linux-gdb (as opposed to xtensa-elf-gdb), which can only access unprivileged registers; - enable MTTCG for target/xtensa; - cleanup in linux-user/mmap area making sure that it works correctly with limited 30-bit-wide user address space; - import xtensa-specific definitions from the linux kernel, conditionalize user-only/softmmu-only code and add handlers for signals, exceptions, process/thread creation and core registers dumping. # gpg: Signature made Fri 16 Mar 2018 16:46:19 GMT # gpg: using RSA key 51F9CC91F83FA044 # gpg: Good signature from "Max Filippov <filippov@cadence.com>" # gpg: aka "Max Filippov <max.filippov@cogentembedded.com>" # gpg: aka "Max Filippov <jcmvbkbc@gmail.com>" # Primary key fingerprint: 2B67 854B 98E5 327D CDEB 17D8 51F9 CC91 F83F A044 * remotes/xtensa/tags/20180316-xtensa: MAINTAINERS: fix W: address for xtensa qemu-binfmt-conf.sh: add qemu-xtensa target/xtensa: add linux-user support linux-user: drop unused target_msync function linux-user: fix target_mprotect/target_munmap error return values linux-user: fix assertion in shmdt linux-user: fix mmap/munmap/mprotect/mremap/shmat target/xtensa: support MTTCG target/xtensa: use correct number of registers in gdbstub target/xtensa: mark register windows in the dump target/xtensa: dump correct physical registers Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # linux-user/syscall.c
2018-03-16target/xtensa: add linux-user supportMax Filippov13-4/+1530
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>
2018-03-16Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell1-1/+1
* Record-replay lockstep execution, log dumper and fixes (Alex, Pavel) * SCSI fix to pass maximum transfer size (Daniel Barboza) * chardev fixes and improved iothread support (Daniel Berrangé, Peter) * checkpatch tweak (Eric) * make help tweak (Marc-André) * make more PCI NICs available with -net or -nic (myself) * change default q35 NIC to e1000e (myself) * SCSI support for NDOB bit (myself) * membarrier system call support (myself) * SuperIO refactoring (Philippe) * miscellaneous cleanups and fixes (Thomas) # gpg: Signature made Mon 12 Mar 2018 16:10:52 GMT # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (69 commits) tcg: fix cpu_io_recompile replay: update documentation replay: save vmstate of the asynchronous events replay: don't process async events when warping the clock scripts/replay-dump.py: replay log dumper replay: avoid recursive call of checkpoints replay: check return values of fwrite replay: push replay_mutex_lock up the call tree replay: don't destroy mutex at exit replay: make locking visible outside replay code replay/replay-internal.c: track holding of replay_lock replay/replay.c: bump REPLAY_VERSION again replay: save prior value of the host clock replay: added replay log format description replay: fix save/load vm for non-empty queue replay: fixed replay_enable_events replay: fix processing async events cpu-exec: fix exception_index handling hw/i386/pc: Factor out the superio code hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # default-configs/i386-softmmu.mak # default-configs/x86_64-softmmu.mak
2018-03-15Merge remote-tracking branch ↵Peter Maydell14-852/+125
'remotes/vivier2/tags/linux-user-for-2.12-pull-request' into staging # gpg: Signature made Tue 13 Mar 2018 17:33:03 GMT # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-2.12-pull-request: linux-user: init_guest_space: Add a comment about search strategy linux-user: init_guest_space: Don't try to align if we'll reject it linux-user: init_guest_space: Clean up control flow a bit linux-user: init_guest_commpage: Add a comment about size check linux-user: init_guest_space: Clarify page alignment logic linux-user: init_guest_space: Correctly handle guest_start in commpage initialization linux-user: init_guest_space: Clean up if we can't initialize the commpage linux-user: Rename validate_guest_space => init_guest_commpage linux-user: Use #if to only call validate_guest_space for 32-bit ARM target qemu-binfmt-conf.sh: add qemu-xtensa linux-user: drop unused target_msync function linux-user: fix target_mprotect/target_munmap error return values linux-user: fix assertion in shmdt linux-user: fix mmap/munmap/mprotect/mremap/shmat linux-user: Support f_flags in statfs when available. linux-user: allows to use "--systemd ALL" with qemu-binfmt-conf.sh linux-user: Remove the unused "not implemented" signal handling stubs linux-user: Drop unicore32 code Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-03-13linux-user: drop unused target_msync functionMax Filippov2-18/+0
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>
2018-03-13linux-user: fix target_mprotect/target_munmap error return valuesMax Filippov1-4/+4
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>
2018-03-13linux-user: fix assertion in shmdtMax Filippov1-1/+7
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>
2018-03-13linux-user: fix mmap/munmap/mprotect/mremap/shmatMax Filippov2-6/+19
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>
2018-03-13linux-user: init_guest_space: Add a comment about search strategyLuke Shumaker1-0/+4
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>
2018-03-13linux-user: init_guest_space: Don't try to align if we'll reject itLuke Shumaker1-5/+5
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>
2018-03-13linux-user: init_guest_space: Clean up control flow a bitLuke Shumaker1-15/+19
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>
2018-03-12Polish the version strings containing the package versionThomas Huth1-1/+1
Since commit 67a1de0d195a 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: 67a1de0d195a6185c39b436159c9ffc7720bf979 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>
2018-03-09linux-user: init_guest_commpage: Add a comment about size checkLuke Shumaker1-0/+5
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>
2018-03-09linux-user: init_guest_space: Clarify page alignment logicLuke Shumaker1-10/+33
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>
2018-03-09linux-user: init_guest_space: Correctly handle guest_start in commpage ↵Luke Shumaker1-1/+1
initialization 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 806d102141b99d4f1e55a97d68b7ea8c8ba3129f 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>
2018-03-09linux-user: init_guest_space: Clean up if we can't initialize the commpageLuke Shumaker1-0/+1
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>
2018-03-09linux-user: Rename validate_guest_space => init_guest_commpageLuke Shumaker1-5/+5
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>
2018-03-09linux-user: Use #if to only call validate_guest_space for 32-bit ARM targetLuke Shumaker1-13/+10
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>
2018-03-09linux-user: drop unused target_msync functionMax Filippov2-18/+0
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>
2018-03-09linux-user: fix target_mprotect/target_munmap error return valuesMax Filippov1-4/+4
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>
2018-03-09linux-user: fix assertion in shmdtMax Filippov1-1/+7
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>
2018-03-09linux-user: fix mmap/munmap/mprotect/mremap/shmatMax Filippov2-6/+19
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>
2018-03-09linux-user: Support f_flags in statfs when available.Shea Levy2-22/+24
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>
2018-03-09linux-user: Remove the unused "not implemented" signal handling stubsPeter Maydell1-26/+1
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>
2018-03-09linux-user: Drop unicore32 codePeter Maydell12-745/+6
We dropped the unicore32-linux-user target in commit 5e2b40f7271cf9 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>
2018-03-09aarch64-linux-user: Add support for SVE signal frame recordsRichard Henderson1-19/+193
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>
2018-03-09aarch64-linux-user: Add support for EXTRA signal frame recordsRichard Henderson1-11/+63
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>
2018-03-09aarch64-linux-user: Remove struct target_aux_contextRichard Henderson1-28/+61
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>
2018-03-09aarch64-linux-user: Split out helpers for guest signal handlingRichard Henderson1-50/+68
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>
2018-03-09linux-user: Implement aarch64 PR_SVE_SET/GET_VLRichard Henderson2-0/+30
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>
2018-03-07RISC-V Linux User EmulationMichael Clark12-6/+999
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>
2018-03-02target/arm: Add ARM_FEATURE_V8_FCMARichard Henderson1-0/+1
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>
2018-03-02target/arm: Add ARM_FEATURE_V8_RDMRichard Henderson1-0/+1
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>
2018-03-01linux-user: Report AArch64 FP16 support via hwcap bitsPeter Maydell1-0/+2
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>
2018-02-25linux-user: MIPS set cpu to r6 CPU if binary is R6YunQiang Su2-0/+6
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>