gonzui


Format: Advanced Search

tkernel_2/monitor/cmdsvc/src/armv6/monent.cbare sourcepermlink (0.03 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      monent.c
   17:  *
   18:  *       Entry to monitor
   19:  */
   20: 
   21: #include "../cmdsvc.h"
   22: #include <sys/sysinfo.h>
   23: 
   24: EXPORT W        bootFlag;      /* boot flag */
   25: 
   26: /*
   27:  * monitor entry processing
   28:  *       vec     exception vector number
   29:  */
   30: EXPORT void entMonitor( UW vec )
   31: {
   32:         UW     v;
   33:         W      bpflg;
   34:         UB     *cmd;
   35:         UW     save_taskmode;
   36: 
   37:         /* update task mode */
   38:         save_taskmode = SCInfo.taskmode;
   39:         SCInfo.taskmode <<= 16;
   40: 
   41:         /* monitor entry processing (flushing cache, etc.) */
   42:         enterMonitor(0);
   43: 
   44:         /* initialize address check data */
   45:         initChkAddr();
   46: 
   47:         /* release breakpoint temporarily */
   48:         bpflg = resetBreak(vec);
   49: 
   50:         bootFlag = 0;
   51: 
   52:         switch ( vec ) {
   53:           case EIT_DEFAULT:    /* reset */
   54:                 if ( bootSelect() == BS_AUTO ) {
   55:                         /* automatic boot */
   56:                         if ( bootDisk(NULL) >= E_OK ) break; /* execute boot */
   57:                 }
   58:                 /* invoke monitor */
   59:                 dispTitle();                  /* boot message */
   60:                 procCommand(NULL, 0);         /* command processing */
   61:                 break;
   62: 
   63:           case SWI_MONITOR:    /* service call */
   64:                 /* Execute SVC: Parameters given are, r12(fn), r0, r1, r2, r3 */
   65:                 v = procSVC(getRegister(12), getRegister(0),
   66:                         getRegister(1), getRegister(2), getRegister(3));
   67: 
   68:                 /* At boot time, r0 holds the boot parameter,
   69:                    so don't change r0 */
   70:                 if ( bootFlag == 0 ) setRegister(0, v);       /* result is set to 0 */
   71:                 break;
   72: 
   73:           case EIT_IDEBUG:     /* debug abort instruction */
   74:           case EIT_DDEBUG:     /* debug abort data */
   75:                 if ( procBreak(bpflg, &cmd) > 0 ) {
   76:                         procCommand(cmd, 0);
   77:                 }
   78:                 break;
   79: 
   80:           default:     /* unsupported instruction exception, interrupt, or traps */
   81:                 if ( procEIT(vec) == 0 ) {
   82:                         stopTrace();         /* stop tracing */
   83:                         procCommand(NULL, 0);        /* command processing */
   84:                 }
   85:         }
   86: 
   87:         /* set breakpoint */
   88:         setupBreak();
   89: 
   90:         /* monitor exit processing (flushing cache, etc.) */
   91:         leaveMonitor(getCP15(1, 0));
   92: 
   93:         /* restore task mode */
   94:         SCInfo.taskmode = save_taskmode;
   95: 
   96:         return; /* returning leads to user program execution */
   97: }