1521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm/* libunwind - a platform-independent unwind library
266100609bb7fb01811e64318bec3018d0bc9abd5homeip.net!davidm   Copyright (C) 2003-2004 Hewlett-Packard Co
3521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
5521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmThis file is part of libunwind.
6521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
7521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmPermission is hereby granted, free of charge, to any person obtaining
8521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidma copy of this software and associated documentation files (the
9521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm"Software"), to deal in the Software without restriction, including
10521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmwithout limitation the rights to use, copy, modify, merge, publish,
11521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmdistribute, sublicense, and/or sell copies of the Software, and to
12521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmpermit persons to whom the Software is furnished to do so, subject to
13521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmthe following conditions:
14521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
15521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmThe above copyright notice and this permission notice shall be
16521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmincluded in all copies or substantial portions of the Software.
17521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
18521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
25521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
26521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm#include "unwind-internal.h"
27521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
282319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris/* ANDROID support update. */
29521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidmPROTECTED _Unwind_Reason_Code
30521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm_Unwind_ForcedUnwind (struct _Unwind_Exception *exception_object,
31521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm		      _Unwind_Stop_Fn stop, void *stop_parameter)
32521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm{
33521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm  struct _Unwind_Context context;
34521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm  unw_context_t uc;
352319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris  int ret;
362319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris  int destroy_map = 1;
37521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
38521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm  /* We check "stop" here to tell the compiler's inliner that
39521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm     exception_object->private_1 isn't NULL when calling
40521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm     _Unwind_Phase2().  */
41521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm  if (!stop)
42521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm    return _URC_FATAL_PHASE2_ERROR;
43521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
442319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris  unw_map_local_create ();
452319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris
46521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm  if (_Unwind_InitContext (&context, &uc) < 0)
472319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris    ret = _URC_FATAL_PHASE2_ERROR;
482319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris  else
492319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris    {
502319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris      exception_object->private_1 = (unsigned long) stop;
512319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris      exception_object->private_2 = (unsigned long) stop_parameter;
522319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris
532319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris      ret = _Unwind_Phase2 (exception_object, &context, &destroy_map);
542319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris    }
55521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
562319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris  if (destroy_map)
572319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris    unw_map_local_destroy ();
58521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm
592319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris  return ret;
60521e8ae52eb278c022fba51874a227ca0425b5a8hp.com!davidm}
612319e0f1aec9e1f716eff88987b0023c5b2f6c07Christopher Ferris/* End of ANDROID support. */
6266100609bb7fb01811e64318bec3018d0bc9abd5homeip.net!davidm
6366100609bb7fb01811e64318bec3018d0bc9abd5homeip.net!davidm_Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind (struct _Unwind_Exception*,
6466100609bb7fb01811e64318bec3018d0bc9abd5homeip.net!davidm						     _Unwind_Stop_Fn, void *)
6566100609bb7fb01811e64318bec3018d0bc9abd5homeip.net!davidm     ALIAS (_Unwind_ForcedUnwind);
66