/* libunwind - a platform-independent unwind library
- Copyright (C) 2003-2004 Hewlett-Packard Co
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
This file is part of libunwind.
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include <libunwind.h>
-#include <setjmp.h>
+#include <string.h>
#include <stdlib.h>
-#include "jmpbuf.h"
+#include "unwind_i.h"
-int
-sigsetjmp (sigjmp_buf env, int savemask)
+PROTECTED unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
{
- unw_word_t *wp = (unw_word_t *) env;
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
- /* This should work on most platforms, but may not be
- performance-optimal; check the code! */
+ /* AArch64 supports little-endian and big-endian. */
+ if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
- wp[JB_SP] = (unw_word_t) __builtin_frame_address (0);
- wp[JB_RP] = (unw_word_t) __builtin_return_address (0);
- wp[JB_MASK_SAVED] = savemask;
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
- /* Note: we assume here that "wp" has same or better alignment as
- sigset_t. */
- if (savemask
- && sigprocmask (SIG_BLOCK, NULL, (sigset_t *) (wp + JB_MASK)) < 0)
- abort ();
- return 0;
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ /* Default to little-endian for AArch64. */
+ if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
+ as->big_endian = 0;
+ else
+ as->big_endian = 1;
+
+ return as;
+#endif
}