From: Ralf Baechle <ralf@oss.sgi.com>
To: tommy.christensen@eicon.com
Cc: linux-mips@oss.sgi.com, linux-mips@fnet.fr
Subject: Re: Register allocation in copy_to_user
Date: Wed, 26 Sep 2001 00:11:36 +0200 [thread overview]
Message-ID: <20010926001136.A5828@dea.linux-mips.net> (raw)
In-Reply-To: <3BB0D217.80E313F5@eicon.com>; from tommy.christensen@eicon.com on Tue, Sep 25, 2001 at 08:51:03PM +0200
On Tue, Sep 25, 2001 at 08:51:03PM +0200, tommy.christensen@eicon.com wrote:
> For some time, I have seen occasional corruption of tty-output (pty's and
> serial). This turned out to be caused by a register collision in read_chan
> ()
> in n_tty.c. In the expansion of copy_to_user, the compiler chose register
> "a0" to hold the value of local variable __cu_from. Since this register is
> modified in the asm statement, before __cu_from is used, the corruption
> occured.
>
> I am not sure, whether this is a compiler-bug (egcs-2.91.66) or the code
> should prevent this from happening. Have the semantics about side-effects
> of asm statements changed?
>
> Anyway, the attached patch solves this by explicitly building the arguments
> to __copy_user in the argument registers ;-) instead of moving them around.
> So it actually saves some instructions as well. And the compiler can
> generate better code since it now has more registers for temporary
> variables ...
>
> Is this OK? It works just fine for me with a 2.4.9 kernel (VR5000).
Unfortunately I had to find that your bugreport is correct. To make
things worse at the time when I implemented this code I used your approach
(which definately is the cleaner approach) and I ran into the same problem.
Ralf
next prev parent reply other threads:[~2001-09-25 22:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-25 18:51 Register allocation in copy_to_user tommy.christensen
2001-09-25 22:11 ` Ralf Baechle [this message]
2001-10-04 15:11 ` tommy.christensen
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=20010926001136.A5828@dea.linux-mips.net \
--to=ralf@oss.sgi.com \
--cc=linux-mips@fnet.fr \
--cc=linux-mips@oss.sgi.com \
--cc=tommy.christensen@eicon.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox