Serban Constantinescu | e210488 | 2013-09-26 11:37:10 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in |
| 12 | * the documentation and/or other materials provided with the |
| 13 | * distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | /* |
| 30 | * machine/setjmp.h: machine dependent setjmp-related information. |
| 31 | */ |
| 32 | |
| 33 | /* _JBLEN is the size of a jmp_buf in longs(64bit on AArch64) */ |
| 34 | #define _JBLEN 32 |
| 35 | |
| 36 | /* According to AARCH64 PCS document we need to save the following |
| 37 | * registers: |
| 38 | * |
| 39 | * Core x19 - x30, sp (see section 5.1.1) |
| 40 | * VFP d8 - d15 (see section 5.1.2) |
| 41 | * |
| 42 | * NOTE: All the registers saved here will have 64bit vales (except FPSR). |
| 43 | * AAPCS mandates that the higher part of q registers does not need to |
| 44 | * be saveved by the callee. |
| 45 | */ |
| 46 | |
| 47 | /* The structure of jmp_buf for AArch64: |
| 48 | * |
| 49 | * NOTE: _JBLEN is the size of jmp_buf in longs(64bit on AArch64)! The table |
| 50 | * below computes the offsets in words(32bit). |
| 51 | * |
| 52 | * word name description |
| 53 | * 0 magic magic number |
| 54 | * 1 sigmask signal mask (not used with _setjmp / _longjmp) |
| 55 | * 2 core_base base of core registers (x19-x30, sp) |
| 56 | * 28 float_base base of float registers (d8-d15) |
| 57 | * 44 reserved reserved entries (room to grow) |
| 58 | * 64 |
| 59 | * |
| 60 | * |
| 61 | * NOTE: The instructions that load/store core/vfp registers expect 8-byte |
| 62 | * alignment. Contrary to the previous setjmp header for ARM we do not |
| 63 | * need to save status/control registers for VFP (it is not a |
| 64 | * requirement for setjmp). |
| 65 | */ |
| 66 | |
| 67 | #define _JB_MAGIC 0 |
| 68 | #define _JB_SIGMASK (_JB_MAGIC+1) |
| 69 | #define _JB_CORE_BASE (_JB_SIGMASK+1) |
| 70 | #define _JB_FLOAT_BASE (_JB_CORE_BASE + (31-19+1)*2) |
| 71 | |
| 72 | #define _JB_MAGIC__SETJMP 0x53657200 |
| 73 | #define _JB_MAGIC_SETJMP 0x53657201 |