Am 19.09.2010 11:06, schrieb gdgqler:
On 18 Sep 2010, at 22:25, Tobias Fröschle wrote:

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.
The source code I quote from is in fact from SMSQ/E but the instructions will 
almost certainly be the same as in HOT_REXT.

The code to load a thing is, as Tobias says, in util_thg_lthg_asm. This calls 
the routine th_newth which contains the peculiar instructions, This routine is 
in util_thg_usage_asm.

If you allocate space using sms.alchp you will find that -12 from the start is 
where the ID of the calling job is in the header for the space. Surely it is 
silly to overwrite that!

George

George,
what the code seems to be doing is "patch the common heap header [at the driver linkage offset] to contain an address of the actual thing linkage block." If you look into the thing force remove code, the patched heap header entry is used to find the linkage block (and, thus, the actual thing). This doesn't seem dangerous for me, though, as long as you don't try to handle the heap entry for a thing linkage as "standard heap". One serious omission from the documentation, however, is that the sms.lthg documents say "the linkage block must be allocated in the common heap" which is in my opinion different from "the linkage block must be memory directly returned from mem.alchp" - Because otherwise the assumption we have a common heap header just in front of a linkage block will be wrong. If you think a bit about it, it's clear that this is a must - because this is memory that can be freed by anybody (not only the allocating code)

Cheers
Tobias

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

Reply via email to