ILC between XPLINK and Assembler

The processing of ILC calls between Language Environment-conforming assembler and XPLINK will be identical to COBOL and PL/I.

Since the assembler programmer has direct control over the format of the parameter list, it can be constructed as either a "C-style" parameter list, or as an OS linkage parameter list. In the latter case, the XPLINK program must specify #pragma linkage(...,OS) at its interface with the assembler program.

The format of an OS linkage parameter list, as defined by an XPLINK function, is that the address of the first parameter will be passed in register 1, the address of the second parameter will be passed in register 2, the address of the third parameter will be passed in register 3, and any remaining parameters will be passed by placing their address in the caller's argument area. The high-order bit of the last parameter will be turned on. Note that this is different from the expected "R1 points to a list of addresses", but has better performance characteristics and allows the glue routine to issue the instruction STM R1,R3 to build a complete OS linkage parameter list. It can then set R1 to the address of this list for a call to an OS linkage routine.

There are three flavors of OS linkage that can be used by an XPLINK program:
  • OS_UPSTACK

    In general, parts compiled XPLINK cannot be combined with parts compiled NOXPLINK in the same program object. One exception to this rule is OS linkage routines that are defined in an XPLINK-compiled caller as OS_UPSTACK. In this case, the XPLINK compiler will generate a call to glue code that performs a transition from the XPLINK caller to the OS linkage callee. The callee will get control with OS linkage conventions (parameter list and registers) and running on a Language Environment-conforming upward-growing stack.

    From XPLINK C code, specified as one of:
    • #pragma linkage(function_name,OS_UPSTACK)
    • #pragma linkage(function_name,OS) with the OSCALL(UPSTACK) compiler option
    From XPLINK C++ code, specified as one of:
    • extern "OS_UPSTACK" function_prototype
    • extern "OS" function_prototype with the OSCALL(UPSTACK) compiler option (this is the default)
  • OS_NOSTACK

    The other exception allowing XPLINK and NOXPLINK parts in the same program object is that XPLINK-compiled routines can call OS linkage routines defined as OS_NOSTACK. In this case, the XPLINK compiler will generate an OS linkage style call (parameter list and registers) directly to the callee. There is no intervening glue code to provide a stack swap. Instead, a 72-byte savearea is provided. This provides much better performance characteristics over OS_UPSTACK calls when the called routine does not require an Language Environment-conforming stack.

    From XPLINK C code, specified as one of:
    • #pragma linkage(function_name,OS_NOSTACK)
    • #pragma linkage(function_name,OS) with the OSCALL(NOSTACK) compiler option (this is the default)
    From XPLINK C++ code, specified as one of:
    • extern "OS_NOSTACK" function_prototype
    • extern "OS" function_prototype with the OSCALL(NOSTACK) compiler option
  • OS_DOWNSTACK

    This defines calls between XPLINK-compiled routines that pass an OS linkage "by reference" parameter list. XPLINK calling conventions are used.

    From XPLINK C code, specified as one of:
    • #pragma linkage(function_name,OS_DOWNSTACK)
    • #pragma linkage(function_name,OS) with the OSCALL(DOWNSTACK) compiler option
    From XPLINK C++ code, specified as one of:
    • extern "OS_DOWNSTACK" function_prototype
    • extern "OS" function_prototype with the OSCALL(DOWNSTACK) compiler option