source: rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_bspsupp.h @ 59a4066

4.104.114.95
Last change on this file since 59a4066 was 59a4066, checked in by Till Straumann <strauman@…>, on 12/11/07 at 05:18:06

2007-12-10 Till Straumann <strauman@…>

  • new-exceptions/bspsupport/README, new-exceptions/bspsupport/ppc_exc_bspsupp.h new-exceptions/bspsupport/vectors_init.c: added crude test to make sure MMU maps memory as write-back enabled.
  • Property mode set to 100644
File size: 4.5 KB
Line 
1/* PowerPC exception handling middleware; consult README for more
2 * information.
3 *
4 * Author: Till Straumann <strauman@slac.stanford.edu>, 2007
5 *
6 *  The license and distribution terms for this file may be
7 *  found in found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#ifndef PPC_EXC_SHARED_H
14#define PPC_EXC_SHARED_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/********* C-Exception Handlers *********************/
21
22/* API to be used by middleware,                    */
23/* BSP and application code (if necessary)          */
24
25/****************************************************/
26
27typedef int (*ppc_exc_handler_t)(BSP_Exception_frame *f, unsigned int vector);
28
29/*
30 * Bits in MSR that are enabled during execution of exception handlers / ISRs
31 * (on classic PPC these are DR/IR/RI [default], on bookE-style CPUs they should
32 * be set to 0 during initialization)
33 *
34 * By default, the setting of these bits that is in effect when exception
35 * handling is initialized is used.
36 */
37extern uint32_t ppc_exc_msr_bits;
38
39/*
40 * Set of MSR bits required to disable all
41 * asynchronous exceptions (depends on CPU type;
42 * must be set during initialization).
43 * Interrupt are disabled by writing the
44 * one's complement of this mask to msr:
45 *  msr &= ~ppc_exc_msr_irq_mask;
46 */
47extern uint32_t ppc_exc_msr_irq_mask;
48
49/* (See README under CAVEATS). During initialization
50 * a check is performed to assert that write-back
51 * caching is enabled for memory accesses. If a BSP
52 * runs entirely without any caching then it should
53 * set this variable to zero prior to initializing
54 * exceptions in order to skip the test.
55 * NOTE: The code does NOT support mapping memory
56 *       with cache-attributes other than write-back
57 *       (unless the entire cache is physically disabled)
58 */
59extern uint32_t ppc_exc_cache_wb_check;
60
61/*
62 * Hook C exception handlers.
63 *  - handlers for asynchronous exceptions run on the ISR stack
64 *    with thread-dispatching disabled.
65 *  - handlers for synchronous exceptions run on the task stack
66 *    with thread-dispatching enabled.
67 *
68 * If a particular slot is NULL then the traditional 'globalExcHdl' is used.
69 *
70 * ppc_exc_set_handler() registers a handler (returning 0 on success,
71 * -1 if the vector argument is too big).
72 *
73 * It is legal to set a NULL handler. This leads to the globalExcHdl
74 * being called if an exception for 'vector' occurs.
75 */
76int
77ppc_exc_set_handler(unsigned vector, ppc_exc_handler_t hdl);
78
79/* ppc_exc_get_handler() retrieves the currently active handler.
80 */
81ppc_exc_handler_t
82ppc_exc_get_handler(unsigned vector);
83
84/********* Low-level Exception Handlers *************/
85
86/* This part of the API is used by middleware code  */
87
88/****************************************************/
89
90typedef uint32_t ppc_exc_min_prolog_t[4];
91
92/* Templates are ppc_raw_except_func BUT they must be exactly 16 bytes */
93typedef rtems_raw_except_func ppc_exc_min_prolog_template_t;
94
95/*
96 * Expand a prolog template into 'buf' using vector 'vec'
97 */
98void
99ppc_exc_min_prolog_expand(ppc_exc_min_prolog_t buf, ppc_exc_min_prolog_template_t templ, uint16_t vec);
100
101extern unsigned ppc_exc_min_prolog_size[];
102/* Symbols are defined by the linker; declare as an array so
103 * that gcc doesn't attempt to emit a relocation looking for
104 * it in the SDA section
105 */
106extern unsigned ppc_exc_tgpr_clr_prolog_size[];
107
108/* Templates for ppc_exc_min_prolog_expand() which fills-in the vector information */
109extern void ppc_exc_min_prolog_async_tmpl_std();
110extern void ppc_exc_min_prolog_sync_tmpl_std();
111extern void ppc_exc_min_prolog_async_tmpl_p405_crit();
112extern void ppc_exc_min_prolog_sync_tmpl_p405_crit();
113extern void ppc_exc_min_prolog_async_tmpl_bookE_crit();
114extern void ppc_exc_min_prolog_sync_tmpl_bookE_crit();
115extern void ppc_exc_min_prolog_sync_tmpl_e500_mchk();
116extern void ppc_exc_min_prolog_async_tmpl_e500_mchk();
117
118/* Special prologue for handling register shadowing on 603-style CPUs */
119extern void ppc_exc_tgpr_clr_prolog();
120/* Classic prologue which determines the vector dynamically from
121 * the offset address. This must only be used for classic, synchronous
122 * exceptions with a vector offset aligned on a 256-byte boundary.
123 */
124extern void ppc_exc_min_prolog_auto();
125
126
127/* CPU support may store the address of a function here
128 * that can be used by the default exception handler to
129 * obtain fault-address info which is helpful. Unfortunately,
130 * the SPR holding this information is not uniform
131 * across PPC families so we need assistance from
132 * CPU support
133 */
134extern uint32_t (*ppc_exc_get_DAR)();
135
136#ifdef __cplusplus
137};
138#endif
139
140#endif
Note: See TracBrowser for help on using the repository browser.