HP OpenVMS Systems

ask the wizard
Content starts here

Mailboxes, Quotas and Kernel-Mode C Code?

» close window

The Question is:

Hi there Mr Wizard!
I have a question regarding accessing the general purpose registers from C,
 which I hope you can help me with.
The short version:
I'm running DEC C V6.0-001 on OpenVMS Alpha V7.3.1 and need to read and write
 the general purpose registers.
The documentation talks extensively about the _READ_GPR and _WRITE_GPR, but
 they don't seem to be available on the Alpha (in builtins.h, they're
 specifically excluded with an #ifdefined(__VAX) conditional).
Can you tell me what the alternative is?
The long version:
I need to write a function which provides the caller with the initial buffer
 allocation (total size) for a mailbox.
From what I can determine, the only place this is stored is in ucb$w_iniquo, to
 which I can find no documented interface.
It seems that the best way for me to get the UCB is to call ioc$verifychan to
 get the CCB, and then follow the UCB link from there (ccb$l_ucb).
The documentation for IOC$VERIFYCHAN indicates that it wants the channel number
 in R0, and will return the CCB in R1.
Is there a supported method for accessing these registers from C?   Is there
 some arcane operation involving, perhaps, the linkage pragmas that will enable
 me to call IOC$VERIFYCHAN without poking the registers directly?
Many thanks,
Steve Lock.

The Answer is :

  The asm directives are the usual approach for writing assembler code
  using the C compiler.
  In general, writing assembler in C, and directly reading and writing
  the underlying hardware registers is discouraged.
  The linkage pragma is the usual approach for defining non-standard
  calling interfaces, of course.  Use of a standard calling interface
  such as that of IOC_STD$VERIFYCHAN would be preferable to the use of
  a non-standard calling interface such as that of IOC$VERIFYCHAN, too.
  There are changes to UCB$W_INIQUO and such underway; the field is
  being increased to the longword UCB$L_MB_INIQUO cell.
  The best and most portable and upgradable solution -- kernel-mode
  code can require periodic recompilation and relinking, as OpenVMS
  is upgraded or ECOs are applied -- would be to correctly set and
  to then remember the value when the mailbox is initially created.

answer written or last revised on ( 20-JUL-2004 )

» close window