Home | History | Annotate | Line # | Download | only in include
      1 /*-
      2  * Copyright (c) 2013 The NetBSD Foundation, Inc.
      3  * All rights reserved.
      4  *
      5  * This code is derived from software contributed to The NetBSD Foundation
      6  * by Matt Thomas of 3am Software Foundry.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  * POSSIBILITY OF SUCH DAMAGE.
     28  */
     29 /* $NetBSD: ehabi.h,v 1.1 2013/08/12 23:22:12 matt Exp $ */
     30 
     31 #ifndef _ARM_EHABI_H_
     32 #define	_ARM_EHABI_H_
     33 
     34 #if defined(_KERNEL) || defined(_STANDALONE)
     35 #include <sys/types.h>
     36 #else
     37 #include <inttypes.h>
     38 #endif
     39 
     40 typedef enum {
     41 	_URC_OK = 0,			/* operation complete */
     42 	_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
     43 	_URC_HANDLER_FOUND = 6,
     44 	_URC_INSTALL_CONTEXT = 7,
     45 	_URC_CONTINUE_UNWIND = 8,
     46 	_URC_FAILURE = 9,		/* unspecified failure */
     47 } _Unwind_Reason_Code;
     48 
     49 typedef enum {
     50 	_UVRSC_CORE = 0,	/* integer register */
     51 	_UVRSC_VFP = 1,		/* vfp */
     52 	_UVRSC_WMMXD = 3,	/* Intel WMMX data register */
     53 	_UVRSC_WMMXC = 4	/* Intel WMMX control register */
     54 } _Unwind_VRS_RegClass;
     55 typedef enum {
     56 	_UVRSD_UINT32 = 0,
     57 	_UVRSD_VFPX = 1,
     58 	_UVRSD_UINT64 = 3,
     59 	_UVRSD_FLOAT = 4,
     60 	_UVRSD_DOUBLE = 5
     61 } _Unwind_VRS_DataRepresentation;
     62 typedef enum {
     63 	_UVRSR_OK = 0,
     64 	_UVRSR_NOT_IMPLEMENTED = 1,
     65 	_UVRSR_FAILED = 2
     66 } _Unwind_VRS_Result;
     67 
     68 typedef uint32_t _Unwind_State;
     69 static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME  = 0;
     70 static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1;
     71 static const _Unwind_State _US_UNWIND_FRAME_RESUME   = 2;
     72 
     73 typedef struct _Unwind_Control_Block _Unwind_Control_Block;
     74 typedef struct _Unwind_Context _Unwind_Context;
     75 typedef uint32_t _Unwind_EHT_Header;
     76 
     77 struct _Unwind_Control_Block {
     78 	char exception_class[8];
     79 	void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
     80 	/* Unwinder cache, private fields for the unwinder's use */
     81 	struct {
     82 		uint32_t reserved1;
     83 		uint32_t reserved2;
     84 		uint32_t reserved3;
     85 		uint32_t reserved4;
     86 		uint32_t reserved5;
     87 		/* init reserved1 to 0, then don't touch */
     88 	} unwinder_cache;
     89 	/* Propagation barrier cache (valid after phase 1): */
     90 	struct {
     91 		uint32_t sp;
     92 		  uint32_t bitpattern[5];
     93 	} barrier_cache;
     94 	/* Cleanup cache (preserved over cleanup): */
     95 	struct {
     96 		uint32_t bitpattern[4];
     97 	} cleanup_cache;
     98 	/* Pr cache (for pr's benefit): */
     99 	struct {
    100 		uint32_t fnstart;		/* function start address */
    101 		_Unwind_EHT_Header *ehtp; /* ptr to EHT entry header word */
    102 		uint32_t additional;		/* additional data */
    103 		uint32_t reserved1;
    104 	} pr_cache;
    105 	uint64_t : 0; /* Force alignment of next item to 8-byte boundary */
    106 };
    107 
    108 __BEGIN_DECLS
    109 
    110 /* Unwinding functions */
    111 void			_Unwind_Resume(_Unwind_Control_Block *);
    112 void			_Unwind_Complete(_Unwind_Control_Block *);
    113 void			_Unwind_DeleteException(_Unwind_Control_Block *);
    114 _Unwind_Reason_Code	_Unwind_RaiseException(_Unwind_Control_Block *);
    115 
    116 _Unwind_VRS_Result	_Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass,
    117 			    uint32_t, _Unwind_VRS_DataRepresentation, void *);
    118 _Unwind_VRS_Result	_Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass,
    119 			    uint32_t, _Unwind_VRS_DataRepresentation, void *);
    120 
    121 _Unwind_VRS_Result	_Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass,
    122 			    uint32_t, _Unwind_VRS_DataRepresentation);
    123 
    124 _Unwind_Reason_Code	__aeabi_unwind_cpp_pr0(_Unwind_State,
    125 			    _Unwind_Control_Block *, _Unwind_Context *);
    126 _Unwind_Reason_Code	__aeabi_unwind_cpp_pr1(_Unwind_State ,
    127 			    _Unwind_Control_Block *, _Unwind_Context *);
    128 _Unwind_Reason_Code	__aeabi_unwind_cpp_pr2(_Unwind_State ,
    129 			    _Unwind_Control_Block *, _Unwind_Context *);
    130 
    131 __END_DECLS
    132 
    133 #endif /* _ARM_EHABI_H_ */
    134