* [parisc-linux] fic problem
@ 2002-12-13 12:27 FARINATI,LEANDRO (HP-Brazil,ex1)
2002-12-13 12:45 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: FARINATI,LEANDRO (HP-Brazil,ex1) @ 2002-12-13 12:27 UTC (permalink / raw)
To: Parisc-Linux List (E-mail)
Hi people,
I have an error with the use of fic asm instruction(see piece code
below).
I'm ask you if you have a tip do help me to solve this problem.
buf = (char *)malloc(4096);
if(!buf)
{
printf("\n malloc error!");
return(1);
}
/* copy instr stream(s) to new page */
start = (unsigned int *)&(label of an asm code);
spot = (unsigned int *)buf;
end = (unsigned int *)&(label of an asm code);
while(start <= end)
{
*spot = *start;
__asm__ __volatile__("fdc (%0)" :: "r" (spot) );
__asm__ __volatile__("sync" ::);
__asm__ __volatile__("fic (%0)" :: "r" (spot) );
(segmentation fault in this line)
__asm__ __volatile__("sync" ::);
spot++;
start++;
}
Thanks in advance,
-----------------------------------------------------------------------
Leandro Marcondes Farinati
Software Developer
* leandro.farinati@hp.com
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [parisc-linux] fic problem
2002-12-13 12:27 [parisc-linux] fic problem FARINATI,LEANDRO (HP-Brazil,ex1)
@ 2002-12-13 12:45 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2002-12-13 12:45 UTC (permalink / raw)
To: FARINATI,LEANDRO (HP-Brazil,ex1); +Cc: Parisc-Linux List (E-mail)
On Fri, Dec 13, 2002 at 04:27:13AM -0800, FARINATI,LEANDRO (HP-Brazil,ex1) wrote:
> __asm__ __volatile__("fdc (%0)" :: "r" (spot) );
> __asm__ __volatile__("sync" ::);
> __asm__ __volatile__("fic (%0)" :: "r" (spot) );
> (segmentation fault in this line)
> __asm__ __volatile__("sync" ::);
don't do it like this. do it this way:
__asm__ __volatile__("\n\
fdc (%0)\n\
sync\n\
fic (%0)\n\
sync\n"
: : "r" (spot)
);
that ensures that these 4 insns really are together. you might want to
look at the generated assembly output for this function (objdump -dr
foo.o |less) and/or recompile the kernel with PRINT_USER_TRAPS turned
on so you get a register dump so you can debug this yourself.
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-12-13 12:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-13 12:27 [parisc-linux] fic problem FARINATI,LEANDRO (HP-Brazil,ex1)
2002-12-13 12:45 ` Matthew Wilcox
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.