1b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino/* libunwind - a platform-independent unwind library
2b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
3b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino   Copied from src/x86_64/, modified slightly (or made empty stubs) for
4b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino   building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
5b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
6b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoThis file is part of libunwind.
7b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
8b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoPermission is hereby granted, free of charge, to any person obtaining
9b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinoa copy of this software and associated documentation files (the
10b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino"Software"), to deal in the Software without restriction, including
11b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinowithout limitation the rights to use, copy, modify, merge, publish,
12b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinodistribute, sublicense, and/or sell copies of the Software, and to
13b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinopermit persons to whom the Software is furnished to do so, subject to
14b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinothe following conditions:
15b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
16b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoThe above copyright notice and this permission notice shall be
17b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinoincluded in all copies or substantial portions of the Software.
18b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
19b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
26b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
274499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino#include <libunwind_i.h>
284499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino
294499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino#ifdef UNW_TARGET_PPC64
304499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino#include "../ppc64/init.h"
314499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino#else
324499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino#include "../ppc32/init.h"
334499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino#endif
34b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
35b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino#ifdef UNW_REMOTE_ONLY
36b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
37b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoPROTECTED int
38b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinounw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
39b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino{
40b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino  /* XXX: empty stub.  */
41b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino  return -UNW_EINVAL;
42b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino}
43b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
44b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino#else /* !UNW_REMOTE_ONLY */
45b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
46b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar PaulinoPROTECTED int
47b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulinounw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
48b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino{
49b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino  struct cursor *c = (struct cursor *) cursor;
50b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
515d0f376b08126b51a001d7cdfba1ec4e0d644f54Tommi Rantala  if (!tdep_init_done)
52b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino    tdep_init ();
53b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
54b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino  Debug (1, "(cursor=%p)\n", c);
55b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
56b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino  c->dwarf.as = unw_local_addr_space;
57b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino  c->dwarf.as_arg = uc;
580996405de25a3aab5045d20803c8f0a5441d0c57Christopher Ferris
594499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino  #ifdef UNW_TARGET_PPC64
60a9dce3c06e6ffcb83957e734d960505415118f00Lassi Tuura    return common_init_ppc64 (c, 1);
614499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino  #else
62a9dce3c06e6ffcb83957e734d960505415118f00Lassi Tuura    return common_init_ppc32 (c, 1);
634499bb29a6214b5df5b3b21e03c6b4f3c8f26cfdJose Flavio Aguilar Paulino  #endif
64b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino}
65b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino
66b33021e4b2f3a92141c01eb24b98bc51a97c498dJose Flavio Aguilar Paulino#endif /* !UNW_REMOTE_ONLY */
67