From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 18-MAY-1993 09:42:34.58
To:	EVERHART
CC:	
Subj:	MACRO-32 problem on Alpha

X-Newsgroups: comp.os.vms,vmsnet.alpha
Subject: MACRO-32 problem on Alpha
Message-ID: <1993May18.085213.1@ratty.mits.com.au>
From: lewis@ratty.mits.com.au
Date: 18 May 93 08:52:12 +1000
Organization: MITS
Nntp-Posting-Host: ratty
Nntp-Posting-User: lewis
Lines: 74
To: Info-VAX@KL.SRI.COM
X-Gateway-Source-Info: USENET

Hi, I'm having trouble porting some of our applications (written in
Macro-32 and C) to the Alpha.

The problem is in the Macro-32 code (couldn't you guess), where in quite a
few places, the opcode "PUSHAL	#const" instruction has been used.  This is
useful for example in LIB$GET_VM for pushing the requested size of the
block to allocate.

Although this works fine on the VAX, it doesn't compile correctly to
Macro-64 code (using OpenVMS/AXP V1.0) and in effect turns out to be a
"PUSHL	#const" whose effect is obviously quite different from the desired
effect.

If anybody knows if this has been fixed for OpenVMS/AXP V1.5, please drop
me some mail to say so, otherwise please consider the following macro.

This purpose of the following macro is to try to temporarily get around the
PUSHAL # problem and avoid changing every occurence in our source files.
(Some of the instances are not too easy to find, as they are embedded in
macros.)

;----

	.SAVE_PSECT
	.PSECT	PUSHA_DATA,RD,NOWRT,NOEXE,LONG	; Set up PSECT char.
	.RESTORE_PSECT

	.MACRO	PUSHAL SRC		; Define macro for PUSHAL
	.NTYPE	AMODE,SRC		; Get addressing mode

POS = %LOCATE(<#>, SRC) + 1		; Find # char. in argument
LEN = %LENGTH(SRC) - POS		; Get length of imm. argument

	.IF EQ <AMODE - ^X1F>		; Immediate PUSHAL?

	.SAVE_PSECT			; Immediate so save PSECT
	.PSECT	PUSHA_DATA		; Put data in separate PSECT
10$:	.LONG	%EXTRACT(POS, LEN, SRC)	; Store data
	.RESTORE_PSECT			; Restore original PSECT
;
; Now the problem with this macro.
;
	PUSHAL	10$			; Push address of data item

	.MEXIT
	.ENDC

	PUSHAL	SRC			; Not an immediate PUSHAL

	.ENDM

;-----

As you can see, this macro simply traps out the immediate mode PUSHAL
instruction and achieves the same result by storing the data, then pushing
the address of that data.  The obvious problem is that this macro is going
to be recursive.

Somehow I need a way to disable the recursiveness of this macro, so that
the compiler actually uses a PUSHAL instruction.  BTW, a MOVAL #const,-(SP)
is also out of the question, since it also has the same problem as
"PUSHAL	#" and needs to be redefined by a macro.

If anyone can think of a solution to this problem (or another way around
it), I would be most grateful (as it would save a lot of stuffing about).

Thanks.

-- 
David Lewis, MITS Limited.

Internet:	lewis@ratty.mits.com.au
Phone:		+61 3 613 9415		Fax:	    +61 3 613 9550
"No call alligator long mouth till you pass him." - Jamaican Proverb.

