Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 2009 15:51:58 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r199589 - projects/ppc64/sys/powerpc/aim
Message-ID:  <200911201551.nAKFpwv9048635@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911201551.nAKFpwv9048635>