Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160…
Browse files Browse the repository at this point in the history
…111' into staging

January 2016 Linux-user queque

# gpg: Signature made Mon 11 Jan 2016 14:13:57 GMT using RSA key ID DE3C9BC0
# gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>"
# gpg:                 aka "Riku Voipio <riku.voipio@linaro.org>"

* remotes/riku/tags/pull-linux-user-20160111:
  linux-user/mmap.c: Use end instead of real_end in target_mmap
  linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.
  linux-user: Update m68k syscall definitions to match Linux 4.4.
  linux-user/syscall.c: Use SOL_SOCKET instead of level for setsockopt()
  linux-user: enable sigaltstack for all architectures
  unicore32: convert get_sp_from_cpustate from macro to inline
  linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag()
  linux-user,sh4: fix signal retcode address
  linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr
  linux-user: manage bind with a socket of SOCK_PACKET type.
  linux-user: add a function hook to translate sockaddr
  linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly
  linux-user: SOCK_PACKET uses network endian to encode protocol in socket()
  linux-user/syscall.c: malloc()/calloc() to g_malloc()/g_try_malloc()/g_new0()
  linux-user: in poll(), if nfds is 0, pfd can be NULL
  linux-user: correctly align target_epoll_event
  linux-user: add signalfd/signalfd4 syscalls

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Jan 11, 2016
2 parents 692a551 + 530c003 commit ac0d9db
Show file tree
Hide file tree
Showing 5 changed files with 310 additions and 51 deletions.
27 changes: 27 additions & 0 deletions linux-user/m68k/syscall_nr.h
Expand Up @@ -349,3 +349,30 @@
#define TARGET_NR_process_vm_writev 346
#define TARGET_NR_kcmp 347
#define TARGET_NR_finit_module 348
#define TARGET_NR_sched_setattr 349
#define TARGET_NR_sched_getattr 350
#define TARGET_NR_renameat2 351
#define TARGET_NR_getrandom 352
#define TARGET_NR_memfd_create 353
#define TARGET_NR_bpf 354
#define TARGET_NR_execveat 355
#define TARGET_NR_socket 356
#define TARGET_NR_socketpair 357
#define TARGET_NR_bind 358
#define TARGET_NR_connect 359
#define TARGET_NR_listen 360
#define TARGET_NR_accept4 361
#define TARGET_NR_getsockopt 362
#define TARGET_NR_setsockopt 363
#define TARGET_NR_getsockname 364
#define TARGET_NR_getpeername 365
#define TARGET_NR_sendto 366
#define TARGET_NR_sendmsg 367
#define TARGET_NR_recvfrom 368
#define TARGET_NR_recvmsg 369
#define TARGET_NR_shutdown 370
#define TARGET_NR_recvmmsg 371
#define TARGET_NR_sendmmsg 372
#define TARGET_NR_userfaultfd 373
#define TARGET_NR_membarrier 374
#define TARGET_NR_mlock2 375
6 changes: 4 additions & 2 deletions linux-user/mmap.c
Expand Up @@ -186,10 +186,12 @@ static int mmap_frag(abi_ulong real_start,
if (prot_new != (prot1 | PROT_WRITE))
mprotect(host_start, qemu_host_page_size, prot_new);
} else {
/* just update the protection */
if (prot_new != prot1) {
mprotect(host_start, qemu_host_page_size, prot_new);
}
if (prot_new & PROT_WRITE) {
memset(g2h(start), 0, end - start);
}
}
return 0;
}
Expand Down Expand Up @@ -536,7 +538,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
/* handle the end of the mapping */
if (end < real_end) {
ret = mmap_frag(real_end - qemu_host_page_size,
real_end - qemu_host_page_size, real_end,
real_end - qemu_host_page_size, end,
prot, flags, fd,
offset + real_end - qemu_host_page_size - start);
if (ret == -1)
Expand Down
16 changes: 6 additions & 10 deletions linux-user/signal.c
Expand Up @@ -3210,7 +3210,6 @@ static void setup_frame(int sig, struct target_sigaction *ka,
struct target_sigframe *frame;
abi_ulong frame_addr;
int i;
int err = 0;

frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
trace_user_setup_frame(regs, frame_addr);
Expand All @@ -3229,15 +3228,14 @@ static void setup_frame(int sig, struct target_sigaction *ka,
regs->pr = (unsigned long) ka->sa_restorer;
} else {
/* Generate return code (system call to sigreturn) */
abi_ulong retcode_addr = frame_addr +
offsetof(struct target_sigframe, retcode);
__put_user(MOVW(2), &frame->retcode[0]);
__put_user(TRAP_NOARG, &frame->retcode[1]);
__put_user((TARGET_NR_sigreturn), &frame->retcode[2]);
regs->pr = (unsigned long) frame->retcode;
regs->pr = (unsigned long) retcode_addr;
}

if (err)
goto give_sigsegv;

/* Set up registers for signal handler */
regs->gregs[15] = frame_addr;
regs->gregs[4] = sig; /* Arg for signal handler */
Expand All @@ -3260,7 +3258,6 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
struct target_rt_sigframe *frame;
abi_ulong frame_addr;
int i;
int err = 0;

frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
trace_user_setup_rt_frame(regs, frame_addr);
Expand Down Expand Up @@ -3290,15 +3287,14 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
regs->pr = (unsigned long) ka->sa_restorer;
} else {
/* Generate return code (system call to sigreturn) */
abi_ulong retcode_addr = frame_addr +
offsetof(struct target_rt_sigframe, retcode);
__put_user(MOVW(2), &frame->retcode[0]);
__put_user(TRAP_NOARG, &frame->retcode[1]);
__put_user((TARGET_NR_rt_sigreturn), &frame->retcode[2]);
regs->pr = (unsigned long) frame->retcode;
regs->pr = (unsigned long) retcode_addr;
}

if (err)
goto give_sigsegv;

/* Set up registers for signal handler */
regs->gregs[15] = frame_addr;
regs->gregs[4] = sig; /* Arg for signal handler */
Expand Down

0 comments on commit ac0d9db

Please sign in to comment.