(root)/
strace-6.5/
src/
linux/
tile/
get_error.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  #include "negated_errno.h"
       9  
      10  static void
      11  arch_get_error(struct tcb *tcp, const bool check_errno)
      12  {
      13  	/*
      14  	 * The standard tile calling convention returns the value
      15  	 * (or negative errno) in r0, and zero (or positive errno) in r1.
      16  	 * Until at least kernel 3.8, however, the r1 value is not
      17  	 * reflected in ptregs at this point, so we use r0 here.
      18  	 */
      19  	if (check_errno && is_negated_errno(tile_regs.regs[0])) {
      20  		tcp->u_rval = -1;
      21  		tcp->u_error = -tile_regs.regs[0];
      22  	} else {
      23  		tcp->u_rval = tile_regs.regs[0];
      24  	}
      25  }