home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-19 | 1.4 KB | 73 lines | [TEXT/KAHL] |
- {
- #ifdef MMU68040
- cpusha();
- #endif
- pflusha();
- /* save the current context */
- {
- struct userregs save;
- asm {
- movem.l d0-d7/a0-a5,save.save
- move.l (a6),save.save[14]
- move.w 4(a6),save.flags
- move.l 6(a6),save.pc
- };
- SetCurrentA5();
- save.save[15] = usp();
- memcpy(system_vectors, supervisor_vectors, vec_patch_size);
- #ifdef PROTECTED
- if (virtual)
- asm
- {
- move.w save.flags,sr
- }
- #endif
- #if 0
- SetCursor(*nxt[7&++ccnt]);
- #endif
- if (0x2000&~save.flags)
- {
- crp->registers = save;
- crp->state = 'D';
- }
- else if (crp) crp->state = 'R';
- }
- #if 0
- kprintf("Saved PC = %X USP = %X URP = %X\n",
- crp->registers.pc,
- crp->registers.save[15],
- (long)crp);
- #endif
- sched();
- #if 0
- kprintf("Restored PC = %X USP = %X URP = %X\n",
- crp->registers.pc,
- crp->registers.save[15],
- (long)crp);
- #endif
- /* restore the chosen context */
- {
- struct userregs save = crp->registers;
- #ifdef PROTECTED
- put_user_root((long)crp);
- if (virtual) EnterSupervisorMode();
- #endif
- put_usp(save.save[15]);
- #ifdef PROTECTED
- if (!virtual) upper_space(crp, crp->stack_limit-save.save[15]+stack_headroom);
- #endif
- memcpy(system_vectors, user_vectors, vec_patch_size);
- cpusha();
- pflusha();
- asm
- {
- move.l save.save[14],(a6)
- move.w save.flags,4(a6)
- move.l save.pc,6(a6)
- movem.l save.save,d0-d7/a0-a5
- unlk a6
- rte
- };
- }
- }
-