source: rtems/bsps/m68k/mvme167/start/bspclean.c @ 9964895

Last change on this file since 9964895 was 9964895, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 20, 2018 at 8:35:35 AM

bsps: Move startup files to bsps

Adjust build support files to new directory layout.

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/**
2 *  @file
3 *
4 *  These routines return control to 167Bug after a normal exit from the
5 *  application.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2012.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 *
16 *  Modifications of respective RTEMS files:
17 *  Copyright (c) 1998, National Research Council of Canada
18 */
19
20#include <bsp.h>
21#include <bsp/bootcard.h>
22#include <page_table.h>
23
24extern void start( void );
25extern void page_table_teardown( void );
26
27/**
28 *  @brief bsp_return_to_monitor_trap
29 *
30 *  Switch the VBR back to ROM and make a .RETURN syscall to return control to
31 *  167 Bug. If 167Bug ever returns, restart the application.
32 */
33static void bsp_return_to_monitor_trap( void )
34{
35  register volatile void *start_addr;
36
37  page_table_teardown();
38
39  lcsr->intr_ena = 0;               /* disable interrupts */
40  m68k_set_vbr(0xFFE00000);         /* restore 167Bug vectors */
41  __asm__ volatile( "trap   #15\n\t"    /* trap to 167Bug */
42                ".short 0x63" );    /* return to 167Bug (.RETURN) */
43
44  /* restart program */
45  start_addr = start;
46  __asm__ volatile( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) );
47}
48
49/*
50 *  This code was copied from other MC680x0 MVME BSPs.
51 *  Our guess is that someone was concerned about the CPU no longer being in
52 *  supervisor mode when they got here. This function forces the CPU back to
53 *  supervisor mode so the VBR may be changed. It places the address of the
54 *  function that makes a 167Bug .RETURN syscall in the trap 13 entry in the
55 *  exception vector, and then issues a trap 13 call. It is also possible that
56 *  the code was copied from some other OS that does run tasks in user mode.
57 *  In any case, it appears to be a bit of paranoia, and could lead to
58 *  problems if 167Bug is invoked before we get to switch the VBR back to
59 *  167Bug because trap 13 is documented as being reserved for the internal
60 *  use of the debugger.
61 */
62void bsp_fatal_extension(
63  rtems_fatal_source source,
64  bool always_set_to_false,
65  rtems_fatal_code error
66)
67{
68   M68Kvec[ 45 ] = bsp_return_to_monitor_trap;
69   __asm__ volatile( "trap #13" );
70}
Note: See TracBrowser for help on using the repository browser.