* e300 (MPC5121) dlmzb
@ 2009-09-25 11:07 Fortini Matteo
2009-09-25 16:34 ` Kumar Gala
0 siblings, 1 reply; 2+ messages in thread
From: Fortini Matteo @ 2009-09-25 11:07 UTC (permalink / raw)
To: linux-ppc list
I was trying to insert an optimized strlen() function using the
following code taken from the ibm site on an MPC5121, but it crashes the
kernel.
Is it because it's an unsupported op, or because I'm missing some needed
steps?
Thank you,
Matteo
_GLOBAL(strlen)
addi r4,0,8 // Load byte count of 8
mtxer r4 // Set byte count for load string
xor r4,r4,r4 // r4 = 0, r4 == accumulator
1:
lswx r5,r3,r4 // load string into r5 & r6
dlmzb. r12,r5,r6 // find NULL byte and record in r7.
add r4,r4,r12 // Update accumulator.
beq 1b // Loop if NULL not found.
addi r3,r4,-1 // Subtract 1 for NULL byte.
blr // Return length
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: e300 (MPC5121) dlmzb
2009-09-25 11:07 e300 (MPC5121) dlmzb Fortini Matteo
@ 2009-09-25 16:34 ` Kumar Gala
0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2009-09-25 16:34 UTC (permalink / raw)
To: Fortini Matteo; +Cc: linux-ppc list
On Sep 25, 2009, at 4:07 AM, Fortini Matteo wrote:
> I was trying to insert an optimized strlen() function using the
> following code taken from the ibm site on an MPC5121, but it crashes
> the kernel.
> Is it because it's an unsupported op, or because I'm missing some
> needed steps?
>
> Thank you,
> Matteo
>
> _GLOBAL(strlen)
> addi r4,0,8 // Load byte count of 8
> mtxer r4 // Set byte count for load string
> xor r4,r4,r4 // r4 = 0, r4 == accumulator
> 1:
> lswx r5,r3,r4 // load string into r5 & r6
> dlmzb. r12,r5,r6 // find NULL byte and record in r7.
> add r4,r4,r12 // Update accumulator.
> beq 1b // Loop if NULL not found.
> addi r3,r4,-1 // Subtract 1 for NULL byte.
> blr // Return length
dlmzb. isn't supported on e300. I believe only 4xx supports it.
- k
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-09-25 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-25 11:07 e300 (MPC5121) dlmzb Fortini Matteo
2009-09-25 16:34 ` Kumar Gala
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).