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