On Wed, Mar 05, 2003 at 11:30:17PM -0800, Tinga Shilo wrote:
> I am implementing a kernel mechanism which is
> very performance oriented. Along my long critical
> there is a static variable that needs to be accessed
> quite a few times. This variable is a structure which
> is approximately 60 bytes big.
> In there any way I can "convince" my kernel (compiled
> with gcc) to access this variable using gp ?
> Is gp usually used for this purpose in mips-linux ?
> Can it be ?
> A while ago I saw a small discussion here about usage
> of gp for static variables, but it didn't provide
> any definite answers.
Use a pointer to the that structure. Gcc will keep this pointer in a
registers wherever it considers that sensible. Any reference to members
of the structure can then be made with just a single instruction.
$28 is used for the current pointer so only suitable for per-process