[3ae31e9] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | mtquit.c -- Multi-Tasker -- shutdown
|
---|
| 4 | Version 1 -- 1988-04-11 -- D.N. Lynx Crowe
|
---|
| 5 | (c) Copyright 1988 -- D.N. Lynx Crowe
|
---|
| 6 | =============================================================================
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | #include "stddefs.h"
|
---|
| 10 | #include "biosdefs.h"
|
---|
| 11 | #include "mtdefs.h"
|
---|
| 12 |
|
---|
| 13 | extern short _MT_Nil(); /* system NIL task */
|
---|
| 14 |
|
---|
| 15 | extern TCB *MT_CurP; /* current TCB pointer */
|
---|
| 16 | extern TCB *MT_RdyQ; /* ready queue pointer */
|
---|
| 17 |
|
---|
| 18 | extern unsigned *_MT_Vc1; /* old swapper TRAP vector 1 */
|
---|
| 19 | extern unsigned *_MT_Vc2; /* old swapper TRAP vector 2 */
|
---|
| 20 |
|
---|
| 21 | long _MT_Stk[48]; /* a stack for _MT_Nil() */
|
---|
| 22 |
|
---|
| 23 | TCB _MT_TCB; /* dummy TCB for shutdown */
|
---|
| 24 |
|
---|
| 25 | /* |
---|
| 26 |
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /*
|
---|
| 30 | =============================================================================
|
---|
| 31 | MTQuit() -- shut down the multi-tasker
|
---|
| 32 | =============================================================================
|
---|
| 33 | */
|
---|
| 34 |
|
---|
| 35 | MTQuit()
|
---|
| 36 | {
|
---|
| 37 | register short oldipl;
|
---|
| 38 |
|
---|
| 39 | oldipl = setipl(7); /* DISABLE INTERRUPTS */
|
---|
| 40 |
|
---|
| 41 | BIOS(B_SETV, 40, _MT_Vc1); /* restore old trap vector 1 */
|
---|
| 42 | BIOS(B_SETV, 41, _MT_Vc2); /* restore old trap vector 2 */
|
---|
| 43 |
|
---|
| 44 | _MT_Vc1 = (short *)NIL; /* clear trap vector save area 1 */
|
---|
| 45 | _MT_Vc2 = (short *)NIL; /* clear trap vector save area 2 */
|
---|
| 46 |
|
---|
| 47 | /* setup dummy current TCB in case of 'accidents' */
|
---|
| 48 |
|
---|
| 49 | _MT_TCB.pri = (unsigned)0xFFFF; /* highest priority */
|
---|
| 50 | _MT_TCB.slice = -1L; /* no time slicing */
|
---|
| 51 |
|
---|
| 52 | MT_CurP = &_MT_TCB; /* make dummy TCB current */
|
---|
| 53 | MT_RdyQ = (TCB *)NIL; /* clear the ready queue */
|
---|
| 54 |
|
---|
| 55 | setipl(oldipl); /* RESTORE INTERRUPTS */
|
---|
| 56 | }
|
---|