unwind_arm_ehabi_stub.c revision 256281
155714Skris/*-
255714Skris * Copyright (c) 2013 The NetBSD Foundation, Inc.
355714Skris * All rights reserved.
455714Skris *
555714Skris * Redistribution and use in source and binary forms, with or without
655714Skris * modification, are permitted provided that the following conditions
755714Skris * are met:
855714Skris * 1. Redistributions of source code must retain the above copyright
955714Skris *    notice, this list of conditions and the following disclaimer.
1055714Skris * 2. Redistributions in binary form must reproduce the above copyright
1155714Skris *    notice, this list of conditions and the following disclaimer in the
1255714Skris *    documentation and/or other materials provided with the distribution.
1355714Skris *
1455714Skris * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1555714Skris * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1655714Skris * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1755714Skris * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1855714Skris * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1955714Skris * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2055714Skris * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2155714Skris * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2255714Skris * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23109998Smarkm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24109998Smarkm * POSSIBILITY OF SUCH DAMAGE.
25109998Smarkm */
26142425Snectar#include <sys/cdefs.h>
27109998Smarkm#include <sys/types.h>
28109998Smarkm#include "unwind.h"
29109998Smarkm
30109998Smarkmvoid _Unwind_VRS_Get(struct _Unwind_Context *, int, _Unwind_Word, int, void *);
31109998Smarkmvoid _Unwind_VRS_Set(struct _Unwind_Context *, int, _Unwind_Word, int, void *);
32238405Sjkim
33109998Smarkm_Unwind_Word
34109998Smarkm_Unwind_GetGR(struct _Unwind_Context *context, int regno)
35109998Smarkm{
36109998Smarkm	_Unwind_Word val;
37109998Smarkm	_Unwind_VRS_Get(context, 0 /*_UVRSC_CORE*/, regno, 0 /*_UVRSD_UINT32*/,
38109998Smarkm	    &val);
39109998Smarkm
40109998Smarkm	return val;
41109998Smarkm}
42109998Smarkm
43109998Smarkm_Unwind_Ptr
44109998Smarkm_Unwind_GetIP(struct _Unwind_Context *context)
45109998Smarkm{
46109998Smarkm	return (_Unwind_Ptr)(_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1);
47109998Smarkm}
48109998Smarkm
4955714Skris_Unwind_Ptr
5055714Skris_Unwind_GetIPInfo(struct _Unwind_Context *context, int *p)
51205128Ssimon{
52205128Ssimon	*p = 0;
53205128Ssimon	return _Unwind_GetIP(context);
54205128Ssimon}
5555714Skris
5659191Skrisvoid
5755714Skris_Unwind_SetGR(struct _Unwind_Context *context, int reg, _Unwind_Ptr val)
5855714Skris{
5955714Skris	_Unwind_VRS_Set(context, 0 /*_UVRSC_CORE*/, reg, 0 /*_UVRSD_UINT32*/,
6055714Skris		&val);
6155714Skris}
6255714Skris