David 'Digit' Turner | b8e6c50 | 2010-03-25 09:54:33 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 28 | |
| 29 | /* |
| 30 | * machine/setjmp.h: machine dependent setjmp-related information. |
| 31 | */ |
| 32 | |
David 'Digit' Turner | b8e6c50 | 2010-03-25 09:54:33 -0700 | [diff] [blame^] | 33 | /* _JBLEN is the size of a jmp_buf in longs. |
| 34 | * Do not modify this value or you will break the ABI ! |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 35 | * |
David 'Digit' Turner | b8e6c50 | 2010-03-25 09:54:33 -0700 | [diff] [blame^] | 36 | * This value comes from the original OpenBSD ARM-specific header |
| 37 | * that was replaced by this one. |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 38 | */ |
David 'Digit' Turner | b8e6c50 | 2010-03-25 09:54:33 -0700 | [diff] [blame^] | 39 | #define _JBLEN 64 |
| 40 | |
| 41 | /* According to the ARM AAPCS document, we only need to save |
| 42 | * the following registers: |
| 43 | * |
| 44 | * Core r4-r14 |
| 45 | * |
| 46 | * VFP d8-d15 (see section 5.1.2.1) |
| 47 | * |
| 48 | * Registers s16-s31 (d8-d15, q4-q7) must be preserved across subroutine |
| 49 | * calls; registers s0-s15 (d0-d7, q0-q3) do not need to be preserved |
| 50 | * (and can be used for passing arguments or returning results in standard |
| 51 | * procedure-call variants). Registers d16-d31 (q8-q15), if present, do |
| 52 | * not need to be preserved. |
| 53 | * |
| 54 | * FPSCR saved because GLibc does saves it too. |
| 55 | * |
| 56 | */ |
| 57 | |
| 58 | /* The internal structure of a jmp_buf is totally private. |
| 59 | * Current layout (may change in the future): |
| 60 | * |
| 61 | * word name description |
| 62 | * 0 magic magic number |
| 63 | * 1 sigmask signal mask (not used with _setjmp / _longjmp) |
| 64 | * 2 float_base base of float registers (d8 to d15) |
| 65 | * 18 float_state floating-point status and control register |
| 66 | * 19 core_base base of core registers (r4 to r14) |
| 67 | * 30 reserved reserved entries (room to grow) |
| 68 | * 64 |
| 69 | * |
| 70 | * NOTE: float_base must be at an even word index, since the |
| 71 | * FP registers will be loaded/stored with instructions |
| 72 | * that expect 8-byte alignment. |
| 73 | */ |
| 74 | |
| 75 | #define _JB_MAGIC 0 |
| 76 | #define _JB_SIGMASK (_JB_MAGIC+1) |
| 77 | #define _JB_FLOAT_BASE (_JB_SIGMASK+1) |
| 78 | #define _JB_FLOAT_STATE (_JB_FLOAT_BASE + (15-8+1)*2) |
| 79 | #define _JB_CORE_BASE (_JB_FLOAT_STATE+1) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 80 | |
| 81 | #define _JB_MAGIC__SETJMP 0x4278f500 |
| 82 | #define _JB_MAGIC_SETJMP 0x4278f501 |