[klibc] alpha: Fix dual1 system call wrapper

Several get*id() system calls are paired up on alpha, returning one ID
in v0 (usual return register) and another ID in a4.  The "dual1"
system call wrapper is used when we want the second ID from a4.

This system call wrapper had a fatal bug: it moves v0 to a4, but it
needs to do the opposite.

Also, in case of error, it stored the error flag (a3) to errno rather
than the error code (v0).  Rearrange the code so we only change v0
at the bottom of the function, and store the original value of v0 to
errno before that.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
1 file changed