1 1.1 jmcneill /* $NetBSD: setjmp.S,v 1.1.1.1 2018/08/16 18:17:47 jmcneill Exp $ */ 2 1.1 jmcneill 3 1.1 jmcneill /* 4 1.1 jmcneill * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. 5 1.1 jmcneill * This program and the accompanying materials are licensed and made 6 1.1 jmcneill available 7 1.1 jmcneill * under the terms and conditions of the BSD License which accompanies 8 1.1 jmcneill this 9 1.1 jmcneill * distribution. The full text of the license may be found at 10 1.1 jmcneill * http://opensource.org/licenses/bsd-license.php. 11 1.1 jmcneill * 12 1.1 jmcneill * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" 13 1.1 jmcneill BASIS, 14 1.1 jmcneill * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 15 1.1 jmcneill * IMPLIED. 16 1.1 jmcneill */ 17 1.1 jmcneill .text 18 1.1 jmcneill .p2align 3 19 1.1 jmcneill 20 1.1 jmcneill #define GPR_LAYOUT \ 21 1.1 jmcneill REG_PAIR (x19, x20, 0); \ 22 1.1 jmcneill REG_PAIR (x21, x22, 16); \ 23 1.1 jmcneill REG_PAIR (x23, x24, 32); \ 24 1.1 jmcneill REG_PAIR (x25, x26, 48); \ 25 1.1 jmcneill REG_PAIR (x27, x28, 64); \ 26 1.1 jmcneill REG_PAIR (x29, x30, 80); \ 27 1.1 jmcneill REG_ONE (x16, 96) 28 1.1 jmcneill 29 1.1 jmcneill #define FPR_LAYOUT \ 30 1.1 jmcneill REG_PAIR(d8, d9, 112); \ 31 1.1 jmcneill REG_PAIR(d10, d11, 128); \ 32 1.1 jmcneill REG_PAIR(d12, d13, 144); \ 33 1.1 jmcneill REG_PAIR(d14, d15, 160); 34 1.1 jmcneill 35 1.1 jmcneill #define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] 36 1.1 jmcneill #define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] 37 1.1 jmcneill 38 1.1 jmcneill .globl setjmp 39 1.1 jmcneill .type setjmp, @function 40 1.1 jmcneill setjmp: 41 1.1 jmcneill mov x16, sp 42 1.1 jmcneill GPR_LAYOUT 43 1.1 jmcneill FPR_LAYOUT 44 1.1 jmcneill mov w0, #0 45 1.1 jmcneill ret 46 1.1 jmcneill 47 1.1 jmcneill #undef REG_PAIR 48 1.1 jmcneill #undef REG_ONE 49 1.1 jmcneill 50 1.1 jmcneill #define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] 51 1.1 jmcneill #define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] 52 1.1 jmcneill 53 1.1 jmcneill .globl longjmp 54 1.1 jmcneill .type longjmp, @function 55 1.1 jmcneill longjmp: 56 1.1 jmcneill GPR_LAYOUT 57 1.1 jmcneill FPR_LAYOUT 58 1.1 jmcneill mov sp, x16 59 1.1 jmcneill cmp w1, #0 60 1.1 jmcneill mov w0, #1 61 1.1 jmcneill csel w0, w1, w0, ne 62 1.1 jmcneill br x30 63