summaryrefslogtreecommitdiffstats
path: root/main/cpu/template/except_template.c
blob: 6c3d1c3b1f4ee7ad6fbc8411e78e47990b91da49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**************************************************************************
 *
 * Copyright (c) 2013 Alcatel-Lucent
 *
 * Alcatel Lucent licenses this file to You under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License.  A copy of the License is contained the
 * file LICENSE at the top level of this repository.
 * You may also obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 **************************************************************************
 *
 * except_template.c:
 *
 * Template for cpu-specific code that handles exceptions that are caught
 * by the exception vectors that have been installed by the monitor through
 * vinit().
 *
 * Original author:     Ed Sutter (ed.sutter@alcatel-lucent.com)
 *
 */
#include "config.h"
#include "cpu.h"
#include "cpuio.h"
#include "genlib.h"
#include "stddefs.h"
#include "warmstart.h"

ulong   ExceptionAddr;
int     ExceptionType;

/* exception():
 * This is the first 'C' function called out of a monitor-installed
 * exception handler.
 */
void
exception(void)
{
    /* ADD_CODE_HERE */

    /* Populating these two values is target specific.
     * Refer to other target-specific examples for details.
     * In some cases, these values are extracted from registers
     * already put into the register cache by the lower-level
     * portion of the exception handler in vectors_template.s
     */
    ExceptionAddr = 0;
    ExceptionType = 0;

    /* Allow the console uart fifo to empty...
     */
    flushconsole();
    monrestart(EXCEPTION);
}

/* vinit():
 * This function is called by init1() at startup of the monitor to
 * install the monitor-based vector table.  The actual functions are
 * in vectors.s.
 */
void
vinit()
{
    /* ADD_CODE_HERE */
}

/* ExceptionType2String():
 * This function simply returns a string that verbosely describes
 * the incoming exception type (vector number).
 */
char *
ExceptionType2String(int type)
{
    char *string;

    /* ADD_CODE_HERE */
    return(string);
}