EmbDev.net

Forum: ARM programming with GCC/GNU tools Switch from USER-Mode to SVC-Mode via SWI


von Andreas K. (halma)


Attached files:

Rate this post
useful
not useful
Hey,

I am trying to program a CORTEX A9 Processor with ARM and a GCC/GNU
toolchain.

At first the processor is in SVC-Mode then I want to switch to User-Mode
and run a user-program.
My first try is only to switch from SVC- to User-Mode and then calling a
SWI to get back to SVC-Mode.
Without changing to User-Mode everything with the SWI and the returns
works well, but if I change to User-Mode everything breaks down.

My questions are:

Needs the program a User-Stack if I only switch to User-Mode and in the
next step I call the SWI?

Which registers  must I save bevor switching to User-Mode?

I added two files: One is the swiHandler.c and the other one called:
beforeUserMode_test.s, switches to the User-Mode and then calls the SWI.
I think I Need to save some pointer in this file and restore them at the
right point again, but I do not know when I have to do this.

I am new here and if you need more details to my problem please write
what you need and i will post it.

Thanks for helping me

Andi

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.