MFpowerpc: Work around the problem of returning a 32 bits value from

__syscall() on a 32 bits big-endian arch.

Spotted out by:	grehan
This commit is contained in:
Olivier Houchard 2005-01-19 00:37:03 +00:00
parent bcbfb8bc3d
commit 1f6c8bc54b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140462

View File

@ -927,9 +927,22 @@ syscall(struct thread *td, trapframe_t *frame, u_int32_t insn)
}
switch (error) {
case 0:
#ifdef __ARMEB__
if ((frame->fixreg[0] == SYS___syscall) &&
(code != SYS_lseek)) {
/*
* 64-bit return, 32-bit syscall. Fixup byte order
*/
tf->tf_r0 = 0;
tf->rf_r1 = td->td_retval[0];
} else {
tf->tf_r0 = td->td_retval[0];
tf->tf_r1 = td->td_retval[1];
}
#else
frame->tf_r0 = td->td_retval[0];
frame->tf_r1 = td->td_retval[1];
#endif
frame->tf_spsr &= ~PSR_C_bit; /* carry bit */
break;