blob: 54b617e6a3ba43875d34fd784072e48efc2d9cd3 (
plain)
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
|
/**
* @file
*
* These routines return control to 167Bug after a normal exit from the
* application.
*/
/*
* COPYRIGHT (c) 1989-2012.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*
* Modifications of respective RTEMS files:
* Copyright (c) 1998, National Research Council of Canada
*/
#include <bsp.h>
#include <bsp/bootcard.h>
#include <page_table.h>
extern void start( void );
extern void page_table_teardown( void );
/**
* @brief bsp_return_to_monitor_trap
*
* Switch the VBR back to ROM and make a .RETURN syscall to return control to
* 167 Bug. If 167Bug ever returns, restart the application.
*/
static void bsp_return_to_monitor_trap( void )
{
register volatile void *start_addr;
page_table_teardown();
lcsr->intr_ena = 0; /* disable interrupts */
m68k_set_vbr(0xFFE00000); /* restore 167Bug vectors */
__asm__ volatile( "trap #15\n\t" /* trap to 167Bug */
".short 0x63" ); /* return to 167Bug (.RETURN) */
/* restart program */
start_addr = start;
__asm__ volatile( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) );
}
/*
* This code was copied from other MC680x0 MVME BSPs.
* Our guess is that someone was concerned about the CPU no longer being in
* supervisor mode when they got here. This function forces the CPU back to
* supervisor mode so the VBR may be changed. It places the address of the
* function that makes a 167Bug .RETURN syscall in the trap 13 entry in the
* exception vector, and then issues a trap 13 call. It is also possible that
* the code was copied from some other OS that does run tasks in user mode.
* In any case, it appears to be a bit of paranoia, and could lead to
* problems if 167Bug is invoked before we get to switch the VBR back to
* 167Bug because trap 13 is documented as being reserved for the internal
* use of the debugger.
*/
void bsp_fatal_extension(
rtems_fatal_source source,
bool is_internal,
rtems_fatal_code error
)
{
M68Kvec[ 45 ] = bsp_return_to_monitor_trap;
__asm__ volatile( "trap #13" );
}
|