This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Preserving registers on function calls

We have an assembler function, which when called from C, some or all registers may be trashed.

Saving and then restoring them is an option but it takes too much RAM.

Is there a directive which tells the compiler that registers may be trashed when a certain function is called?

Thanks in advance,

Gary Partis

Parents
  • Basically the Keil C assume that any function trashes all registers. A simple way to handle it is to write a skeleton function in C and use the generated assembler source as a base for the assembly routine (it will include comments re register use)

    Erik

Reply
  • Basically the Keil C assume that any function trashes all registers. A simple way to handle it is to write a skeleton function in C and use the generated assembler source as a base for the assembly routine (it will include comments re register use)

    Erik

Children