I am actually preparing some exercises on a M52259Demo and encountered an issue for the user mode demonstration program.
The complete program simulates a user mode operating system trap call, using the user stack for parameter passing. So I set up a code like this to create an user stack an switch to user mode:
// Init for the application (user mode)
lea userStack, a0 // UserStackPointer init
move.l a0, usp
// switch to user mode
andi.l #0xdfff, d1
pea counter // Still pushes it to supervisor stack...
The code warrior register panel reflects 0x0704 as SR register value, which should be the non-supervisor mode, plus the correct address pointing to my user stack as OTHER_A7. But when I push the pointer to "counter" via the pea command, it pushes it onto the supervisor stack.
I verified the user mode, via the following putchar commands. Those are blocked in the user mode after reset state and perform correct using MCF_SCM_PACR2 |= 0x60, so I guess the switch to user mode performs correct.
I received the code from an old example (target processor 68030 embedded system, so I guess the code performed correct on the old system.
The simplified project, including the code example should be attached to this post.
mike aka modEmMaik