altivec issue..
altivec issue..
- Subject: altivec issue..
- From: Andrew Gallatin <email@hidden>
- Date: Mon, 4 Dec 2006 15:42:08 -0500 (EST)
I'm using altive asm code to copy 64 bytes of memory to a PCI device
which my driver has mapped in to userspace. Once in a very blue moon,
we'll see 0x7fffdead copied, rather than what we expected.
Grepping around in the kernel sources reveals that the kernel somehow
uses 0x7fffdead to mark altivec registers which it thinks are unused.
Is there some system call or instruction we need to call in order
to inform the kernel we're using altivec registers v0..v3?
The copy routine looks like this:
#define LVX "lvx v"
#define STVX "stvx v"
static inline void
my_copy_64_bytes_with_altivec(void *to, uint64_t *from)
{
__asm__ __volatile__(
" sync\n"
LVX "0, 0, %4\n"
LVX "1, 0, %5\n"
LVX "2, 0, %6\n"
LVX "3, 0, %7\n"
STVX "0, 0, %0\n"
STVX "1, 0, %1\n"
STVX "2, 0, %2\n"
STVX "3, 0, %3\n"
" sync\n"
:
: "b"(to),
"b"(((char*)to)+16),
"b"(((char*)to)+32),
"b"(((char*)to)+48),
"b"(from),
"b"(((char*)from)+16),
"b"(((char*)from)+32),
"b"(((char*)from)+48)
};
}
Thanks,
Drew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden