unwind_arm_ehabi_stub.c revision 1.2
11.1Smatt/*-
21.1Smatt * Copyright (c) 2013 The NetBSD Foundation, Inc.
31.1Smatt * All rights reserved.
41.1Smatt *
51.1Smatt * Redistribution and use in source and binary forms, with or without
61.1Smatt * modification, are permitted provided that the following conditions
71.1Smatt * are met:
81.1Smatt * 1. Redistributions of source code must retain the above copyright
91.1Smatt *    notice, this list of conditions and the following disclaimer.
101.1Smatt * 2. Redistributions in binary form must reproduce the above copyright
111.1Smatt *    notice, this list of conditions and the following disclaimer in the
121.1Smatt *    documentation and/or other materials provided with the distribution.
131.1Smatt *
141.1Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
151.1Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
161.1Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
171.1Smatt * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
181.1Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
191.1Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
201.1Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
211.1Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
221.1Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
231.1Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
241.1Smatt * POSSIBILITY OF SUCH DAMAGE.
251.1Smatt */
261.2Sjoerg
271.2Sjoerg#ifndef __ARM_DWARF_EH__
281.1Smatt#include <sys/cdefs.h>
291.1Smatt#include <sys/types.h>
301.1Smatt#include "unwind.h"
311.1Smatt
321.1Smattvoid _Unwind_VRS_Get(struct _Unwind_Context *, int, _Unwind_Word, int, void *);
331.1Smattvoid _Unwind_VRS_Set(struct _Unwind_Context *, int, _Unwind_Word, int, void *);
341.1Smatt
351.1Smatt_Unwind_Word
361.1Smatt_Unwind_GetGR(struct _Unwind_Context *context, int regno)
371.1Smatt{
381.1Smatt	_Unwind_Word val;
391.1Smatt	_Unwind_VRS_Get(context, 0 /*_UVRSC_CORE*/, regno, 0 /*_UVRSD_UINT32*/,
401.1Smatt	    &val);
411.1Smatt
421.1Smatt	return val;
431.1Smatt}
441.1Smatt
451.1Smatt_Unwind_Ptr
461.1Smatt_Unwind_GetIP(struct _Unwind_Context *context)
471.1Smatt{
481.1Smatt	return (_Unwind_Ptr)(_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1);
491.1Smatt}
501.1Smatt
511.1Smatt_Unwind_Ptr
521.1Smatt_Unwind_GetIPInfo(struct _Unwind_Context *context, int *p)
531.1Smatt{
541.1Smatt	*p = 0;
551.1Smatt	return _Unwind_GetIP(context);
561.1Smatt}
571.1Smatt
581.1Smattvoid
591.1Smatt_Unwind_SetGR(struct _Unwind_Context *context, int reg, _Unwind_Ptr val)
601.1Smatt{
611.1Smatt	_Unwind_VRS_Set(context, 0 /*_UVRSC_CORE*/, reg, 0 /*_UVRSD_UINT32*/,
621.1Smatt		&val);
631.1Smatt}
641.2Sjoerg
651.2Sjoerg#endif /* __ARM_DWARF_EH__ */
66