mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH] MIPS big endian and *stat syscalls return value
Date: Tue, 7 Apr 2015 13:58:21 +0200	[thread overview]
Message-ID: <20150407115821.GA31681@port70.net> (raw)
In-Reply-To: <5523A299.5050209@ndmsystems.com>

* Eugene <e.yudin@ndmsystems.com> [2015-04-07 12:25:45 +0300]:
> 
> The reason of the problem is that the function __stat_fix rewrites register
> $v0, which is not stored in the parent function.
> 

ouch

>  static inline long __syscall2(long n, long a, long b)
>  {
> +	long t;
>  	register long r4 __asm__("$4") = a;
>  	register long r5 __asm__("$5") = b;
>  	register long r7 __asm__("$7");
>  	register long r2 __asm__("$2");
> +
>  	__asm__ __volatile__ (
>  		"addu $2,$0,%2 ; syscall"
>  		: "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
>  		  "r"(r4), "r"(r5)
>  		: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
>  		  "$14", "$15", "$24", "$25", "hi", "lo", "memory");
> +
>  	if (r7) return -r2;
> +	t = r2;
>  	if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
> -	return r2;
> +
> +	return t;
>  }
>  

looks ok to me
(other than the newline changes)

i wonder if __stat_fix could be inlined in a way that the
compiler knows it shouldnt clobber r2.

same for __syscall3 and __syscall4


  reply	other threads:[~2015-04-07 11:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07  9:25 Eugene
2015-04-07 11:58 ` Szabolcs Nagy [this message]
2015-04-07 14:34   ` Rich Felker
2015-04-07 18:18     ` Eugene Yudin
2015-04-07 18:24       ` Rich Felker
2015-04-08  7:37         ` Eugene

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150407115821.GA31681@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).