pal.S revision 83905
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 83905 2001-09-24 19:41:16Z dfr $ 27 */ 28 29#include <machine/asm.h> 30 31BSS(ia64_pal_entry, 8) 32 33/* 34 * struct ia64_pal_result ia64_call_pal_static(u_int64_t proc, 35 * u_int64_t arg1, u_int64_t arg2, u_int64_t arg3) 36 */ 37ENTRY(ia64_call_pal_static, 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=@gprel(ia64_pal_entry) 511: mov palret=ip // for return address 52 ;; 53 add entry=entry,gp 54 mov psrsave=psr 55 mov r28=in0 // procedure number 56 ;; 57 ld8 entry=[entry] // read entry point 58 mov r29=in1 // copy arguments 59 mov r30=in2 60 mov r31=in3 61 ;; 62 mov b1=entry 63 add palret=2f-1b,palret // calculate return address 64 ;; 65 mov b0=palret 66 rsm psr.i // disable interrupts 67 ;; 68 br.cond.sptk b1 // call into firmware 692: mov psr.l=psrsave 70 mov rp=rpsave 71 mov ar.pfs=pfssave 72 ;; 73 srlz.d 74 br.ret.sptk rp 75 76END(ia64_call_pal_static) 77 78/* 79 * struct ia64_pal_result ia64_call_pal_stacked(u_int64_t proc, 80 * u_int64_t arg1, u_int64_t arg2, u_int64_t arg3) 81 */ 82ENTRY(ia64_call_pal_stacked, 4) 83 84 .regstk 4,4,4,0 85entry = loc0 86rpsave = loc1 87pfssave = loc2 88psrsave = loc3 89 90 alloc pfssave=ar.pfs,4,4,4,0 91 ;; 92 mov rpsave=rp 93 movl entry=@gprel(ia64_pal_entry) 94 ;; 95 add entry=entry,gp 96 mov psrsave=psr 97 mov r28=in0 // procedure number 98 mov out0=in0 99 ;; 100 ld8 entry=[entry] // read entry point 101 mov out1=in1 // copy arguments 102 mov out2=in2 103 mov out3=in3 104 ;; 105 mov b1=entry 106 ;; 107 rsm psr.i // disable interrupts 108 ;; 109 br.call.sptk.many rp=b1 // call into firmware 1102: mov psr.l=psrsave 111 mov rp=rpsave 112 mov ar.pfs=pfssave 113 ;; 114 srlz.d 115 br.ret.sptk rp 116 117END(ia64_call_pal_stacked) 118