[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

625.0. "Hacking CHMS" by JON::MORONEY (Question Authority (and the Authorities will question you)) Tue Dec 08 1987 12:01

Does anyone know how VMS (actually DCL) uses the VAX CHMS (change mode to
supervisor) instruction?  Is it documented anywhere?

If not, has anyone hacked at trying this instruction?  I played with it
a little while ago with limited success.  What I found so far:

Function codes 1-16 seem to be the only ones valid.  The system doesn't
seem to attempt to verify parameters very hard, hence I get lots of access
violations and sometimes the functions write over random portions of the
address space.

I've found routines that do an exit, enable/disable ^Y, and SPAWN.  Some others
I have an idea what they do from their return values but haven't been able to
get them to work.

-Mike
T.RTitleUserPersonal
Name
DateLines
625.1PASTIS::MONAHANI am not a free number, I am a telephone boxTue Dec 08 1987 19:372
    	I have looked a the fiche for it. What is the problem? Some of the
    calls define DCL symbols.
625.2Nothing important, just playingJON::MORONEYQuestion Authority (and the Authorities will question you)Tue Dec 08 1987 20:5911
No problem, I was just curious to whether one could call any useful DCL
features from a program, so I looked for them, knowing they'd probably use
CHMS. Since I didn't find anything besides a few system services and rtl
routines, none of which seemed to use CHMS, I wondered what CHMS did.

Since it seemed to be undocumented, it was a candidate for playing with (after
all, this is the HACKERS conference), and I was simply curious to whether anyone
else played with this or could do nifty DCL tricks from a program by using an
undocumented call.

-Mike
625.3PSW::WINALSKIPaul S. WinalskiTue Dec 15 1987 20:2915
The CHMS instruction is used for requesting certain services from the command
language interpreter running in supervisor mode.  The functions that I know
it can perform for you are defining a supervisor-mode logical name, defining
a DCL symbol, reading a DCL symbol, deleting a supervisor-mode logical name,
deleting a DCL symbol, SPAWN, ATTACH, PAUSE, CHAIN to another program, CHAIN
to a DCL command.  For each of these functions, there is a supported,
documented RTL routine, e.g., LIB$SET_LOGICAL, LIB$SET_SYMBOL, LIB$GET_SYMBOL, 
LIB$DELETE_LOGICAL, LIB$DELETE_SYMBOL, LIB$SPAWN, LIB$ATTACH, LIB$PAUSE,
LIB$RUN_PROGRAM, LIB$DO_COMMAND.

The internal, undocumented interface to these functions is very baroque and
has been known to change from release to release.  It's not worth playing with
it, given that there are documented, supported interfaces to the same functions.

--PSW
625.4Ah, well..MDVAX3::COARMy hero? Vax Headroom, of course!Thu Dec 17 1987 22:007
    Unfortunately, one that is needed that isn't there is
    
    	LIB$SET_PROMPT ([new-prompt.rt.d] [, old-prompt.wt.d])
    
    Maybe in the SUMR?  (Still-Unannounced Major Release)  Or the summer?
    
    #ken	:-)}
625.5JON::MORONEYQuestion Authority (and the Authorities will question you)Fri Dec 18 1987 02:0315
re .3:

I previously traced several of those routines, and they all seem to call CHMK
(SYS$foo) rather than CHMS.  In fact that's what started my query, I accidently
started tracing one of the LIB$ routines with the debugger (set step into) that
I would have guessed would use a CHMS, yet it did a CHMK instead.  I wondered
what CHMS was used for,... 

re .4:

I got one of the CHMS calls to return a bunch of stuff, including the prompt.
Don't remember which one it was at the moment.  Someday I'll convince someone
to let me look at the sources and find out what the calls do.

-Mike
625.6does too issue CHMSPSW::WINALSKIPaul S. WinalskiSun Dec 20 1987 18:4320
RE: .5

Last time I looked, they all wind up calling SYS$CLI.  This routine in turn
twiddles a bunch of stuff and then does a CHMS with a particular code.  I
just stepped all the way through the BLISS statement:

	lib$set_symbol(%ASCID'FOO', %ASCID'1', %REF(1))

and under VMS V4.7, at least, it eventually winds up doing a:

	CHMS       B^01(R9)

instruction at address 7FF1C25B in P1 space.

Note that not all of the SYS$xxx routines wind up invoking CHMK.  SYS$OPEN,
SYS$CLOSE, and all the other RMS services, for example, do a CHME.  Several
of the system services (most notably SYS$GETMSG, I think) operate mode-of-the-
caller and don't issue a CHMx instruction at all.  SYS$CLI does a CHMS.

--PSW