home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1993-10-23 | 3.3 KB | 89 lines |
- DEFINITION MODULE Process; (* G. Koller 29.11.87 *)
-
- FROM SYSTEM IMPORT
- WORD, ADDRESS;
-
- TYPE
- M68000StatusBits = (
- sbCarry, (* 0 *)
- sbOverflow, (* 1 *)
- sbZero, (* 2 *)
- sbNegativ, (* 3 *)
- sbExtend, (* 4 *)
- sbNotUsed5, (* 5 *)
- sbNotUsed6, (* 6 *)
- sbNotUsed7, (* 7 *)
- sbIntMask0, (* 8 *)
- sbIntMask1, (* 9 *)
- sbIntMask2, (* a *)
- sbNotUsed11, (* b *)
- sbNotUsed12, (* c *)
- sbSupervisor, (* d *)
- sbNotUsed13, (* e *)
- sbTrace (* f *)
- );
-
- M68000StatusRegister =
- SET OF M68000StatusBits;
-
- PROCESS = POINTER TO M68000Context;
-
- M68000Context =
- RECORD
- Valid : LONGINT; (* 0H BYTE Offset *) (*DS*)
- D0, D1, D2, D3, (* 4H *)
- D4, D5, D6, D7 : LONGINT; (* 14H *)
- A0, A1, A2, A3 : ADDRESS; (* 24H *)
- ModuleBaseA4 : ADDRESS; (* 34H *)
- ProcessBaseA5 : ADDRESS; (* 38H *)
- FramePointerA6 : ADDRESS; (* 3CH *)
- StackPointerA7 : ADDRESS; (* 40H *) (*DS*)
- StatusRegister : M68000StatusRegister; (* 44H *)
- ProgramCounter : PROC; (* 46H *)
- END; (* M68000Context *) (* 4AH *)
-
- (* Only if Valid in M68000Context equals Magic the PROCESS is valid *)
-
- CONST
- Magic = 04091964H;
-
- (* M68000 Stack grows down to lower memory addresses.
- This way, D0 of Context is on top of Stack and A7 of
- the saved Process context must point to this location.
- SavedFramePointer is on bottom of the stack an should
- be NIL to mark the end of the dynamic link chain
- *)
-
- VAR
- MainPROCESSPtr : POINTER TO PROCESS;
- (* Pointes to the process variable of the main process.
- If not NIL, the referenced, saved context will be loaded
- after an error in a coroutine for correct debugger operation. *)
- ErrorPROCESS : PROCESS;
- (* If there was a valid MainPROCESSPtr the errornouse process
- context is saved referenced by this location *)
- GemSSP : ADDRESS;
- (* Gem System Stack Pointer saved in this location while installing *)
-
- PROCEDURE LISTEN;
-
- PROCEDURE NEWPROCESS (ProcessCode : PROC;
- WorkSpaceBase : ADDRESS;
- WorkSpaceSize : LONGCARD;
- VAR ProcessDesc : PROCESS );
- (* create a basic process image inside the WorkSpace *)
-
- PROCEDURE TRANSFER (VAR From: PROCESS; VAR To: PROCESS);
- CODE(04E43H); (*DS*)
- (* transfer the processor control to the context of process To
- an save current context in From. From and To may be equal *)
-
- PROCEDURE IOTRANSFER (VAR From: PROCESS; VAR To: PROCESS; Vector: ADDRESS);
- CODE(04E44H); (*DS*)
- (* transfer the processor control to the context of process To
- an save current context of the interrupt process in From.
- From context will be loaded in case of an interrupt and the
- running process will be saved under Address To *)
-
- END (* OF DEFINITION MODULE *) Process.
-