[Info-vax] VAX Macro to C conversion

John Reagan xyzzy1959 at gmail.com
Mon Jul 22 12:27:46 EDT 2019


On Sunday, July 21, 2019 at 7:19:36 PM UTC-4, Simon Clubley wrote:
> On 2019-07-21, VAXman-  @SendSpamHere.ORG <VAXman- at SendSpamHere.ORG> wrote:
> > In article <qh1l3i$7t1$1 at dont-email.me>, Simon Clubley <clubley at remove_me.eisner.decus.org-Earth.UFP> writes:
> >>
> >>Also, will the Basic RTL work in _any_ of the inner modes ?
> >
> > Why?  Does the C RTL? ;)
> >
> 
> $ search sys$examples:lrdriver.c memcpy
>        memcpy (sys_datap, qio_bufp, qio_buflen);
> $
> 
> (And yes, I know it's a special kernel mode CRTL, not the usual
> user mode one. :-))
> 
> However, C is unique among the higher level languages in that it
> doesn't actually really _need_ a standard RTL for the actual language
> features (as opposed to library functions) in order to create
> functioning code.
> 

The kernel-mode CRTL is:

- A very reduced subset of the CRTL's entry points (no malloc, fopen, getenv, etc)
- It is in object form and is linked directly into the kernel.
- Is conditionalized to avoid things like "setting errno", locale support, threading awareness, etc
- Doesn't allocate memory

There is also a copy of most of LIBOTS in the kernel (OTS$MOVE, etc.) but since those routines are low level, straight line code, the versions linked into the kernel are the same ones that you'll find in STARLET.OLB and in LIBOTS.EXE

On the opposite side with BASIC, the more abstract string types end up calling the BASIC RTL, passing around CLASS_D descriptors, calling all sorts of STR$ routines which then in turn want to allocate heap memory for string operations.  As mentioned before, you don't want to allocate heap from inner mode.  In the BEST case, you'll end up with a krkw (kernel read/kernel write) page in the middle of your LIB$GET_VM's lookaside lists which will give you a nice ACCVIO if you get that address returned to you in user-mode by a future LIB$GET_VM call.  I won't even talk about BASIC's addiction to walking up the stack to check on BASIC callers...



More information about the Info-vax mailing list