From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24740 invoked by alias); 11 Mar 2013 20:26:53 -0000 Received: (qmail 24715 invoked by uid 22791); 11 Mar 2013 20:26:51 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,TW_TJ X-Spam-Check-By: sourceware.org Received: from toast.topped-with-meat.com (HELO topped-with-meat.com) (204.197.218.159) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Mar 2013 20:26:34 +0000 Received: by topped-with-meat.com (Postfix, from userid 5281) id 0D72F2C08D; Mon, 11 Mar 2013 13:26:33 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Joseph Myers Cc: libc-ports@sourceware.org Subject: [PATCH roland/arm-setjmp] ARM: Consolidate setjmp details in include/bits/setjmp.h file. Message-Id: <20130311202633.0D72F2C08D@topped-with-meat.com> Date: Mon, 11 Mar 2013 20:26:00 -0000 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=LYSvtFvi c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kVV9zR_inRQA:10 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=mdSYfDV-gVAA:10 a=mDV3o1hIAAAA:8 a=vPENWUBgBPpatYITs70A:9 a=CjuIK1q_8ugA:10 X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00096.txt.bz2 This actually hasn't changed materially from the first posting, but it got no response after a week. This puts some related bits of magic knowledge closer to each other and reduces duplication. It also makes it easy for a new configuration to override the general register set in its own sysdeps/.../include/bits/setjmp.h file, which I'm doing in arm-nacl for r9 avoidance. Tested armv7l-linux-gnueabihf that no object code is changed. OK? Thanks, Roland ports/ChangeLog.arm 2013-03-11 Roland McGrath * sysdeps/arm/bits/setjmp.h: Test [!__ASSEMBLER__] rather than [!_ASM]. * sysdeps/arm/jmpbuf-offsets.h: File removed. * sysdeps/arm/jmpbuf-unwind.h: Don't #include it. * sysdeps/arm/include/bits/setjmp.h: New file. * sysdeps/arm/setjmp.S (_SETJMP_H, _ASM): Macros removed. Use JMP_BUF_REGLIST macro. * sysdeps/arm/__longjmp.S: Likewise. --- a/ports/sysdeps/arm/__longjmp.S +++ b/ports/sysdeps/arm/__longjmp.S @@ -19,8 +19,6 @@ /* ??? Needs more rearrangement for the LDM to handle thumb mode. */ #define NO_THUMB #include -#define _SETJMP_H -#define _ASM #include #include #include @@ -37,7 +35,7 @@ ENTRY (__longjmp) cfi_undefined (r4) CHECK_SP (r4) #endif - ldmia ip!, {v1-v6, sl, fp, sp, lr} + ldmia ip!, JMP_BUF_REGLIST cfi_restore (v1) cfi_restore (v2) cfi_restore (v3) --- a/ports/sysdeps/arm/bits/setjmp.h +++ b/ports/sysdeps/arm/bits/setjmp.h @@ -24,7 +24,7 @@ # error "Never include directly; use instead." #endif -#ifndef _ASM +#ifndef __ASSEMBLER__ /* The exact set of registers saved may depend on the particular core in use, as some coprocessor registers may need to be saved. The C Library ABI requires that the buffer be 8-byte aligned, and --- a/ports/sysdeps/arm/jmpbuf-offsets.h +++ b/ports/sysdeps/arm/include/bits/setjmp.h @@ -1,5 +1,5 @@ -/* Private macros for accessing __jmp_buf contents. ARM EABI version. - Copyright (C) 2007-2013 Free Software Foundation, Inc. +/* Private jmp_buf-related definitions. ARM EABI version. + Copyright (C) 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,4 +16,19 @@ License along with the GNU C Library. If not, see . */ +#ifndef _INCLUDE_BITS_SETJMP_H +#define _INCLUDE_BITS_SETJMP_H 1 + +#ifndef __ASSEMBLER__ +/* Get the public declarations. */ +# include +#endif + +/* Register list for a ldm/stm instruction to load/store + the general registers from a __jmp_buf. */ +#define JMP_BUF_REGLIST {v1-v6, sl, fp, sp, lr} + +/* Index of __jmp_buf where the sp register resides. */ #define __JMP_BUF_SP 8 + +#endif /* include/bits/setjmp.h */ --- a/ports/sysdeps/arm/jmpbuf-unwind.h +++ b/ports/sysdeps/arm/jmpbuf-unwind.h @@ -16,7 +16,6 @@ . */ #include -#include #include #include --- a/ports/sysdeps/arm/setjmp.S +++ b/ports/sysdeps/arm/setjmp.S @@ -19,8 +19,6 @@ /* ??? Needs more rearrangement for the STM to handle thumb mode. */ #define NO_THUMB #include -#define _SETJMP_H -#define _ASM #include #include #include @@ -29,7 +27,7 @@ ENTRY (__sigsetjmp) mov ip, r0 /* Save registers */ - stmia ip!, {v1-v6, sl, fp, sp, lr} + stmia ip!, JMP_BUF_REGLIST #if !defined ARM_ASSUME_NO_IWMMXT || defined __SOFTFP__ # define NEED_HWCAP 1