¿ªÔÆÌåÓý

GCCLIB - Double Branch on calls to RESLIB library - needed?


 

At the moment the stubs (linked to the client program) look like this:

? ? ? ? ?EXTRN GCCANCHR
VFPRINTF CSECT
? ? ? ? ?USING VFPRINTF,R15
? ? ? ? ?L? ? ?R15,=V(GCCANCHR) get anchor ptr
? ? ? ? ?L? ? ?R15,0(R15)? ? ? ?get the anchor
? ? ? ? ?LA? ? R15,VTVFPRIN(R15)? ?<- i.e. the nth entry
? ? ? ? ?BR? ? R15? ? ? ? ? ? go there
? ? ? ? ?LTORG
? ? ? ? ?VTABLE
? ? ? ? ?REGEQU
? ? ? ? ?END

This jumps to a location in the RESLIB library which looks like this

FPRINTF? ? DS? ? 0H
? ? ? ? ?USING *,R15
? ? ? ? ?L? ? ?R15,=V(FPRINTF)? ? <- the stub has worked out that?VTVFPRIN / FPRINTF is entry n with address here
? ? ? ? ?BR? ? R15

Which jumps to the implementation. Two branches.

(I am assuming that "FPRINTF? ? DS? ? 0H" is something that the linker sorts out - not sure why an EXTRN is not used but is above - besides the point!)

Is there anyway that I can just do something like:

In the table have
? ? ? DS??=V(FPRINTF)
? ? ? DS??=V(PRINTF)
? ? ? DS??=V(ANOTHER)

and in the stub do something like
? ? ? ? ?USING VFPRINTF,R15
? ? ? ? ?L? ? ?R15,=V(GCCANCHR) get anchor ptr
? ? ? ? ?L? ? ?R15,0(R15)? ? ? ?get the anchor
? ? ? ? ?LA? ? R15,VTVFPRIN(R15)
? ? ? ? ?LA? ? R15,0(R15)
? ? ? ? ?BR? ? R15? ? ? ? ? ? go there
?
But in an efficient way - or is two branches as fast as it gets?!
Can someone craft some Assembler for me?

Something I will come to next after doing the dynamic stack, as I want to automate the stub building anyway.

Thanks as always!

Adrian

Join [email protected] to automatically receive all group messages.