aboutsummaryrefslogtreecommitdiffstats
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2011-06-28user: Fix -d debug logging for usermode emulationEdgar E. Iglesias1-1/+1
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-06-27Merge remote-tracking branch 'riku/linux-user-for-upstream' into stagingAnthony Liguori7-171/+348
2011-06-26Remove exec-all.h include directivesBlue Swirl1-2/+1
Most exec-all.h include directives are now useless, remove them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-21linux-user: Fix sync_file_range on 32bit mipsRiku Voipio1-0/+5
As noticed while looking at "Bump do_syscall() up to 8 syscall arguments" patch, sync_file_range uses a pad argument on 32bit mips. Deal with it by reading the correct arguments when on mips. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user/signal.c: Remove unused fenabPeter Maydell1-2/+5
Remove fenab as it is only written, never used. Add a FIXME comment about the discrepancy between our behaviour and that of the Linux kernel for this routine. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user/signal.c: Remove only-ever-set variable fpu_save_addrPeter Maydell1-5/+5
Move the access of fpu_save into the commented out skeleton code for restoring FPU registers on SPARC sigreturn, thus silencing a gcc 4.6 "variable set but never used" warning. (This doesn't affect the calculation of 'err' because in fact __get_user() can never fail.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: Bump do_syscall() up to 8 syscall argumentsPeter Maydell3-17/+31
On 32 bit MIPS a few syscalls have 7 arguments, and so to call them via NR_syscall the guest needs to be able to pass 8 arguments to do_syscall(). Raise the number of arguments do_syscall() takes accordingly. This fixes some gcc 4.6 compiler warnings about arg7 and arg8 variables being set and never used. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21flatload: memp was a write-only variableJuan Quintela1-3/+0
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21flatload: end_code was only used in a debug messageJuan Quintela1-3/+2
Just unfold its definition in only use. Signed-off-by: Juan Quintela <quintela@redhat.com> [peter.maydell@linaro.org: fixed typo in the debug code, added parentheses to fix precedence issue] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: syscall should use sanitized arg1Juan Quintela1-2/+2
Looking at the other architectures, we should be using "how" not "arg1". Signed-off-by: Juan Quintela <quintela@redhat.com> [peter.maydell@linaro.org: remove unnecessary initialisation of how] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21syscall: really return ret codeJuan Quintela1-4/+4
We assign ret with the error code, but then return 0 unconditionally. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linuxload: id_change was a write only variableJuan Quintela1-24/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: Define AT_RANDOM to support target stack protection mechanism.Laurent ALFONSI1-1/+20
The dynamic linker from the GNU C library v2.10+ uses the ELF auxiliary vector AT_RANDOM [1] as a pointer to 16 bytes with random values to initialize the stack protection mechanism. Technically the emulated GNU dynamic linker crashes due to a NULL pointer derefencement if it is built with stack protection enabled and if AT_RANDOM is not defined by the QEMU ELF loader. [1] This ELF auxiliary vector was introduced in Linux v2.6.29. This patch can be tested with the code above: #include <elf.h> /* Elf*_auxv_t, AT_RANDOM, */ #include <stdio.h> /* printf(3), */ #include <stdlib.h> /* exit(3), EXIT_*, */ #include <stdint.h> /* uint8_t, */ #include <string.h> /* memcpy(3), */ #if defined(__LP64__) || defined(__ILP64__) || defined(__LLP64__) # define Elf_auxv_t Elf64_auxv_t #else # define Elf_auxv_t Elf32_auxv_t #endif main(int argc, char* argv[], char* envp[]) { Elf_auxv_t *auxv; /* *envp = NULL marks end of envp. */ while (*envp++ != NULL); /* auxv->a_type = AT_NULL marks the end of auxv. */ for (auxv = (Elf_auxv_t *)envp; auxv->a_type != AT_NULL; auxv++) { if (auxv->a_type == AT_RANDOM) { int i; uint8_t rand_bytes[16]; printf("AT_RANDOM is: 0x%x\n", auxv->a_un.a_val); memcpy(rand_bytes, (const uint8_t *)auxv->a_un.a_val, sizeof(rand_bytes)); printf("it points to: "); for (i = 0; i < 16; i++) { printf("0x%02x ", rand_bytes[i]); } printf("\n"); exit(EXIT_SUCCESS); } } exit(EXIT_FAILURE); } Changes introduced in v2 and v3: * Fix typos + thinko (AT_RANDOM is used for stack canary, not for ASLR) * AT_RANDOM points to 16 random bytes stored inside the user stack. * Add a small test program. Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Signed-off-by: Laurent ALFONSI <laurent.alfonsi@st.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: add pselect6 syscall supportMike Frysinger1-19/+130
Some architectures (like Blackfin) only implement pselect6 (and skip select/newselect). So add support for it. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: Fix the computation of the requested heap sizevincent1-8/+29
There were several remaining bugs in the previous implementation of do_brk(): 1. the value of "new_alloc_size" was one page too large when the requested brk was aligned on a host page boundary. 2. no new pages should be (re-)allocated when the requested brk is in the range of the pages that were already allocated previsouly (for the same purpose). Technically these pages are never unmapped in the current implementation. The problem/fix can be reproduced/validated with the test-suite above: #include <unistd.h> /* syscall(2), */ #include <sys/syscall.h> /* SYS_brk, */ #include <stdio.h> /* puts(3), */ #include <stdlib.h> /* exit(3), EXIT_*, */ #include <stdint.h> /* uint*_t, */ #include <sys/mman.h> /* mmap(2), MAP_*, */ #include <string.h> /* memset(3), */ int main() { int exit_status = EXIT_SUCCESS; uint8_t *current_brk = 0; uint8_t *initial_brk; uint8_t *new_brk; uint8_t *old_brk; int failure = 0; int i; void test_brk(int increment, int expected_result) { new_brk = (uint8_t *)syscall(SYS_brk, current_brk + increment); if ((new_brk == current_brk) == expected_result) failure = 1; current_brk = (uint8_t *)syscall(SYS_brk, 0); } void test_result() { if (!failure) puts("OK"); else { puts("failure"); exit_status = EXIT_FAILURE; } } void test_title(const char *title) { failure = 0; printf("%-45s : ", title); fflush(stdout); } test_title("Initialization"); test_brk(0, 1); initial_brk = current_brk; test_result(); test_title("Don't overlap \"brk\" pages"); test_brk(HOST_PAGE_SIZE, 1); test_brk(HOST_PAGE_SIZE, 1); test_result(); /* Preparation for the test "Re-allocated heap is initialized". */ old_brk = current_brk - HOST_PAGE_SIZE; memset(old_brk, 0xFF, HOST_PAGE_SIZE); test_title("Don't allocate the same \"brk\" page twice"); test_brk(-HOST_PAGE_SIZE, 1); test_brk(HOST_PAGE_SIZE, 1); test_result(); test_title("Re-allocated \"brk\" pages are initialized"); for (i = 0; i < HOST_PAGE_SIZE; i++) { if (old_brk[i] != 0) { printf("(index = %d, value = 0x%x) ", i, old_brk[i]); failure = 1; break; } } test_result(); test_title("Don't allocate \"brk\" pages over \"mmap\" pages"); new_brk = mmap(current_brk, HOST_PAGE_SIZE / 2, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); if (new_brk == (void *) -1) puts("unknown"); else { test_brk(HOST_PAGE_SIZE, 0); test_result(); } test_title("All \"brk\" pages are writable (please wait)"); if (munmap(current_brk, HOST_PAGE_SIZE / 2) != 0) puts("unknown"); else { while (current_brk - initial_brk < 2*1024*1024*1024UL) { old_brk = current_brk; test_brk(HOST_PAGE_SIZE, -1); if (old_brk == current_brk) break; for (i = 0; i < HOST_PAGE_SIZE; i++) old_brk[i] = 0xAA; } puts("OK"); } test_title("Maximum size of the heap > 16MB"); failure = (current_brk - initial_brk) < 16*1024*1024; test_result(); exit(exit_status); } Changes introduced in patch v2: * extend the "brk" test-suite embedded within the commit message; * heap contents have to be initialized to zero, this bug was exposed by "tst-calloc.c" from the GNU C library; * don't [try to] allocate a new host page if the new "brk" is equal to the latest allocated host page ("brk_page"); and * print some debug information when DEBUGF_BRK is defined. Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Reviewed-by: Christophe Guillon <christophe.guillon@st.com> Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: Don't use MAP_FIXED in do_brk()Peter Maydell1-9/+20
Since mmap() with MAP_FIXED will map over the top of existing mappings, it's a bad idea to use it to implement brk(), because brk() with a large size is likely to overwrite important things like qemu itself or the host libc. So we drop MAP_FIXED and handle "mapped but at different address" as an error case instead. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: Handle images where lowest vaddr is not page alignedPeter Maydell1-57/+73
Fix a bug in the linux-user ELF loader code where it was not correctly handling images where the lowest vaddr to be loaded was not page aligned. The problem was that the code to probe for a suitable guest base address was changing the 'loaddr' variable (by rounding it to a page boundary), which meant that the load bias would then be incorrectly calculated unless loaddr happened to already be page-aligned. Binaries generated by gcc with the default linker script do start with a loadable segment at a page-aligned vaddr, so were unaffected. This bug was noticed with a binary created by the Google Go toolchain for ARM. We fix the bug by refactoring the "probe for guest base" code out into its own self-contained function. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user: Fix the load of ELF files that have no "useful" symbolCédric VINCENT1-15/+19
This patch fixes a "double free()" due to "realloc(syms, 0)" in the loader when the ELF file has no "useful" symbol, as with the following example (compiled with "sh4-linux-gcc -nostdlib"): .text .align 1 .global _start _start: mov #1, r3 trapa #40 // syscall(__NR_exit) nop The bug appears when the log (option "-d") is enabled. Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Signed-off-by: Yves JANIN <yves.janin@st.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Reviewed-by: Richard Henderson <rth@twiddle.net>
2011-06-20Don't translate pointer when in restore_sigcontextMike McCormack1-2/+2
Fixes crash in i386 when user emulation base address is non-zero. 21797 rt_sigreturn(8,1082124603,1,0,1082126048,1082126248)Exit reason and status: signal 11 Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-15Command line support for altering the log file locationMatthew Fernandez1-17/+26
Add command line support for logging to a location other than /tmp/qemu.log. With logging enabled (command line option -d), the log is written to the hard-coded path /tmp/qemu.log. This patch adds support for writing the log to a different location by passing the -D option. Signed-off-by: Matthew Fernandez <matthew.fernandez@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-10Merge remote branch 'rth/axp-next' into alpha-mergeEdgar E. Iglesias1-33/+17
* rth/axp-next: (26 commits) target-alpha: Implement TLB flush primitives. target-alpha: Use a fixed frequency for the RPCC in system mode. target-alpha: Trap for unassigned and unaligned addresses. target-alpha: Remap PIO space for 43-bit KSEG for EV6. target-alpha: Implement cpu_alpha_handle_mmu_fault for system mode. target-alpha: Implement more CALL_PAL values inline. target-alpha: Disable interrupts properly. target-alpha: All ISA checks to use TB->FLAGS. target-alpha: Swap shadow registers moving to/from PALmode. target-alpha: Implement do_interrupt for system mode. target-alpha: Add IPRs to be used by the emulation PALcode. target-alpha: Use kernel mmu_idx for pal_mode. target-alpha: Add various symbolic constants. target-alpha: Use do_restore_state for arithmetic exceptions. target-alpha: Tidy up arithmetic exceptions. target-alpha: Tidy exception constants. target-alpha: Enable the alpha-softmmu target. target-alpha: Rationalize internal processor registers. target-alpha: Merge HW_REI and HW_RET implementations. target-alpha: Cleanup MMU modes. ...
2011-06-08Fix compilation warning due to missing header for sigaction (followup)Alexandre Raymond1-1/+0
This patch removes all references to signal.h when qemu-common.h is included as they become redundant. Signed-off-by: Alexandre Raymond <cerbere@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-31target-alpha: Tidy exception constants.Richard Henderson1-30/+14
There's no need to attempt to match EXCP_* values with PALcode entry point offsets. Instead, compress all the values to make for more efficient switch statements within QEMU. We will be doing TLB fill within QEMU proper, not within the PALcode, so all of the ITB/DTB miss, double fault, and access exceptions can be compressed to EXCP_MMFAULT. Compress all of the EXCP_CALL_PAL exceptions into one. Use env->error_code to store the specific entry point. Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31target-alpha: Rationalize internal processor registers.Richard Henderson1-3/+3
Delete all the code that tried to emulate the real IPRs of some unnamed CPU. Replace those with just 3 slots that we can use to communicate trap information between the helper functions that signal exceptions and the OS trap handler. Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-23Merge branch 's390-next' of git://repo.or.cz/qemu/agrafAurelien Jarno9-6/+1181
* 's390-next' of git://repo.or.cz/qemu/agraf: s390x: complain when allocating ram fails s390x: fix memory detection for guests > 64GB s390x: change mapping base to allow guests > 2GB s390x: Fix debugging for unknown sigp order codes s390x: build s390x by default s390x: remove compatibility cc field s390x: Adjust GDB stub s390x: translate engine for s390x CPU s390x: Adjust internal kvm code s390x: Implement opcode helpers s390x: helper functions for system emulation s390x: Shift variables in CPUState for memset(0) s390x: keep hint on virtio managing size s390x: make kvm exported functions conditional on kvm s390x: s390x-linux-user support tcg: extend max tcg opcodes when using 64-on-32bit s390x: fix smp support for kvm
2011-05-22Delete unused tb_invalidate_page_rangeBlue Swirl1-20/+2
tb_invalidate_page_range() was intended to be used to invalidate an area of a TB which the guest explicitly flushes from i-cache. However, QEMU detects writes to code areas where TBs have been generated, so his has never been useful. Delete the function, adjust callers. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-05-20s390x: s390x-linux-user supportUlrich Hecht9-6/+1181
This patch adds support for running s390x binaries in the linux-user emulation code. Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-08linux-user: Replace deprecated functionStefan Weil1-1/+1
Function bzero is deprecated, so replace it by function memset. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-08Fix spelling in comments (intruction -> instruction)Stefan Weil1-1/+1
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-08Fix typo in comment (truely -> truly)Stefan Weil1-1/+1
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-08Fix typos in comments (neccessary -> necessary)Stefan Weil1-1/+1
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-08Fix typo in comment (dieing -> dying)Stefan Weil1-1/+1
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-02Don't zero out buffer in sched_getaffinityMike McCormack1-12/+1
The kernel doesn't fill the buffer provided to sched_getaffinity with zero bytes, so neither should QEMU. Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-05-02Fix buffer overrun in sched_getaffinityMike McCormack1-1/+1
Zeroing of the cpu array should start from &cpus[kernel_ret] not &cpus[num_zeros_to_fill]. This fixes a crash in EFL's edje_cc running under qemu-arm. Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-05-02linux-user: Fix compilation for "old" linux versionsStefan Weil1-0/+12
Debian Lenny and other installations with older linux versions failed to compile linux-user because some CLONE_xxx macros are undefined. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-04-26linux-user: untie syscalls from UID16Riku Voipio3-17/+43
Quite a number of uid/gid related syscalls are only defined on systems with USE_UID16 defined. This is apperently based on the idea that these system calls would never be called on non-UID16 systems. Make these syscalls available for all architectures that define them. drop alpha hack to support selected UID16 syscalls. MIPS and PowerPC were also defined as UID16, to get uid/gid syscalls available, drop this error as well. Change QEMU to reflect this. Cc: Ulrich Hecht <uli@suse.de> Cc: Richard Henderson <rth@twiddle.net> Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-04-26linux-user: add s390x to llseek listAlexander Graf1-1/+2
We keep a list of host architectures that do llseek with the same syscall as lseek. S390x is one of them, so let's add it to the list. Original-patch-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-04-26linux-user: add ioctl(SIOCGIWNAME, ...) support.Laurent Vivier3-1/+5
Allow to run properly following program from linux-user: /* cc -o wifi wifi.c */ #include <stdio.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <linux/wireless.h> #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> int main(int argc, char **argv) { int ret; struct ifreq req; struct sockaddr_in *addr; int s; if (argc != 2) { fprintf(stderr, "Need an interface name (like wlan0)\n"); return 1; } s = socket( AF_INET, SOCK_DGRAM, 0 ); if (s < 0) { perror("Cannot open socket"); return 1; } strncpy(req.ifr_name, argv[1], sizeof(req.ifr_name)); ret = ioctl( s, SIOCGIWNAME, &req ); if (ret < 0) { fprintf(stderr, "No wireless extension\n"); return 1; } printf("%s\n", req.ifr_name); printf("%s\n", req.ifr_newname); return 0; } $ ./wifi eth0 No wireless extension $ ./wifi wlan0 wlan0 IEEE 802.11bg Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-04-26linux-user: convert ioctl(SIOCGIFCONF, ...) result.Laurent Vivier2-2/+97
The result needs to be converted as it is stored in an array of struct ifreq and sizeof(struct ifreq) differs according to target and host alignment rules. This patch allows to execute correctly the following program on arm and m68k: #include <stdio.h> #include <sys/ioctl.h> #include <net/if.h> #include <alloca.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> int main(void) { int s, ret; struct ifconf ifc; int i; memset( &ifc, 0, sizeof( struct ifconf ) ); ifc.ifc_len = 8 * sizeof(struct ifreq); ifc.ifc_buf = alloca(ifc.ifc_len); s = socket( AF_INET, SOCK_DGRAM, 0 ); if (s < 0) { perror("Cannot open socket"); return 1; } ret = ioctl( s, SIOCGIFCONF, &ifc ); if (s < 0) { perror("ioctl() failed"); return 1; } for (i = 0; i < ifc.ifc_len / sizeof(struct ifreq) ; i ++) { struct sockaddr_in *s; s = (struct sockaddr_in*)&ifc.ifc_req[i].ifr_addr; printf("%s\n", ifc.ifc_req[i].ifr_name); printf("%s\n", inet_ntoa(s->sin_addr)); } } Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-04-26linux-user: improve tracesLaurent Vivier2-6/+167
Add trace details for getpid(), kill(), _llseek(), rt_sigaction(), rt_sigprocmask(), clone(). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-04-26[v2] linux-user: bigger default stackRiku Voipio1-5/+2
PTHREAD_STACK_MIN (16KB) is somewhat inadequate for a new stack for new QEMU threads. Set new limit to 256K which should be enough, yet doesn't increase memory pressure significantly. Signed-off-by: Riku Voipio <riku.voipio@nokia.com> Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
2011-04-25linux-user/arm/nwfpe: rename REG_PC to ARM_REG_PCPeter Maydell3-6/+6
The REG_PC constant used in the ARM nwfpe code is fine in the kernel but when used in qemu can clash with a definition in the host system include files (in particular on Ubuntu Lucid SPARC, including signal.h will define a REG_PC). Rename the constant to avoid this issue. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-17softfloat: rename float*_eq() into float*_eq_quiet()Aurelien Jarno1-1/+1
float*_eq functions have a different semantics than other comparison functions. Fix that by first renaming float*_quiet() into float*_eq_quiet(). Note that it is purely mechanical, and the behaviour should be unchanged. That said it clearly highlight problems due to this different semantics, they are fixed later in this patch series. Cc: Alexander Graf <agraf@suse.de> Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-12unicore32: necessary modifications for other files to support unicore32Guan Xuetao4-5/+173
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-04-12unicore32: add necessry headers in linux-user/unicore32 for unicore32 supportGuan Xuetao4-0/+454
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-04-11microblaze: Correct ec mask in debug printEdgar E. Iglesias1-1/+1
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-03-22linux-user: Fix unlock_user() call in return from poll()Peter Maydell1-3/+1
Correct the broken attempt to calculate the third argument to unlock_user() in the code path which unlocked the pollfd array on return from poll() and ppoll() emulation. (This only caused a problem if unlock_user() wasn't a no-op, eg if DEBUG_REMAP is defined.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-06linux-user: Fix large seeks by 32 bit guest on 64 bit hostPeter Maydell1-6/+10
When emulating a 32 bit Linux user-mode program on a 64 bit target we implement the llseek syscall in terms of lseek. Correct a bug which meant we were silently casting the result of host lseek() to a 32 bit integer as it passed through get_errno() and thus throwing away the top half. We also don't try to store the result back to userspace unless the seek succeeded; this matches the kernel behaviour. Thanks to Eoghan Sherry for identifying the problem and suggesting a solution. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-03linux-user: fix compile failure if !CONFIG_USE_GUEST_BASEPeter Maydell1-0/+4
If CONFIG_USE_GUEST_BASE is not defined, gcc complains: linux-user/mmap.c:235: error: comparison of unsigned expression >= 0 is always true because RESERVED_VA is #defined to 0. Since mmap_find_vma_reserved() will never be called anyway if RESERVED_VA is always 0, fix this by simply #ifdef'ing away the function and its callsite. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-17linux-user: correct core dump formatLaurent Vivier1-16/+18
This patch allows to really use the core dumped by qemu with guest architecture tools. - it adds a missing bswap_phdr() for the program headers of memory regions. "objdump -x" sample: BEFORE: 0x1000000 off 0x00200000 vaddr 0x00000400 paddr 0x00000000 align 2**21 filesz 0x00000000 memsz 0x00100000 flags --- 0x1000000 off 0x00200000 vaddr 0x00100400 paddr 0x00000000 align 2**21 filesz 0x00000000 memsz 0x00080000 flags --- 6000000 AFTER: LOAD off 0x00002000 vaddr 0x00040000 paddr 0x00000000 align 2**13 filesz 0x00000000 memsz 0x00001000 flags --- LOAD off 0x00002000 vaddr 0x00041000 paddr 0x00000000 align 2**13 filesz 0x00000000 memsz 0x00000800 flags rw- - it doesn't pad the note size to sizeof(int32_t). On m68k the NT_PRSTATUS note size is 154 and must not be rounded up to 156, because this value is checked by objdump and gdb. "gdb" symptoms: "warning: Couldn't find general-purpose registers in core file." "objdump -x" sample: BEFORE: Sections: Idx Name Size VMA LMA File off Algn 0 note0 000001c4 00000000 00000000 000003b4 2**0 CONTENTS, READONLY 1 .auxv 00000070 00000000 00000000 00000508 2**2 CONTENTS 2 proc1 00100000 00000400 00000000 00200000 2**10 READONLY AFTER: Sections: Idx Name Size VMA LMA File off Algn 0 note0 000001c4 00000000 00000000 000003b4 2**0 CONTENTS, READONLY 1 .reg/19022 00000050 00000000 00000000 0000040e 2**2 CONTENTS 2 .reg 00000050 00000000 00000000 0000040e 2**2 CONTENTS 3 .auxv 00000070 00000000 00000000 00000508 2**2 CONTENTS 4 load1 00000000 00040000 00000000 00002000 2**13 ALLOC, READONLY Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>