aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3de792a..5521258 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3914,7 +3914,8 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
else {
abi_ulong mmap_start;
- mmap_start = mmap_find_vma(0, shm_info.shm_segsz);
+ /* In order to use the host shmat, we need to honor host SHMLBA. */
+ mmap_start = mmap_find_vma(0, shm_info.shm_segsz, MAX(SHMLBA, shmlba));
if (mmap_start == -1) {
errno = ENOMEM;
@@ -6412,6 +6413,11 @@ static inline abi_long host_to_target_stat64(void *cpu_env,
__put_user(host_st->st_atime, &target_st->target_st_atime);
__put_user(host_st->st_mtime, &target_st->target_st_mtime);
__put_user(host_st->st_ctime, &target_st->target_st_ctime);
+#if _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700
+ __put_user(host_st->st_atim.tv_nsec, &target_st->target_st_atime_nsec);
+ __put_user(host_st->st_mtim.tv_nsec, &target_st->target_st_mtime_nsec);
+ __put_user(host_st->st_ctim.tv_nsec, &target_st->target_st_ctime_nsec);
+#endif
unlock_user_struct(target_st, target_addr, 1);
} else
#endif
@@ -6442,6 +6448,11 @@ static inline abi_long host_to_target_stat64(void *cpu_env,
__put_user(host_st->st_atime, &target_st->target_st_atime);
__put_user(host_st->st_mtime, &target_st->target_st_mtime);
__put_user(host_st->st_ctime, &target_st->target_st_ctime);
+#if _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700
+ __put_user(host_st->st_atim.tv_nsec, &target_st->target_st_atime_nsec);
+ __put_user(host_st->st_mtim.tv_nsec, &target_st->target_st_mtime_nsec);
+ __put_user(host_st->st_ctim.tv_nsec, &target_st->target_st_ctime_nsec);
+#endif
unlock_user_struct(target_st, target_addr, 1);
}
@@ -6790,12 +6801,15 @@ static int is_proc_myself(const char *filename, const char *entry)
return 0;
}
-#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) || \
+ defined(TARGET_SPARC) || defined(TARGET_M68K)
static int is_proc(const char *filename, const char *entry)
{
return strcmp(filename, entry) == 0;
}
+#endif
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
static int open_net_route(void *cpu_env, int fd)
{
FILE *fp;
@@ -6840,6 +6854,22 @@ static int open_net_route(void *cpu_env, int fd)
}
#endif
+#if defined(TARGET_SPARC)
+static int open_cpuinfo(void *cpu_env, int fd)
+{
+ dprintf(fd, "type\t\t: sun4u\n");
+ return 0;
+}
+#endif
+
+#if defined(TARGET_M68K)
+static int open_hardware(void *cpu_env, int fd)
+{
+ dprintf(fd, "Model:\t\tqemu-m68k\n");
+ return 0;
+}
+#endif
+
static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, mode_t mode)
{
struct fake_open {
@@ -6856,6 +6886,12 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
{ "/proc/net/route", open_net_route, is_proc },
#endif
+#if defined(TARGET_SPARC)
+ { "/proc/cpuinfo", open_cpuinfo, is_proc },
+#endif
+#if defined(TARGET_M68K)
+ { "/proc/hardware", open_hardware, is_proc },
+#endif
{ NULL, NULL, NULL }
};
@@ -8870,6 +8906,15 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
__put_user(st.st_atime, &target_st->target_st_atime);
__put_user(st.st_mtime, &target_st->target_st_mtime);
__put_user(st.st_ctime, &target_st->target_st_ctime);
+#if (_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700) && \
+ defined(TARGET_STAT_HAVE_NSEC)
+ __put_user(st.st_atim.tv_nsec,
+ &target_st->target_st_atime_nsec);
+ __put_user(st.st_mtim.tv_nsec,
+ &target_st->target_st_mtime_nsec);
+ __put_user(st.st_ctim.tv_nsec,
+ &target_st->target_st_ctime_nsec);
+#endif
unlock_user_struct(target_st, arg2, 1);
}
}