Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site hcrvx1.UUCP
Path: utzoo!hcr!hcrvx1!urip
From: urip@hcrvx1.UUCP (Uri Postavsky)
Newsgroups: comp.sys.nsc.32k
Subject: Re: cxp/rxp instructions
Message-ID: <1514@hcrvx1.UUCP>
Date: Thu, 16-Jul-87 11:28:24 EDT
Article-I.D.: hcrvx1.1514
Posted: Thu Jul 16 11:28:24 1987
Date-Received: Sat, 18-Jul-87 10:23:58 EDT
References: <10742@hi.UUCP>
Reply-To: urip@hcrvx1.UUCP (Uri Postavsky)
Organization: HCR Corporation, Toronto
Lines: 47
Keywords: rxp/cxp instructions
Summary: 

In article <10742@hi.UUCP> cyrus@hi.UUCP (Tait Cyrus) writes:
>
>1) What good are the cxp/rxp instructions?
>2) Why can't the "standard" jsr/ret instructions be used?
>3) What advantages are there for going through a jump table instead
>   of jumping directly?
>

As was mentioned in previous articles, the CXP/RXP are good mainly
for shared libraries and dynamic linking. In the context of UNIX
they are no better than BSR/RET, just slower. The same thing is
true for referencing external variables - the EXT addressing mode
goes through the link table and is slower than the other memory
addressing modes.

*BUT* you cannot just go ahead and replace all the CXP/RXP with BSR/RET.
It depends whether your assembler and linker support BSR across modules. 
In order to support these, the assembler has to generate PC-relative 
addressing mode for all external names (for variables SB-relative is better),
and to generate relocation information to the linker. The linker has to 
"patch" the external references (both procedures and variables) in the
code of each module with the correct memory addresses known only at link time. 
The locations to patch are indicated in the relocation information.

When external references are implemented by the EXT addressing mode only 
(i.e. CXP/RXP), all the references of a module are done through its link
table, so the linker needs only fill this table rather than patch the 
object code itself. Correspondingly, the assembler does not need to
generate relocation information.

Assembler that does not generate relocation information and linker that
can only fill link tables cannot support BSR across modules!!!

If the assembler and linker you have are from National, you can tell which
kind of assembler you have by the directives for external names.

The old tools use the CXP/RXP and the directives for external names are:
.export/.import for variables and .exportp/.importp for procedures.
If you have these tools, you cannot use BSR across modules.

The new tools use BSR/RET and the directive for external names is: .global.


-- 
Uri Postavsky (  ...{utzoo, utcsri}!hcr!urip )
	  at HCR, Toronto.
(formerly at National Semiconductor Tel Aviv).