This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: iq2000 trampolines


On Jun 9, 2006, at 5:16 PM, DJ Delorie wrote:
Write the code, make the code into a dynamic library, dlopen it,

The problem is that the iq2000 is a smart peripheral, not a general purpose CPU. Its instruction memory is not available to it directly, the host has to write the instructions to it (although it's labelled as "PROM" in the specs, so maybe the host can't write to it either).

And I haven't yet found a way to convince it to execute out of its
data memory.

So, OS feature then, or the other way would be to:


struct {
	// ... data for the trampoline, filled in by runtime code
} *tramp_data;

tramp0:
	call do_tramp
tramp1:
	call do_tramp
...
trampn:
	call do_tramp
do_tramp:
	pop return_addr into r0
	sub r0,tramp0
	div r0,4
	mult r0,sizeof (struct tramp_data[0])
	ld r1, tramp_data
	add r0, r1

and then use the data pointed to by r0 to finish off the call. Something like that I think might work. This allows one to map the contained data into a program counter, and back again. I'm assuming that one can have runtime built function pointers on the architecture, if not oh well.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]