Subject: Re: cerror.S ignores error number returned
To: Srinivasa Kanduru <ksraghavan@yahoo.com>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: port-i386
Date: 11/29/2003 12:21:02
Srinivasa Kanduru wrote:
> All the system calls put the errno number in $eax before calling cerror. The
> prologues and epilogues doesn't do anything with it. Now when _errno address is
> returned, the value of errno is to be stored in it. At the entry the value of
> %eax is pushed onto the stack, and when the _errno address is returned, the
> error number is to be stored in the variable, but currently it doesn't seem to
> be doing I think. The pop %ecx will retrieve the err value from the stack and
> the mov will store it in errno I think.

Ah, the patch was backwards ('diff -u new old ' instead of 'diff -u old new').

OK, your:

popl %ecx
movl %ecx, (%eax)

is semantically exactly same as the current

popl (%eax)

and the latter one saves one insn. Since the code is this
way for some three years, it got to be fine ;) Do you have
any actual problem with errno setting after any system call?

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the Buddhist -=-
-=- masters say, ``You may notice during meditation that you        -=-
-=- sometimes levitate or glow.   Do not let this distract you.''   -=-