On 4/10/07, Adam Zhang <[EMAIL PROTECTED]> wrote:
i just write an independent write function in assembly language to write
a string to stderr.
But the code doesn't work on Solaris. Below is the code:
void write_stderr ( char * buf, int n )
{
int block[2];
block[0] = (int) buf;
block[1] = n;
__asm__ volatile (
"pushl %%ebx\n"
"movl %0, %%ebx\n"
"pushl %%ebx\n"
"movl 0(%%ebx), %%ecx\n"
"movl 4(%%ebx), %%edx\n"
"movl $4, %%eax\n"
"movl $2, %%ebx\n"
"int $0x91\n"
I imagine this is your problem. Is your kernel 32 or 64-bit? IIRC
system calls are handled differently in each case, and I don't think
either use int 0x91 anyway. I also have to ask... why can't you use
syscall()?
"popl %%ebx\n"
"movl %%eax, 0(%%ebx)\n"
"popl %%ebx\n"
: /*wr*/
: /*rd*/ "g" (block)
: /*trash*/ "eax", "edi", "ecx", "edx", "memory", "cc"
);
}
Does anyone know where i am wrong?
Thank you!
Regards,
adam
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
--
Paul Durrant
http://www.linkedin.com/in/pdurrant
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code