	.title	evxr64
; do REI. One parameter given, namely the PSL desired.
; Expected to be called from kernel
;
; Uses a nonstandard call internally to get the address on the
; stack right. Assumes the Alpha Architecture manual desc. of
; what PAL REI code does is accurate.
evax=1
alpha=1
bigpage=1
addressbits=32
	.library "sys$library:lib.mlb"
	driver_code
evxr64::
	addq	sp,r31,r18	;to check initial sp
	subq	sp,#64,sp	;need 8 cells
	stq	r16,56(sp)	;save user's psl
	stq	r2,00(sp)
	stq	r3,08(sp)
	stq	r4,16(sp)
	stq	r5,24(sp)
	stq	r6,32(sp)
	stq	r7,40(sp)	;preserve r2-r7
;48(sp) needs to be the return pc
	.begin_exact
	bsr	r17,1$		;address of 1$ instruction to r17
1$:	imb
	addq	r17,#<2$-1$>,r17	;get address of 2$
	stq	r17,48(sp)
	imb		; pal code rei doesn't do barrier so do here
	rei	;via palcode
2$:	; should get here with caller's psl
	imb
	bis	r31,r31,r31	;ensure we can break somewhere
	.end_exact
	jmp	r31,(r26)	; return to caller.
	.end
