Hi,
I am porting a small operating system to the C6748, and am right now in the process of implementing support for interrupts. Its pretty straightforward, but unfortunately also prone for being very slow because of the amount of registers in the C6748.
I will ofcourse have to save all registers that are used by the interrupt routine, and as I would like to write some of these routines in C, then I will have to push all the registers that C uses.
Since the cpu has 64 registers, I will have to push A1-A9, A16-31m, B1-B9, B16-B31. I am pretty sure the compiler never would use this many registers for normal code, but if I don't know for sure, then I cannot count on it.
The optimizer seems to be pretty good and if I create a function and marks it with the "interrupt" keyword, then it may generate code that saves fewer registers, however, I cannot use the "interrupt" keyword because the compiler also generates a return from interrupt (B IRP) instruction when it is used, and I want the code to return to my own assembler code that called the C function..
So now for the questions:
- Is there a way to tell the c compiler to generate a function saving all necessary registers but NOT generate the B IRP instruction. It should generate the normal B B3 instead.
- Is there a way to tell the c-compiler to limit its own use to a certain register range?
If that was possible, I probably could limit the c code to use registers 0-15 and reserve 16-31 for special purpose assembler code. In this case I would only have to save A1-A9 and B1-B9.
- Any other suggestions? I am pretty uncomfortable with having to push about 52 registers on each interrupt.
Helge