Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jan 2013 09:11:18 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245414 - head/sys/arm/arm
Message-ID:  <201301140911.r0E9BIeC013861@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Mon Jan 14 09:11:18 2013
New Revision: 245414
URL: http://svnweb.freebsd.org/changeset/base/245414

Log:
  Update sigcode to use both the current ABI and FreeBSD's version of the
  ARM EABI syscall calling convention.
  
  The current ABI encodes the syscall number in the instruction. This causes
  issues with the thumb mode as it only has 8 bits to encode this value and
  we have too many system calls and by using a register will simplify the
  code to get the syscall number in the kernel.
  
  With the ARM EABI we reuse the Linux calling convention by storing the
  value in r7. Because of this we use both methods to encode the syscall
  number in this function.

Modified:
  head/sys/arm/arm/locore.S

Modified: head/sys/arm/arm/locore.S
==============================================================================
--- head/sys/arm/arm/locore.S	Mon Jan 14 08:39:48 2013	(r245413)
+++ head/sys/arm/arm/locore.S	Mon Jan 14 09:11:18 2013	(r245414)
@@ -484,12 +484,29 @@ ENTRY_NP(abort)
 
 ENTRY_NP(sigcode)
 	mov	r0, sp
+
+	/*
+	 * Call the sigreturn system call.
+	 * 
+	 * We have to load r7 manually rather than using
+	 * "ldr r7, =SYS_sigreturn" to ensure the value of szsigcode is
+	 * correct. Using the alternative places esigcode at the address
+	 * of the data rather than the address one past the data.
+	 */
+
+	ldr	r7, [pc, #12]	/* Load SYS_sigreturn */
 	swi	SYS_sigreturn
 
 	/* Well if that failed we better exit quick ! */
 
+	ldr	r7, [pc, #8]	/* Load SYS_exit */
 	swi	SYS_exit
-	b	. - 8
+
+	/* Branch back to retry SYS_sigreturn */
+	b	. - 16
+
+	.word	SYS_sigreturn
+	.word	SYS_exit
 
 	.align	0
 	.global _C_LABEL(esigcode)



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