Reply by MW Ron March 31, 20052005-03-31
Hi Reggie,

I didn't know so I asked around. Best answer I got is below,
Ron
...

I'm not clear on exactly what happens and at what point in the program
with he tasks that Reggie is talking about. A better description would
be useful. I cannot think of anything from a tools standpoint that would
cause the program to act as described.

He looks like he has the right idea about saving the Page 0 registers
(all MR0-MR15 should be saved). Where is he saving these registers? Is
there some king of mutex that prevents other tasks or contexts from
corrupting the saved values? Is he correctly restoring the values when
he returns to the context for which the values were stored?. Is he
making sure the stack is not corrupted when he swaps contexts?

--
Metrowerks Community Forum is a free online resource for developers to
discuss CodeWarrior topics with other users and Metrowerks' staff
-- http://www.metrowerks.com/community --

Ron Liechty - MWRon@MWRo... - http://www.metrowerks.com Reggie Vivekananda wrote:

> I'm working on a real-time scheduler for 827 and using CodeWarrior
> 5 as compiler. The online manuals contais the following text:
>
> Page 0 Register Assignment
> ---------------------------------
>
> The compiler uses page 0 address locations 0x30 - 0x40 as register
> variables. Frequently accessed local variables are assigned to the
> page 0 registers instead of to stack locations so that load and store
> instructions are shortened. Addresses 0x30 - 0x37 (page 0 registers
> MR0-MR7) are volatile registers and can be overwritten. The remaining
> registers (page 0 registers MR8-MR15) are treated as non-volatile
> and, if used by a routine, must be saved on entry and restored on
> exit.
>
> When I have to swap context, I first save all register variables
> (0x30 - 0x3f), but the some tasks stop working. If I save them
> partially, i.e., [0x30 - 0x37] or [0x38 - 0x3f], the tasks start to
> work on a unpredictable way (too bad for real-time). Can anyone
> explain me how to correctly use these register variables?
>




Reply by Reggie Vivekananda March 30, 20052005-03-30

Hi,

I'm working on a real-time scheduler for 827 and using CodeWarrior
5 as compiler. The online manuals contais the following text:

Page 0 Register Assignment
---------------------------------

The compiler uses page 0 address locations 0x30 - 0x40 as register
variables. Frequently accessed local variables are assigned to the
page 0 registers instead of to stack locations so that load and store
instructions are shortened. Addresses 0x30 - 0x37 (page 0 registers
MR0-MR7) are volatile registers and can be overwritten. The remaining
registers (page 0 registers MR8-MR15) are treated as non-volatile
and, if used by a routine, must be saved on entry and restored on
exit.

When I have to swap context, I first save all register variables
(0x30 - 0x3f), but the some tasks stop working. If I save them
partially, i.e., [0x30 - 0x37] or [0x38 - 0x3f], the tasks start to
work on a unpredictable way (too bad for real-time). Can anyone
explain me how to correctly use these register variables?

Thanks in advance,

Reggie Vivekananda
LACTEC - Institute of Technology for Development
http://www.lactec.org.br