source: trunk/softs/tsar_boot/exceptions.c @ 286

Last change on this file since 286 was 282, checked in by bouyer, 12 years ago

Complete r281:
Keep BEV bit set in STATUS register, and add an exception handler at
0xbfc0380. This handler just prints STATUS, CAUSE and EPC register and
stalls (does an infinite loop).

File size: 634 bytes
RevLine 
[282]1/**
2 * \file    : exceptions.c
3 * \date    : December 2012
4 * \author  : Manuel Bouyer
5 *
6 * This file defines a simple exeptions handler
7 */
8
9#include <boot_tty.h>
10
11#define in_reset       __attribute__((section (".reset")))
12#define in_reset_data __attribute__((section (".reset_data")))
13
14in_reset void handle_exept(int status, int cause, int epc)
15{
16        boot_puts("boot (default) exeption handler called: \r\n    status ");
17        boot_putx(status);
18        boot_puts("\r\n    cause  ");
19        boot_putx(cause);
20        boot_puts(" (exeption ");
21        boot_putx((cause >> 2) & 0x1f);
22        boot_puts(")\r\n    epc    ");
23        boot_putx(epc);
24        boot_puts("\r\n");
25        while (1);
26}
Note: See TracBrowser for help on using the repository browser.