• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* libunwind - a platform-independent unwind library
2    Copyright (C) 2008 CodeSourcery
3    Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
4    Copyright (C) 2013 Linaro Limited
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 "unwind_i.h"
28 #include "dwarf_i.h"
29 
30 HIDDEN define_lock (aarch64_lock);
31 HIDDEN atomic_bool tdep_init_done = 0;
32 
33 HIDDEN void
tdep_init(void)34 tdep_init (void)
35 {
36   intrmask_t saved_mask;
37 
38   sigfillset (&unwi_full_mask);
39 
40   lock_acquire (&aarch64_lock, saved_mask);
41   {
42     if (atomic_load(&tdep_init_done))
43       /* another thread else beat us to it... */
44       goto out;
45 
46     mi_init ();
47 
48     dwarf_init ();
49 
50 #ifndef UNW_REMOTE_ONLY
51     tdep_init_mem_validate ();
52 
53     aarch64_local_addr_space_init ();
54 #endif
55     atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
56   }
57  out:
58   lock_release (&aarch64_lock, saved_mask);
59 }
60