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
6This file is part of libunwind.
7
8Permission is hereby granted, free of charge, to any person obtaining
9a copy of this software and associated documentation files (the
10"Software"), to deal in the Software without restriction, including
11without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense, and/or sell copies of the Software, and to
13permit persons to whom the Software is furnished to do so, subject to
14the following conditions:
15
16The above copyright notice and this permission notice shall be
17included in all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
26
27#include "unwind_i.h"
28#include "dwarf_i.h"
29
30HIDDEN define_lock (aarch64_lock);
31HIDDEN int tdep_init_done;
32
33HIDDEN void
34tdep_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 (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    aarch64_local_addr_space_init ();
52#endif
53    tdep_init_done = 1;	/* signal that we're initialized... */
54  }
55 out:
56  lock_release (&aarch64_lock, saved_mask);
57}
58