[Coco] [Color Computer] OS-9 Question, GCC stuff
L. Curtis Boyle
curtisboyle at sasktel.net
Sun Jul 24 02:11:51 EDT 2005
On Sat, 23 Jul 2005 10:02:47 -0600, <jdaggett at gate.net> wrote:
> That will work if when context switching and all the registers are
> stacked and recalled. If the OS did not preserve the state of the DP
> register when switching context from the kernal to the modules then
> recal the state of the DP register after module execution t hen t here
> would be a wh ole lot of trouble.
> Still the main issue is one needs to take care when altering the DP
> register within a user program. Either the OS or the user program
> has to insure that the DP register is preserved on entering and
> exiting the user task.
The OS itself does at this point in Level II/Nitros9. When a software
(system call) or hardware interrupt occurs, the registers are
automatically pushed on the stack, and then it jumps into the vector page.
At this point, the kernal shuts down IRQ's, sets up the proper vector for
the interrupt type, forces DP to 0, forces the DAT task to 0 (system) It
then checks to see which DAT map it came from; if it is either 0 or 1
(system or grfdrv), then it completes mapping DAT task 0 and continues. If
it is any other tasks (2 and up, which would be user processes), then it
quickly maps the original process back in, and makes a copy of that task's
register stack at the point of the IRQ (so, all registers that were
preserved on the stack at the time the IRQ happened) into $FEDD or FEDF
(depending on 6309 vs. 6809) in the vector page RAM. Now, the system tasks
have access to the original register set from a user task, which it can
use for dispatching system calls, processing hardware IRQ's, etc. DP is
included in this, so it is preserved between task changes for each unique
process, and each process can pretty well do with it what it wants.
OS9 level 1, on the other hand, is sharing the 64K space between system
and user proceses, so there it is much more critical to preserve it.
L. Curtis Boyle
More information about the Coco