[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] W1R3 and macmint (was MiNTOS versions)



Oddie  Jonathan <oddie@bvsd.k12.co.us> writes:

|> Another gcc usage question:
|> Is there a way to tell gcc to put a function's arguments in specific registers
|> rather than using the stack? Apart from writing assembler, I mean.
|> e.g. an OS trap that takes one pointer in A0 and returns a value in D0.

You can say this:

	void *input;
	int retval;

	/* produce input */
	{
	  register void *a0 asm("a0") = input;
	  register int d0 asm("d0");

	  asm ("trap #0" : "=r" (d0) : "r" (a0));
	  retval = d0;
	}
	/* consume retval */

*Note Assembler Instructions with C Expression Operands: (gcc)Extended Asm.
*Note Variables in Specified Registers: (gcc)Explicit Reg Vars.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org