Am 18.09.2010 15:27, schrieb gdgqler:
If you add a Thing to the list of Things by using the software described in the 
manual for the Trap #1 routine sms.lthg you will find that the linkage block 
you have provided is partially completed (which is correct) but that, in 
addition, the long word 12 bytes before the start of the linkage block is set 
with the linkage block's address.

Does anyone know the reason for this bizarre and potentially dangerous 
operation?

The source code for this is:

        LEA          TH_FRZAP+IOD_IOLK-IOD_CLOS(A1),A0
         MOVE.L   A0,CHP_DRLK-CHP_END(A1)

A1 points to the linkage block. Now, given that:

        TH_FRZAP   = $0C
        IOD_IOLK     = $18
        IOD_CLOS   = $24
        CHP_DRLK  = $04
        CHP_END    = $10

the two instructions become:

        LEA         (A1),A0              [a slightly unusual way of putting A1 
into A0?]
        MOVE.L  A0,-12(A1)

I can't refrain from commenting that  these two instructions could have been 
written more shortly as:

        MOVE.L  A1,-12(A1)

which perhaps shows more clearly the peculiar nature of this part of HOT_REXT.

George

George,
you seem to be taking this from HOT_REXT. Where did you get the sources for this? When looking into SMSQ/E sources, there is nothing comparable to what you see there (sms.lthg is in util_thg_lthg_asm. Nothing in there touches memory on negative offsets to the linkage block (and, instead of linking in "manually", the mem.llst vector is used), at least in my version of SMSQ/E. And, you're right, the code you cite boils down to the two instructions you mention. The documentation mentions that the linkage block needs to be memory allocated through sms.alchp, so -12(a1) actually seems to be pointing into the heap header and mangles something in there.

Cheers,
Tobias
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to