From: Andreas Tobler <toa@pop.agri.ch>
To: Linux -Dev <linuxppc-dev@lists.linuxppc.org>
Subject: ppc assembler help needed
Date: Mon, 15 May 2000 17:54:28 +0200 [thread overview]
Message-ID: <39201DA7.96674A96@pop.agri.ch> (raw)
Hi,
I have some problems understanding the following code snippet. It is
from misc.S in kernel 2.3.
The function call is like this:
void _insl_ns(volatile u32 *port, u32 *buf, int nl)
_GLOBAL(_insl_ns)
cmpw 0,r5,0
mtctr r5
subi r4,r4,4
blelr-
00: lwz r5,0(r3)
eieio
stwu r5,4(r4)
bdnz 00b
blr
Am I right with port = r3, buf = r4, nl = r5?
If so, cmpw 0,r5,0 compares the content of r5, in my case nl, with zero
and stores the result in CR0?
What does blelr- exactly do? 'branch if less than or equal' according to
the 'Programming Environment for 32bit uPs' from Motorola.
Commenting out the cmpw and the blelr- line as in kernel-2.2, then the
function works. The values from nl are in the range from 10 to 20 (int).
So the the blelr- shouldn't happen.
The function in C looks a bit like: (Thanks to Paul)
void _insl_ns(volatile u32 *port, u32 *buf, int nl)
{
if (nl <= 0)
return;
do {
*buf++ = *port;
eieio();
} while (--nl != 0);
}
Thanks for any explanation
Andreas
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
next reply other threads:[~2000-05-15 15:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-15 15:54 Andreas Tobler [this message]
2000-05-15 16:08 ` ppc assembler help needed Franz Sirl
2000-05-15 18:26 ` Andreas Tobler
2000-05-15 18:26 ` David Edelsohn
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=39201DA7.96674A96@pop.agri.ch \
--to=toa@pop.agri.ch \
--cc=linuxppc-dev@lists.linuxppc.org \
/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;
as well as URLs for NNTP newsgroup(s).