[GEM Development] GEM/XM VDI source

Ben A L Jemmett ben.jemmett at ukonline.co.uk
Sun Feb 19 21:51:16 PST 2006


Quoting Ben A L Jemmett <ben.jemmett at ukonline.co.uk>:
> Just going to do a bit more poking around and see if it's getting bumped by
> a word before it enters the routines in GEMSUPER.C or before it completes 
> the return.  Hopefully the notes left in the source will be enough to work 
> out what should be going on.

Right, when GEM returns from supervisor mode it adjusts the supervisor stack
back to the state before it got called -- rather than return;ing out of the C
code, it calls a function (written in assembler) to save the supervisor state
and restore the user stack.  Interesting, although obviously it works.

Now, GEM/XM uses the ADDR_OUT array of the control block for certain calls,
whereas SINGLAPP versions of GEM don't.  Presumably to save space, the SINGLAPP
versions don't even bother copying the array pointer onto the supervisor stack
before calling the function despatcher, which has a different prototype
depending on whether it's in SINGLAPP or MULTIAPP modes.  See where this is going?

Upon return from supervisor mode (the 'supret' routine in GEMDOSIF.A86), the
supervisor stack pointer gets adjusted upwards to effectively eliminate the call
to the function dispatcher.  This obviously requires that the adjustment is
equal to the number of bytes used by the sequence of calls since supervisor mode
was entered, which includes the storage of automatic variables in the xif
routine.  In GEM/XM, this includes the address of ADDR_OUT -- in GEM, it doesn't.

So, the fifth instruction of supret in the available source code is:

        add     sp,10                   ; skip retadd and parms

Make it 12, recompile the AES, and we're away.

[A couple of changes are needed to build the AES from the available sources -- a
GEM30.INP file is needed, and a couple of Ctrl-Zs are missing I think.  I'll zip
up my tree shortly if there's any interest...]

-- 
Regards,
Ben A L Jemmett.
(http://web.ukonline.co.uk/ben.jemmett/, http://www.deltasoft.com/)

----------------------------------------------
This mail sent through http://www.ukonline.net


More information about the gem-dev mailing list