Imported Upstream version 1.1
[platform/upstream/libunwind.git] / src / aarch64 / getcontext.S
1 /* libunwind - a platform-independent unwind library
2    Copyright (C) 2008 Google, Inc
3         Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
4    Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
5
6 This file is part of libunwind.
7
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
15
16 The above copyright notice and this permission notice shall be
17 included in all copies or substantial portions of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
26
27 #include "offsets.h"
28
29 /*  int _Uaarch64_getcontext_trace (unw_tdep_context_t *ucp)
30
31   Saves limited machine context in UCP necessary for fast trace. If fast trace
32   fails, caller will have to get the full context.
33 */
34
35         .global _Uaarch64_getcontext_trace
36         .hidden _Uaarch64_getcontext_trace
37         .type _Uaarch64_getcontext_trace, @function
38 _Uaarch64_getcontext_trace:
39         .cfi_startproc
40
41         /* Save only FP, SP, PC - exclude this call. */
42         str x29, [x0, #(LINUX_UC_MCONTEXT_OFF + LINUX_SC_X29_OFF)]
43         mov x9, sp
44         str x9, [x0, #(LINUX_UC_MCONTEXT_OFF + LINUX_SC_SP_OFF)]
45         str x30, [x0, #(LINUX_UC_MCONTEXT_OFF + LINUX_SC_PC_OFF)]
46
47         ret
48         .cfi_endproc
49         .size _Uaarch64_getcontext_trace, . - _Uaarch64_getcontext_trace
50
51       /* We do not need executable stack.  */
52       .section        .note.GNU-stack,"",@progbits