Interface Problem
Andreas Schwab
schwab@issan.cs.uni-dortmund.de
Wed Jun 30 15:43:00 GMT 1999
"MUELLER,DAVID" <damuelle@ezinfo.ethz.ch> writes:
|> Hi
|>
|> I have to program the onboard flash on an MPC8xx (PowerPC) based
|> system and i wish to write this program in C.
|>
|> As no OS is running i have to use a background debugger.
|> Some services, offered by the Background Debugger Software,
|> expect some specific cpu register to contain the
|> paramters for the services.
|>
|> I though to be very clever if i do something like this.
|>
|> Example:
|>
|> /* constants (fcode) for Background Debugger (EBDS) */
|> #define QUIT 0
|> #define PUTS 1
|>
|> /* call EBDS TRD function */
|> static __inline UINT32
|> Call_EBDS(UINT16 fcode)
|> {
|> register UINT16 fcode_return __asm ("%r16");
|>
|> fcode_return = fcode; // put function code in r16
|> __asm volatile ("mfspr %r0, 82"); // call Background Debugger
|> return(fcode_return);
You need to tell gcc that the asm is actually using and modifying the
register:
__asm volatile ("mfspr %%r0, 82" : "=r" (fcode_return) : "0" (fcode_return));
*Note Assembler Instructions with C Expression Operands: (gcc)Extended Asm.
--
Andreas Schwab "And now for something
schwab@issan.cs.uni-dortmund.de completely different"
schwab@gnu.org
More information about the Gcc
mailing list