Add /proc/hardware and /proc/cpuinfo,

update SIOCXXX ioctls,
 fix shmat emulation,
 add nanoseconds in stat,
 init field fp_abi on mips
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJc59R0AAoJEPMMOL0/L748px4QAJBgq468iQPge+6L2uwj4bX1
 xfclzs/HwNSZaxMj98HGHw+mMdMCZhcRMjZKBcF3bqMQ8vJEHEcHpZBVqGTxoQG9
 yDmMZzOSMPGOMjfYasKYaOLNXFexFigVI1tp1EHjuS/PEpaR/O3heFtp4ZqwBA/Y
 xIXbMVVod0my0uIBbs947CjPHFdFR7UrOvqQIUv0ptCukUsA1NNco4LxvYSur3Co
 YJgxXct9HIwueubwZKYVCxUI4SfDKuLD2aqkJGolhBSxiHMktzwR3kLdcosU0tnr
 b9ekBT6UdSVJZirLTHQOOAnU4Ph+bDrLZP3K+WaUdMndLIxWfgV6yaP0Fc5Sdmnv
 /NDctRthodYqqYXEUtSZrOAkQzVJsUoh6WHg8DKkNS22Q6Hzp6UkiAiKuKvhI/Hs
 V+5T3Wlkek8M6Zm3Hic7dCz9bATuaMrAb4j/2MI1VKbE1a2OCWruk+v7rAeMhi8d
 DOS94LJMmLHPUYviXoPyveEA60qm8jRIQAN2Yxuw3CLklDNmxY2UHY5bsfhKfkp5
 xTCyJalqUkYIMoj5j6Rtxjfo4SCg4lGyiu5/wKgD5Ry3YLr5NkTLsasutsqbvOt+
 D2JIJWny2JvCXMCkJLqffmlm96xglaPfsonrGlhufonuqw2nYyebddQLFo4rIz5b
 AYxBlo1cb5B77zpGFXC2
 =IEm6
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.1-pull-request' into staging

Add /proc/hardware and /proc/cpuinfo,
update SIOCXXX ioctls,
fix shmat emulation,
add nanoseconds in stat,
init field fp_abi on mips

# gpg: Signature made Fri 24 May 2019 12:24:36 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-4.1-pull-request:
  linux-user: Pass through nanosecond timestamp components for stat syscalls
  linux-user: Align mmap_find_vma to host page size
  linux-user: Fix shmat emulation by honoring host SHMLBA
  linux-user: Sanitize interp_info and, for mips only, init field fp_abi
  linux-user: Add support for SIOC<G|S>IFPFLAGS ioctls for all targets
  linux-user: Add support for SIOCSPGRP ioctl for all targets
  linux-user: Fix support for SIOCATMARK and SIOCGPGRP ioctls for xtensa
  linux-user: add pseudo /proc/hardware for m68k
  linux-user: add pseudo /proc/cpuinfo for sparc

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-05-24 12:47:49 +01:00
commit a7b21f6762
6 changed files with 145 additions and 64 deletions

View file

@ -3,6 +3,7 @@
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/shm.h>
#include "qemu.h"
#include "disas/disas.h"
@ -2010,6 +2011,8 @@ unsigned long init_guest_space(unsigned long host_start,
unsigned long guest_start,
bool fixed)
{
/* In order to use host shmat, we must be able to honor SHMLBA. */
unsigned long align = MAX(SHMLBA, qemu_host_page_size);
unsigned long current_start, aligned_start;
int flags;
@ -2027,7 +2030,7 @@ unsigned long init_guest_space(unsigned long host_start,
}
/* Setup the initial flags and start address. */
current_start = host_start & qemu_host_page_mask;
current_start = host_start & -align;
flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE;
if (fixed) {
flags |= MAP_FIXED;
@ -2063,8 +2066,8 @@ unsigned long init_guest_space(unsigned long host_start,
return (unsigned long)-1;
}
munmap((void *)real_start, host_full_size);
if (real_start & ~qemu_host_page_mask) {
/* The same thing again, but with an extra qemu_host_page_size
if (real_start & (align - 1)) {
/* The same thing again, but with extra
* so that we can shift around alignment.
*/
unsigned long real_size = host_full_size + qemu_host_page_size;
@ -2077,7 +2080,7 @@ unsigned long init_guest_space(unsigned long host_start,
return (unsigned long)-1;
}
munmap((void *)real_start, real_size);
real_start = HOST_PAGE_ALIGN(real_start);
real_start = ROUND_UP(real_start, align);
}
current_start = real_start;
}
@ -2104,7 +2107,7 @@ unsigned long init_guest_space(unsigned long host_start,
}
/* Ensure the address is properly aligned. */
if (real_start & ~qemu_host_page_mask) {
if (real_start & (align - 1)) {
/* Ideally, we adjust like
*
* pages: [ ][ ][ ][ ][ ]
@ -2132,7 +2135,7 @@ unsigned long init_guest_space(unsigned long host_start,
if (real_start == (unsigned long)-1) {
return (unsigned long)-1;
}
aligned_start = HOST_PAGE_ALIGN(real_start);
aligned_start = ROUND_UP(real_start, align);
} else {
aligned_start = real_start;
}
@ -2169,7 +2172,7 @@ unsigned long init_guest_space(unsigned long host_start,
* because of trouble with ARM commpage setup.
*/
munmap((void *)real_start, real_size);
current_start += qemu_host_page_size;
current_start += align;
if (host_start == current_start) {
/* Theoretically possible if host doesn't have any suitably
* aligned areas. Normally the first mmap will fail.
@ -2704,6 +2707,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
char *elf_interpreter = NULL;
char *scratch;
memset(&interp_info, 0, sizeof(interp_info));
#ifdef TARGET_MIPS
interp_info.fp_abi = MIPS_ABI_FP_UNKNOWN;
#endif
info->start_mmap = (abi_ulong)ELF_START_MMAP;
load_elf_image(bprm->filename, bprm->fd, info,