1a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock/* libunwind - a platform-independent unwind library
2a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock   Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
3a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
5a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock   Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
6a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
7a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockThis file is part of libunwind.
8a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
9a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockPermission is hereby granted, free of charge, to any person obtaining
10a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbocka copy of this software and associated documentation files (the
11a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock"Software"), to deal in the Software without restriction, including
12a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockwithout limitation the rights to use, copy, modify, merge, publish,
13a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockdistribute, sublicense, and/or sell copies of the Software, and to
14a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockpermit persons to whom the Software is furnished to do so, subject to
15a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockthe following conditions:
16a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
17a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockThe above copyright notice and this permission notice shall be
18a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockincluded in all copies or substantial portions of the Software.
19a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
20a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
27a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
28a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock#include "unwind_i.h"
29a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock#include "init.h"
30a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
31a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock#ifdef UNW_REMOTE_ONLY
32a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
33a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockPROTECTED int
34a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockunw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
35a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock{
36a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock  return -UNW_EINVAL;
37a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock}
38a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
39a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock#else /* !UNW_REMOTE_ONLY */
40a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
41a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockPROTECTED int
42a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockunw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
43a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock{
44a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock  struct cursor *c = (struct cursor *) cursor;
45a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
465d0f376b08126b51a001d7cdfba1ec4e0d644f54Tommi Rantala  if (unlikely (!tdep_init_done))
47a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock    tdep_init ();
48a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
49f576cce7480d6acee537cecfeb5530187e50f785hp.com!davidm  Debug (1, "(cursor=%p)\n", c);
50a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
51a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock  c->dwarf.as = unw_local_addr_space;
52649f1fb3449a65dd0626a709432d8b02a7c56bbcArun Sharma  c->dwarf.as_arg = c;
53649f1fb3449a65dd0626a709432d8b02a7c56bbcArun Sharma  c->uc = uc;
54649f1fb3449a65dd0626a709432d8b02a7c56bbcArun Sharma  c->validate = 0;
550996405de25a3aab5045d20803c8f0a5441d0c57Christopher Ferris
56a9dce3c06e6ffcb83957e734d960505415118f00Lassi Tuura  return common_init (c, 1);
57a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock}
58a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock
59a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock#endif /* !UNW_REMOTE_ONLY */
60