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

[f-cpu] Memory convention



Hi every body,

	I am currently adding some new parts to the manual (SR MAP,
changing optionales instructions, ...) and I think that we need to
clarify some little thing about memory operation.

	First we must specify if we are using by default little or big endian,
because librairies will dislike to manipulate big endian data if they wait
for little endian. I think that for portability reason we must specify little
endian by default, as a memory convention.

	Second stream hints call convention. As I explain to Yann, we
need a call convention for stream hints too. Because if we don't do
that we will have a lot of diffculty to use it in the normal case. The 
problem is that for example if we say stream 0 for stack and 8 for 
malloced data, what append if we pass it to a function that use it as
a pointer ? Certainly a crach.

	So I see three possibilty (If you have other idea) :
	- First : say always stream 0 for all parameter and all
	exported pointer => Easy, but stream have no interrest
	- Second : as NicO suggest to me, do something like a flush all
	LSU instruction (certainly add a flag to serialize)
	=> A little bit better, but you loose all your cached data...
	- Third : Add a new instruction that take a pointer and change
	the associated stream to it => problem with copy, but the
	most easiest for a compiler to generate optimal code.

	The last case can be handle by a madd/msub with r0 for
parameter, but it create a copy of the pointer and well that can be
a problem. And currently I think that if you change the stream hints
with madd/msub the result must be unknow (normally madd/msub
are used to walk in the same memory area).
	And a new instruction will certainly be cleaner.

	Finally, I am sure that some body will say, it's not a problem,
it will not be implemented into the FC0... So I will answer directly, why
speacking about this now. Imagine you are now working on the libc
and you are porting it on the F-CPU, for example the string operation.
	Take strdup as an example. If you don't know wich stream to
use you will generate a simple code that will work with only stream 0.
And then a guy came and say now the call convention say stream
must be like this. Will you change all you code ? I think not, and 
perhaps a lot of people will not do it.
	But before starting discussion on stream hints call convention,
we must take a decision on witch solution we choose for 
synchronising different LSU.

Cedric

*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/