(root)/
strace-6.5/
src/
linux/
powerpc/
get_syscall_args.c
       1  /*
       2   * Copyright (c) 2015-2021 The strace developers.
       3   * All rights reserved.
       4   *
       5   * SPDX-License-Identifier: LGPL-2.1-or-later
       6   */
       7  
       8  /* Return -1 on error or 1 on success (never 0!). */
       9  static int
      10  arch_get_syscall_args(struct tcb *tcp)
      11  {
      12  	if (current_personality != 0) {
      13  		/*
      14  		 * Zero-extend from 32 bits.
      15  		 * Use truncate_klong_to_current_wordsize(tcp->u_arg[N])
      16  		 * in syscall handlers
      17  		 * if you need to use *sign-extended* parameter.
      18  		 */
      19  		tcp->u_arg[0] = (uint32_t) ppc_regs.orig_gpr3;
      20  		tcp->u_arg[1] = (uint32_t) ppc_regs.gpr[4];
      21  		tcp->u_arg[2] = (uint32_t) ppc_regs.gpr[5];
      22  		tcp->u_arg[3] = (uint32_t) ppc_regs.gpr[6];
      23  		tcp->u_arg[4] = (uint32_t) ppc_regs.gpr[7];
      24  		tcp->u_arg[5] = (uint32_t) ppc_regs.gpr[8];
      25  	} else {
      26  		tcp->u_arg[0] = ppc_regs.orig_gpr3;
      27  		tcp->u_arg[1] = ppc_regs.gpr[4];
      28  		tcp->u_arg[2] = ppc_regs.gpr[5];
      29  		tcp->u_arg[3] = ppc_regs.gpr[6];
      30  		tcp->u_arg[4] = ppc_regs.gpr[7];
      31  		tcp->u_arg[5] = ppc_regs.gpr[8];
      32  	}
      33  	return 1;
      34  }