1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/compsupp/aehabi/unwind_env.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,264 @@
1.4 +/* unwind_env.h
1.5 + *
1.6 + * Copyright 2003 ARM Limited.
1.7 + */
1.8 +/*
1.9 + Licence
1.10 +
1.11 + 1. Subject to the provisions of clause 2, ARM hereby grants to LICENSEE a
1.12 + perpetual, non-exclusive, nontransferable, royalty free, worldwide licence
1.13 + to use this Example Implementation of Exception Handling solely for the
1.14 + purpose of developing, having developed, manufacturing, having
1.15 + manufactured, offering to sell, selling, supplying or otherwise
1.16 + distributing products which comply with the Exception Handling ABI for the
1.17 + ARM Architecture specification. All other rights are reserved to ARM or its
1.18 + licensors.
1.19 +
1.20 + 2. THIS EXAMPLE IMPLEMENTATION OF EXCEPTION HANDLING IS PROVIDED "AS IS"
1.21 + WITH NO WARRANTIES EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED
1.22 + TO ANY WARRANTY OF SATISFACTORY QUALITY, MERCHANTABILITY, NONINFRINGEMENT
1.23 + OR FITNESS FOR A PARTICULAR PURPOSE.
1.24 +*/
1.25 +/*
1.26 + * RCS $Revision: 1.3 $
1.27 + * Checkin $Date: 2003/10/23 13:57:32 $
1.28 + * Revising $Author: agrant $
1.29 + */
1.30 +
1.31 +/* Environment definition - abstractions and requirements - to aid
1.32 + * portability of the ARM exceptions code.
1.33 + */
1.34 +
1.35 +#ifndef UNWINDENV_H
1.36 +#define UNWINDENV_H
1.37 +
1.38 +/* ---------------------------------------------------------------------- */
1.39 +
1.40 +/* Source language
1.41 + *
1.42 + * The compiler is expected to define preprocessor symbols as follows:
1.43 + * __cplusplus when compiling in C++ mode.
1.44 + * __thumb when compiling to Thumb code.
1.45 + *
1.46 + * Some use is made of embedded assembly language, introduced by __asm.
1.47 + * This is described in ARM's toolchain documentation. Some edits may be
1.48 + * required for other compilers. The compiler should define one or more of:
1.49 + * __TARGET_ARCH_4T __TARGET_ARCH_4TXM __TARGET_ARCH_5T __TARGET_ARCH_5TXM
1.50 + * __TARGET_ARCH_5TE __TARGET_ARCH_6
1.51 + * so the correct assembly wrappers are generated for certain functions.
1.52 + *
1.53 + * __APCS_INTERWORK should be defined if ARM/Thumb interworking is required.
1.54 + *
1.55 + * For all the above symbols, if your compiler does not provide appropriate
1.56 + * definitions, add them here.
1.57 + *
1.58 + * Some source language extensions are also used.
1.59 + */
1.60 +
1.61 +/* ---------------------------------------------------------------------- */
1.62 +
1.63 +/* Library structure
1.64 + *
1.65 + * ARM's private make system contains an automated facility for compiling
1.66 + * source files multiple times to create multiple object files. The source
1.67 + * regions intended to constitute object file xxx.o are delimited by
1.68 + * #ifdef xxx_c / #endif directives. The exact preprocessor symbols used
1.69 + * for this conditionalisation are described in a comment at the start of
1.70 + * each file. When porting to a different system, compilations must be
1.71 + * performed with these preprocessor symbols appropriately defined
1.72 + * (or remove the conditionalisation).
1.73 + *
1.74 + * ARM declares (or redeclares) some routines as weak in order that
1.75 + * references to them are weak, so that the static linker will not load
1.76 + * unwanted code. This is achieved by decorating routine declarations
1.77 + * with appropriate language extensions. Note that compilers supporting
1.78 + * similar features but via a different syntax may require edits to
1.79 + * the library source.
1.80 + *
1.81 + * Define those decorations here (define as empty if not required):
1.82 + */
1.83 +
1.84 +#define WEAKDECL __weak /* token in C and C++ */
1.85 +#define WEAKASMDECL [WEAK] /* token in assembler */
1.86 +
1.87 +/* ---------------------------------------------------------------------- */
1.88 +
1.89 +/* Source language support and language extensions */
1.90 +
1.91 +/* It is possible to compile the C++ semantics code using a compiler
1.92 + * which does not support C++ exceptions; this was useful to ARM whilst
1.93 + * ARM's compiler was being developed, and the facility has not been
1.94 + * removed. C++ exceptions syntax is conditionalised by
1.95 + * #ifdef ARM_EXCEPTIONS_ENABLED / #endif. Define ARM_EXCEPTIONS_ENABLED
1.96 + * by some means here if you want a usable library:
1.97 + */
1.98 +
1.99 +#ifdef __cplusplus
1.100 +extern "C" {
1.101 + /* For conditionalisation, specifically on ARM_EXCEPTIONS_ENABLED */
1.102 +#include "basics.h"
1.103 +}
1.104 +#endif
1.105 +
1.106 +/* The following definitions of syntax decoration may be empty if the
1.107 + * facility is not required. Note that compilers supporting similar
1.108 + * features but via a different syntax may require edits to the library
1.109 + * source.
1.110 + *
1.111 + * Define the decorations here (define as empty if not required):
1.112 + */
1.113 +
1.114 +/* If the compiler understands noreturn functions: */
1.115 +#define NORETURNDECL __declspec(noreturn)
1.116 +
1.117 +/* ---------------------------------------------------------------------- */
1.118 +
1.119 +/* Types */
1.120 +
1.121 +/* The implementation requires types uint8_t, uint16_t, uint32_t and
1.122 + * uint64_t to be defined as unsigned integers of the appropriate number
1.123 + * of bits.
1.124 + *
1.125 + * Do that here:
1.126 + */
1.127 +
1.128 +#include <stdint.h>
1.129 +
1.130 +/* The C++ semantics support requires definition of the RTTI object
1.131 + * layout. We use the same structures and names as the generic C++
1.132 + * ABI for Itanium.
1.133 + *
1.134 + * Define those structures here:
1.135 + */
1.136 +
1.137 +#ifdef __cplusplus
1.138 +extern "C" {
1.139 +#include "cxxabi.h"
1.140 +}
1.141 +#endif
1.142 +
1.143 +/* ---------------------------------------------------------------------- */
1.144 +
1.145 +/* External requirements */
1.146 +
1.147 +/* The C++ exception-handling 'globals' should be allocated per-thread.
1.148 + * The Exceptions ABI does not specify how this happens, but it is
1.149 + * intended that the details are localised to __cxa_get_globals.
1.150 + *
1.151 + * In the ARM implementation of __cxa_get_globals, it is assumed that a
1.152 + * zero-initialised location in a known per-thread place is somehow
1.153 + * obtainable, and can be assigned (by __cxa_get_globals) a pointer to
1.154 + * the allocated globals data structure. The macro EH_GLOBALS should be
1.155 + * defined here to yield a suitable address of type void*. This is used
1.156 + * only in __cxa_get_globals.
1.157 + *
1.158 + * Define it here:
1.159 + */
1.160 +
1.161 +#ifdef __cplusplus
1.162 +extern "C" {
1.163 + /* for __user_libspace() machinery */
1.164 +#include <interns.h>
1.165 +#define EH_GLOBALS libspace.eh_globals
1.166 +}
1.167 +#endif
1.168 +
1.169 +
1.170 +/* A routine is required for C++ derived class to base class conversion.
1.171 + * This is used once, in __cxa_type_match. It is likely that suitable
1.172 + * code exists as part of the RTTI support code. Therefore access it
1.173 + * via a macro:
1.174 + * DERIVED_TO_BASE_CONVERSION(PTR, P_NEW_PTR, CLASS_INFO, BASE_INFO)
1.175 + * Convert PTR from a pointer to a derived class (described by
1.176 + * CLASS_INFO) to a pointer to a base class (described by BASE_INFO)
1.177 + * and store the resulting pointer in P_NEW_PTR. Return true (or
1.178 + * non-zero) if the base class was found and the conversion was done,
1.179 + * otherwise return false (or zero).
1.180 + *
1.181 + * Define the macro here:
1.182 + */
1.183 +
1.184 +#ifdef __cplusplus
1.185 +/* In the ARM implementation, a suitable routine exists elsewhere in the
1.186 + * C++ runtime library, where it is part of the dynamic_cast mechanism.
1.187 + */
1.188 +extern "C" int __derived_to_base_conversion(void** p_ptr, void** p_new_ptr,
1.189 + const std::type_info * class_info,
1.190 + const std::type_info * base_info,
1.191 + char** access_flags, int use_access_flags);
1.192 +
1.193 +#define DERIVED_TO_BASE_CONVERSION(PTR, P_NEW_PTR, CLASS_INFO, BASE_INFO) \
1.194 + __derived_to_base_conversion(&(PTR), (P_NEW_PTR), (CLASS_INFO), (BASE_INFO), NULL, 0)
1.195 +#endif
1.196 +
1.197 +
1.198 +/* ---------------------------------------------------------------------- */
1.199 +
1.200 +/* Runtime debug support
1.201 + *
1.202 + * Here we define the interface to a "bottleneck function" to be called
1.203 + * by exception handling code at 'interesting' points during execution,
1.204 + * and breakpointable by a debugger.
1.205 + *
1.206 + * This is not part of the Exceptions ABI but is expected to be
1.207 + * standardised elsewhere, probably in a Debug ABI.
1.208 + *
1.209 + * If you don't want this, define DEBUGGER_BOTTLENECK as a dummy, e.g.
1.210 + * #define DEBUGGER_BOTTLENECK(UCBP,LANG,ACTIVITY,ARG) (void)0
1.211 + */
1.212 +
1.213 +#ifdef __cplusplus
1.214 +extern "C" {
1.215 +#endif
1.216 +
1.217 + struct _Unwind_Control_Block;
1.218 +
1.219 + typedef enum {
1.220 + _UASUBSYS_CPP = 0x00,
1.221 + _UASUBSYS_UNWINDER = 0xff
1.222 + } _Unwind_Activity_subsystem;
1.223 +
1.224 + typedef enum {
1.225 + _UAACT_STARTING = 0x0,
1.226 + _UAACT_ENDING = 0x1,
1.227 + _UAACT_BARRIERFOUND = 0x2,
1.228 + _UAACT_PADENTRY = 0x3,
1.229 + _UAACT_CPP_TYPEINFO = 0x80
1.230 + } _Unwind_Activity_activity;
1.231 +
1.232 + typedef enum {
1.233 + _UAARG_ENDING_UNSPECIFIED = 0x0,
1.234 + _UAARG_ENDING_TABLECORRUPT = 0x1,
1.235 + _UAARG_ENDING_NOUNWIND = 0x2,
1.236 + _UAARG_ENDING_VRSFAILED = 0x3,
1.237 + /* C++ only: */
1.238 + _UAARG_ENDING_CPP_BADOPCODE = 0x4,
1.239 + /* Unwinder only: */
1.240 + _UAARG_ENDING_UNWINDER_LOOKUPFAILED = 0x4,
1.241 + _UAARG_ENDING_UNWINDER_BUFFERFAILED = 0x5
1.242 + } _Unwind_Activity_arg;
1.243 +
1.244 + void _Unwind_Activity(struct _Unwind_Control_Block *ucbp, uint32_t reason, uint32_t arg);
1.245 +#define DEBUGGER_BOTTLENECK(UCBP,LANG,ACTIVITY,ARG) \
1.246 + _Unwind_Activity((UCBP),(((LANG)<<24)|ACTIVITY),(uint32_t)(ARG))
1.247 +
1.248 +#ifdef __cplusplus
1.249 +}
1.250 +#endif
1.251 +
1.252 +
1.253 +/* ---------------------------------------------------------------------- */
1.254 +
1.255 +/* Printed diagnostics
1.256 + *
1.257 + * These may be useful for debugging purposes during development, provided
1.258 + * the execution environment supports diagnostics via printf.
1.259 + *
1.260 + * #define PR_DIAGNOSTICS for printed diagnostics from the personality routine.
1.261 + * #define VRS_DIAGNOSTICS for printed diagnostics about VRS operations.
1.262 + * #define UNWIND_ACTIVITY_DIAGNOSTICS for printed information from _Unwind_Activity.
1.263 + */
1.264 +
1.265 +/* ---------------------------------------------------------------------- */
1.266 +
1.267 +#endif /* defined UNWINDENV_H */