Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

PSECT on a page boundary

Go to solution
Kris Clippeleyr
Honored Contributor

PSECT on a page boundary

Hi All,

Currently I'm struggling with the following problem:

I have a little routine that executes in kernel mode at elevated IPL. The routine was originally written in C (generated a psect of 800 or so bytes). In order to prevent pagefaults I have to lock the routine in the working set. So far, so good.
Unfortunately, my "locking" routine only locks one page (8K).
As it happened the other day, the psect started off in one page and ended in the next, leading to the dreaded PGFIPLHI crash.
At first, I searched the C docs, but could not find how to tell the C compiler to align a code psect on a specific boundary (lots of stuff on data though).
Does this "feature" exist? And how is it activated?
Failing to find a solution in C, I rewrote the routine in MACRO-32, and gave the code psect the alignment attribute PAGE. A bit to my surprise, the psect was aligned on a 512-byte boundary. If you think about it, only natural for a VAX (page=512 bytes). But I thought (foolish maybe), on an Alpha PAGE=8K.
Any ideas on how I can put my psects on a boundary larger than 512-bytes?
And euh, rewriting the "locking" routine would break too much of the already existing code.
Furthermore, the code has to run on the 3 architectures.

Any help greatly appreciated.


I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Hein van den Heuvel
Honored Contributor

Re: PSECT on a page boundary

You mention 3 architectures.
On VAX you need to lock down code & data.
On Alpha code, data and linages... still doable.
On IA-64 (ELF Image) you would need to worry about code, data, short data, Linker generated code (jumps), ... too tricky.
So for iVMS you want to look at using lib$lock_image(va) / lib$unlock_image(va).
This locks the whole image so you want to look at placing high IPL code into a separate shareable image.
This service also exists on Alpha (recent versions).

[I learned all this during the OpenVMS bootkamp this morning!]

In macro PAGE defaults to 512, but... why not force the issue and specuify a number? (13 for 8KB).

The Linker manual suggest that specifying 'page' would give you 64KB on Alpha. Maybe you want to all a PSECT line to your LINKER OPTION file to influence matters?


PAGE = "Alignment on the default target page size, which is 64 KB for Alpha linking and 512 bytes for VAX linking"

Maybe you code psect got collected with other code psects in a way not intended? You makde and studied a link map did you? Maybe attach one to a future reply if you get desperate?


Kris Clippeleyr
Honored Contributor

Re: PSECT on a page boundary


Thanx for the pointers.
On VAX there was actually no problem; the code there is only 194 bytes in size (fits easily in a 512-byte page).
The code on Alpha is larger (588 bytes); so that presented a problem if aligned on a 512-byte boundary. But, your tip on specifying a number (13) instead of a reserved word (PAGE) for the psect alignment did the trick on Alpha.
I think I was a bit tired last night when reading thru the manuals (in the VAX Macro manual is mentioned a number between 1 and 9). Didn't think a larger number would work, but it does.

Btw, for Itanium I see no problem since I've read in the release notes that, and I quote
"On OpenVMS I64 systems, $LKWSET has been modified to avoid the problems encountered on OpenVMS Alpha systems by locking the entire image referenced by the parameters."

Thanx again, and problem solved.


I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Kris Clippeleyr
Honored Contributor

Re: PSECT on a page boundary

See remarks above.
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...