svn commit: r199589 - projects/ppc64/sys/powerpc/aim

Nathan Whitehorn nwhitehorn at FreeBSD.org
Fri Nov 20 15:51:59 UTC 2009


Author: nwhitehorn
Date: Fri Nov 20 15:51:58 2009
New Revision: 199589
URL: http://svn.freebsd.org/changeset/base/199589

Log:
  Add support for stack-passed arguments in the freebsd32 compatibility
  layer and add some speculative support for syscalls from 64-bit processes.

Modified:
  projects/ppc64/sys/powerpc/aim/trap.c

Modified: projects/ppc64/sys/powerpc/aim/trap.c
==============================================================================
--- projects/ppc64/sys/powerpc/aim/trap.c	Fri Nov 20 15:51:07 2009	(r199588)
+++ projects/ppc64/sys/powerpc/aim/trap.c	Fri Nov 20 15:51:58 2009	(r199589)
@@ -441,6 +441,15 @@ syscall(struct trapframe *frame)
 	else
 		error = 0;
 
+#ifdef __powerpc64__
+	if (p->p_sysent->sv_flags & SV_ILP32 && narg > n) {
+		/* Expand the size of arguments copied from the stack */
+
+		for (i = narg; i >= n; i--)
+			args[i] = ((uint32_t *)(&args[n]))[i-n];
+	}
+#endif
+
 	CTR5(KTR_SYSC, "syscall: p=%s %s(%x %x %x)", td->td_name,
 	     scall_names[code],
 	     args[0], args[1], args[2]);
@@ -469,7 +478,8 @@ syscall(struct trapframe *frame)
 	}
 	switch (error) {
 	case 0:
-		if (frame->fixreg[0] == SYS___syscall &&
+		if (p->p_sysent->sv_flags & SV_ILP32 &&
+		    frame->fixreg[0] == SYS___syscall &&
 		    code != SYS_freebsd6_lseek && code != SYS_lseek) {
 			/*
 			 * 64-bit return, 32-bit syscall. Fixup byte order


More information about the svn-src-projects mailing list