From owner-svn-src-projects@FreeBSD.ORG Wed Nov 12 13:19:41 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B092CA9; Wed, 12 Nov 2014 13:19:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 847F8E69; Wed, 12 Nov 2014 13:19:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sACDJfQW070577; Wed, 12 Nov 2014 13:19:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sACDJfol070575; Wed, 12 Nov 2014 13:19:41 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201411121319.sACDJfol070575@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 12 Nov 2014 13:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r274433 - in projects/arm64: lib/libc/arm64/gen sys/arm64/include X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2014 13:19:41 -0000 Author: andrew Date: Wed Nov 12 13:19:40 2014 New Revision: 274433 URL: https://svnweb.freebsd.org/changeset/base/274433 Log: Start to support _setjmp/_longjmp on arm64 Modified: projects/arm64/lib/libc/arm64/gen/_setjmp.S projects/arm64/sys/arm64/include/setjmp.h Modified: projects/arm64/lib/libc/arm64/gen/_setjmp.S ============================================================================== --- projects/arm64/lib/libc/arm64/gen/_setjmp.S Wed Nov 12 13:19:35 2014 (r274432) +++ projects/arm64/lib/libc/arm64/gen/_setjmp.S Wed Nov 12 13:19:40 2014 (r274433) @@ -25,13 +25,48 @@ * */ - .globl _setjmp -_setjmp: - b _setjmp +#include +__FBSDID("$FreeBSD$"); + +ENTRY(_setjmp) + /* Store the general purpose registers and lr */ + stp x19, x20, [x0], #16 + stp x21, x22, [x0], #16 + stp x23, x24, [x0], #16 + stp x25, x26, [x0], #16 + stp x27, x28, [x0], #16 + stp x29, x29, [x0], #16 + + /* Reserve space for the floating point register */ + add x0, x0, #(8 * 8) + + /* Store the stack pointer */ + mov x8, sp + str x8, [x0] + + /* Return value */ + mov x0, #0 ret +END(_setjmp) + +ENTRY(_longjmp) + /* restore the general purpose registers and lr */ + ldp x19, x20, [x0], #16 + ldp x21, x22, [x0], #16 + ldp x23, x24, [x0], #16 + ldp x25, x26, [x0], #16 + ldp x27, x28, [x0], #16 + ldp x29, x29, [x0], #16 + + /* Reserve space for the floating point register */ + add x0, x0, #(8 * 8) + + /* Store the stack pointer */ + ldr x8, [x0] + mov sp, x8 - .globl _longjmp -_longjmp: - b _longjmp + /* Load the return value */ + mov x0, x1 ret +END(_longjmp) Modified: projects/arm64/sys/arm64/include/setjmp.h ============================================================================== --- projects/arm64/sys/arm64/include/setjmp.h Wed Nov 12 13:19:35 2014 (r274432) +++ projects/arm64/sys/arm64/include/setjmp.h Wed Nov 12 13:19:40 2014 (r274433) @@ -35,8 +35,15 @@ #include -/* TODO: Add the registers */ -#define _JBLEN 1 +/* + * We nned to sore: the sp + lr + 11 gp registers + 8 fp registers, + * i.e. 21 values, this can be rounded up to 32 to give us some space to + * expand into without affecting the ABI. + * XXX: Is this enough spacce for expansion? + * + * The registers to save are: r19 to r29, and v8 to v15. + */ +#define _JBLEN 32 /* * jmp_buf and sigjmp_buf are encapsulated in different structs to force