Date: Wed, 10 Nov 2004 15:00:27 +0100 From: gerarra@tin.it To: freebsd-hackers@freebsd.org Cc: avg@icyb.net.ua Subject: RE: syscall: td_retval and zero return value Message-ID: <41536AD50005DCD2@ims3a.cp.tin.it> In-Reply-To: <41921229.9080404@icyb.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
>I have very little assembler/x86 knowledge. >Could anyone please help me understand what it means to assign a >non-zero value to td_retval in a system call when return value of the >call is zero/success? > >I see in syscall() in src/sys/i386/i386/trap.c (btw is this the right >place?) that in such circumstances value from td_retval[] is put into >EAX and EDX registers and PSL_C (carry bit) is cleared in status/flags >register in a stack frame of a calling process. But I don't understand >what it practically means for the calling process. > >Thank you in advance. The way the handler advice you about syscalls failing is setting (and not= clearing as you were saying) the carry bit in eflags register (about ia32= ). A sort of errno (if you see in a C-coder view) value is set in eax (or, alternatively, edx) to show the reason of failing. There's no way to know= where error code is set; you can just verify pratically. You can find all these things on "Programmers handbook". cheers, rookie
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41536AD50005DCD2>