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

Author: Andreas Klettner (halma)
Posted on:
Attached files:

Rate this post
0 useful
not useful

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

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



Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.