unwind_arm_ehabi_stub.c revision 1.1
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.1Smatt#include <sys/cdefs.h>
271.1Smatt#include <sys/types.h>
281.1Smatt#include "unwind.h"
291.1Smatt
301.1Smattvoid _Unwind_VRS_Get(struct _Unwind_Context *, int, _Unwind_Word, int, void *);
311.1Smattvoid _Unwind_VRS_Set(struct _Unwind_Context *, int, _Unwind_Word, int, void *);
321.1Smatt
331.1Smatt_Unwind_Word
341.1Smatt_Unwind_GetGR(struct _Unwind_Context *context, int regno)
351.1Smatt{
361.1Smatt	_Unwind_Word val;
371.1Smatt	_Unwind_VRS_Get(context, 0 /*_UVRSC_CORE*/, regno, 0 /*_UVRSD_UINT32*/,
381.1Smatt	    &val);
391.1Smatt
401.1Smatt	return val;
411.1Smatt}
421.1Smatt
431.1Smatt_Unwind_Ptr
441.1Smatt_Unwind_GetIP(struct _Unwind_Context *context)
451.1Smatt{
461.1Smatt	return (_Unwind_Ptr)(_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1);
471.1Smatt}
481.1Smatt
491.1Smatt_Unwind_Ptr
501.1Smatt_Unwind_GetIPInfo(struct _Unwind_Context *context, int *p)
511.1Smatt{
521.1Smatt	*p = 0;
531.1Smatt	return _Unwind_GetIP(context);
541.1Smatt}
551.1Smatt
561.1Smattvoid
571.1Smatt_Unwind_SetGR(struct _Unwind_Context *context, int reg, _Unwind_Ptr val)
581.1Smatt{
591.1Smatt	_Unwind_VRS_Set(context, 0 /*_UVRSC_CORE*/, reg, 0 /*_UVRSD_UINT32*/,
601.1Smatt		&val);
611.1Smatt}
62