1254661Semaste/*- 2254661Semaste * Copyright (c) 2013 The NetBSD Foundation, Inc. 3254661Semaste * All rights reserved. 4254661Semaste * 5254661Semaste * Redistribution and use in source and binary forms, with or without 6254661Semaste * modification, are permitted provided that the following conditions 7254661Semaste * are met: 8254661Semaste * 1. Redistributions of source code must retain the above copyright 9254661Semaste * notice, this list of conditions and the following disclaimer. 10254661Semaste * 2. Redistributions in binary form must reproduce the above copyright 11254661Semaste * notice, this list of conditions and the following disclaimer in the 12254661Semaste * documentation and/or other materials provided with the distribution. 13254661Semaste * 14254661Semaste * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 15254661Semaste * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 16254661Semaste * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17254661Semaste * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 18254661Semaste * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19254661Semaste * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20254661Semaste * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21254661Semaste * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22254661Semaste * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23254661Semaste * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24254661Semaste * POSSIBILITY OF SUCH DAMAGE. 25254661Semaste */ 26254661Semaste#include <sys/cdefs.h> 27254661Semaste#include <sys/types.h> 28254661Semaste#include "unwind.h" 29254661Semaste 30254661Semastevoid _Unwind_VRS_Get(struct _Unwind_Context *, int, _Unwind_Word, int, void *); 31254661Semastevoid _Unwind_VRS_Set(struct _Unwind_Context *, int, _Unwind_Word, int, void *); 32254661Semaste 33254661Semaste_Unwind_Word 34254661Semaste_Unwind_GetGR(struct _Unwind_Context *context, int regno) 35254661Semaste{ 36254661Semaste _Unwind_Word val; 37254661Semaste _Unwind_VRS_Get(context, 0 /*_UVRSC_CORE*/, regno, 0 /*_UVRSD_UINT32*/, 38254661Semaste &val); 39254661Semaste 40254661Semaste return val; 41254661Semaste} 42254661Semaste 43254661Semaste_Unwind_Ptr 44254661Semaste_Unwind_GetIP(struct _Unwind_Context *context) 45254661Semaste{ 46254661Semaste return (_Unwind_Ptr)(_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1); 47254661Semaste} 48254661Semaste 49254661Semaste_Unwind_Ptr 50254661Semaste_Unwind_GetIPInfo(struct _Unwind_Context *context, int *p) 51254661Semaste{ 52254661Semaste *p = 0; 53254661Semaste return _Unwind_GetIP(context); 54254661Semaste} 55254661Semaste 56254661Semastevoid 57254661Semaste_Unwind_SetGR(struct _Unwind_Context *context, int reg, _Unwind_Ptr val) 58254661Semaste{ 59254661Semaste _Unwind_VRS_Set(context, 0 /*_UVRSC_CORE*/, reg, 0 /*_UVRSD_UINT32*/, 60254661Semaste &val); 61254661Semaste} 62