Ginit_remote.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* libunwind - a platform-independent unwind library
  2. Copyright (C) 2006-2007 IBM
  3. Contributed by
  4. Corey Ashford <cjashfor@us.ibm.com>
  5. Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
  6. This file is part of libunwind.
  7. Permission is hereby granted, free of charge, to any person obtaining
  8. a copy of this software and associated documentation files (the
  9. "Software"), to deal in the Software without restriction, including
  10. without limitation the rights to use, copy, modify, merge, publish,
  11. distribute, sublicense, and/or sell copies of the Software, and to
  12. permit persons to whom the Software is furnished to do so, subject to
  13. the following conditions:
  14. The above copyright notice and this permission notice shall be
  15. included in all copies or substantial portions of the Software.
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  20. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  21. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  23. #include <libunwind_i.h>
  24. #ifdef UNW_TARGET_PPC64
  25. #include "../ppc64/init.h"
  26. #else
  27. #include "../ppc32/init.h"
  28. #endif
  29. PROTECTED int
  30. unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
  31. {
  32. #ifdef UNW_LOCAL_ONLY
  33. return -UNW_EINVAL;
  34. #else /* !UNW_LOCAL_ONLY */
  35. struct cursor *c = (struct cursor *) cursor;
  36. if (tdep_needs_initialization)
  37. tdep_init ();
  38. Debug (1, "(cursor=%p)\n", c);
  39. c->dwarf.as = as;
  40. c->dwarf.as_arg = as_arg;
  41. #ifdef UNW_TARGET_PPC64
  42. return common_init_ppc64 (c, 0);
  43. #elif UNW_TARGET_PPC32
  44. return common_init_ppc32 (c, 0);
  45. #else
  46. #error init_remote :: NO VALID PPC ARCH!
  47. #endif
  48. #endif /* !UNW_LOCAL_ONLY */
  49. }