hello ,
i use codewarrior v 5.5.1.1 for a mpc565 and want to define some asm instructions in a macro in a C head file.
the asm instructions look like :
stwu AddressInMemory,-80(AddressInMemory)
stw r0,8(AddressInMemory)
mfctr r0
stw r0,12(AddressInMemory)
mfxer r0
stw r0,16(AddressInMemory)
....
....
....
which the parameter AddressInMemory is a pointer in the c program.it can be any addresse in the whole Memory.
i have tried to write the macro like this.
#define portRESTORE_CONTEXT()
{
extern volatile void * aPointer;
asm ("lwz r0,32(%0)":"=g"(aPointer));
...
...
...
}
it not works.can someone tell me what the right is.
OR,because the assembly instructions are too much, i want write them regularly in a asm file, and define it as a assembly function, which c can also call them in C-function.but the problem is how can i give the "aPointer" of C as parameter to the assembly function,and the parameter will be given as Constant(in other words, the parameter will not use any register,because my intention is all of the contents of registers will be saved in the place where the "aPointer" points.)
thanks for your help.
kun
Message Edited by J2MEJediMaster on 2007-04-12 10:03 AM