pal.S revision 66633
1/*-
2 * Copyright (c) 2000 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 *	$FreeBSD: head/sys/ia64/ia64/pal.S 66633 2000-10-04 17:53:03Z dfr $
27 */
28
29#include <machine/asm.h>
30
31BSS(ia64_pal_entry, 8)
32
33/*
34 * struct ia64_pal_result ia64_call_pal(u_int64_t proc,
35 *	u_int64_t arg1, u_int64_t arg2, u_int64_t arg3)
36 */
37ENTRY(ia64_call_pal, 4)
38
39	.regstk	4,5,0,0
40palret	=	loc0
41entry	=	loc1
42rpsave	=	loc2
43pfssave =	loc3
44psrsave	=	loc4
45
46	alloc	pfssave=ar.pfs,4,5,0,0
47	;;
48	mov	rpsave=rp
49
50	movl	entry=ia64_pal_entry
511:	mov	palret=ip		// for return address
52	;;
53	mov	psrsave=psr
54	mov	r28=in0			// procedure number
55	;;
56	ld8	entry=[entry]		// read entry point
57	mov	r29=in1			// copy arguments
58	mov	r30=in2
59	mov	r31=in3
60	;;
61	mov	b1=entry
62	add	palret=2f-1b,palret	// calculate return address
63	;;
64	mov	b0=palret
65	rsm	psr.i			// disable interrupts
66	;;
67	br.cond.sptk b1			// call into firmware
682:	mov	psr.l=psrsave
69	mov	rp=rpsave
70	mov	ar.pfs=pfssave
71	;;
72	srlz.d
73	br.ret.sptk rp
74
75	END(ia64_call_pal)
76