From: Phil F. <da...@xg...> - 2001-09-27 18:31:59
|
There is a general opinion that we should not destroy the registers for the sake of easier development. The convention that has been proposed: on error: CF = 1 and EAX = error code on sucess: any registers that do not have return values are unmodified Also, if EAX is to have an error code on failure it need not be saved in the case of sucess. Also, the registers that have return values need not be saved in the case of sucesses. In other words, any register that does not have a return value in either the case of error or sucess is returned unmodified in both cases. Now of course, this is not a stone policy. For some functions it may not be required to save any of the registers at all, such as functions that are usually called from places where there's nothing in the registers to save. In other words, use your best judgement. In my code, rather than listing every single register and it's value on call and return, I only list the significant registers on call and I use the shorthand "errors as usual" to denote the CF=1 on error, EAX=error code, registers with returned values=unmodified convention, and "registers saved as usual" to denote the convention proposed above. Remember that not all functions return an error; many are so simple they cannot fail (and in this case EAX would be saved, unless it has a return value). So, tell me what you think of this; if it's accepted i'll put it in the Uuu docs somewhere. As for the functions we have now, just change them over next time you have the file open; there is no immediate need to convert everything. |