Mail Archives: djgpp/1994/03/15/15:04:50
Hello Christopher,
I beleive the solution to your problem might be very easy (I haven't tried
it though).
cnc AT netcom DOT com (Christopher Christensen):
I'm running into a problem with the extended asm feature of DJGPP...
GCC seems to be ignoring the list of clobbered registers for some
reason. The generated code isn't doing anything to preserve registers
like %esi, %edi, and %ebx which need to be preserved.
Here's an example:
--- foo.c ---
void foo()
{
asm(
"movl $0,%%edi
movl $0,%%esi
movl $0,%%ebx"
:: "b" (5), "S" (10) /* list of inputs */
: "%%ebx", "%%esi", "%%edi", "cc" /* list of clobbered registers */
);
}
I similar situations I wrote the list of clobbered registers without the
percent signs: " ... :: ... : "ebx", "esi", "edi" ); ". In my cases
all the three register would be saved. I don't know what "cc" in your list of
clobbered registers means. I also don't understand your list of inputs:
I would write the whole example as
void foo(void)
{
asm("movl $0, %%edi\n"
"movl $0, %%esi\n"
"movl $0, %%ebi\n" ::: "esi", "edi", "ebx");
}
Hope this helps
Dieter
- Raw text -