Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

HP OpenVMS Systems

Ask the Wizard
» 

HP OpenVMS Systems

OpenVMS information

» What's new on our site
» Upcoming events
» Configuration and buying assistance
» Send us your comments

HP OpenVMS systems

» OpenVMS software
» Supported Servers
» OpenVMS virtualization
» OpenVMS solutions and partners
» OpenVMS success stories
» OpenVMS service and support
» OpenVMS resources and information
» OpenVMS documentation
» Education and training

Evolving business value

» Business Systems Evolution
» AlphaServer systems transition planning
» Alpha RetainTrust program

Related links

» HP Integrity servers
» HP Alpha systems
» HP storage
» HP software
» HP products and services
» HP solutions
» HP support
disaster proof
HP Integrity server animation
Content starts here

Ask the Wizard Questions

Lock linkage section

The Question is:

Dear Wizard;

I need to run some privileged code at elevated IPL on my
Alpha.  The VMS Doc set warns the linkage section must be
locked down to prevent a page fault from crashing the
system.  So how do I lock down the linkage section?
I only work in high level languages (no macro).  I am
only concerned with locking down the linkage section.
Locking down an entire process is not an option.

Please help,


The Answer is:

      We think the customer is more interested in figuring out how to locate
    the the linkage section in order to feed the right addresses to $LKWSET
    (shouldn't that be $LCKPAG for elevated IPL?). The customer doesn't
    say what language they're using. Does "&" in C and/or
    %LOC() in FORTRAN return the address of the code or the
    address of the procedure descriptor? In either case you've got to also
    figure out the address of the other.

Assume we want to know the virtual address range of the linkage section for
the world's most famous program:


#include 

int main (void) {

   printf ("hello world\n");

}



I'd start by wasting a bit of memory and add 2 dummy variables:


$ type t.c
#include 

int $$$lnk_dummy;
int ___lnk_dummy;

int main (void) {

   printf ("hello world\n");

}


In C, these variablkes will end up in their own psects that can then be
used in a linker option file to be arranged around the target psect:


$ link/map/full t,sys$input:/opt
psect_attr=$link$,nopic,con,rel,lcl,noshr,noexe,nowrt,novec,mod
psect_attr=$$$lnk_dummy,nopic,con,rel,lcl,noshr,noexe,nowrt,novec,mod
psect_attr=___lnk_dummy,nopic,con,rel,lcl,noshr,noexe,nowrt,novec,mod
collect=linkage_section,-
	$$$lnk_dummy,-
	$link$,-
	___lnk_dummy



The result of this can be validated in the map:

                                            +--------------------------+
                                            ! Program Section Synopsis !
                                            +--------------------------+

Psect Name      Module Name       Base     End           Length            Align                 Attributes
----------      -----------       ----     ---           ------            -----                 ----------

$$$LNK_DUMMY                    00010000 00010003 00000004 (          4.) OCTA  4 NOPIC,CON,REL,GBL,NOSHR,NOEXE,NOWRT,NOVEC,  MOD
                T               00010000 00010003 00000004 (          4.) OCTA  4

$LINK$                          00010010 0001008F 00000080 (        128.) OCTA  4 NOPIC,CON,REL,GBL,NOSHR,NOEXE,NOWRT,NOVEC,  MOD
                T               00010010 0001008F 00000080 (        128.) OCTA  4

___LNK_DUMMY                    00010090 00010093 00000004 (          4.) OCTA  4 NOPIC,CON,REL,GBL,NOSHR,NOEXE,NOWRT,NOVEC,  MOD
                T               00010090 00010093 00000004 (          4.) OCTA  4


We can now use the addresses of $$$lnk_dummy and ___lnk_dummy to locate the
linkage section.  The disadvantage of this is that we cannot locate any
specific pieces of the linkage section that we might want to lock down;
it's an all-or-nothing approach.  However, linkage sections for most images
are reasonably sized and locking down a bit more shouldn't really hurt all
that much.

In all the cases I've ever seen (except where routines get optimized away),
the address of the routine is the linkage section.  Add 8, and that's the code
address.

Are there exceptions that would be generated by HLL's?


 

** About PDF files: The PDF files on this Web site can be read online or printed using Adobe® Acrobat® Reader. If you do not have this software installed on your system, you may download it from the Adobe Web site.
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.