| 1 | /* |
|---|
| 2 | * PAL/SAL call delegation |
|---|
| 3 | * |
|---|
| 4 | * Copyright (c) 2004 Li Susie <susie.li@intel.com> |
|---|
| 5 | * Copyright (c) 2005 Yu Ke <ke.yu@intel.com> |
|---|
| 6 | * |
|---|
| 7 | * This program is free software; you can redistribute it and/or modify it |
|---|
| 8 | * under the terms and conditions of the GNU General Public License, |
|---|
| 9 | * version 2, as published by the Free Software Foundation. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 14 | * more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License along with |
|---|
| 17 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 18 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #include <xen/lib.h> |
|---|
| 22 | #include <asm/vcpu.h> |
|---|
| 23 | #include <asm/dom_fw.h> |
|---|
| 24 | #include <asm/pal.h> |
|---|
| 25 | #include <asm/sal.h> |
|---|
| 26 | |
|---|
| 27 | void |
|---|
| 28 | pal_emul(struct vcpu *vcpu) |
|---|
| 29 | { |
|---|
| 30 | u64 gr28, gr29, gr30, gr31; |
|---|
| 31 | struct ia64_pal_retval result; |
|---|
| 32 | |
|---|
| 33 | vcpu_get_gr_nat(vcpu, 28, &gr28); //bank1 |
|---|
| 34 | |
|---|
| 35 | /* FIXME: works only for static calling convention ? */ |
|---|
| 36 | vcpu_get_gr_nat(vcpu, 29, &gr29); |
|---|
| 37 | vcpu_get_gr_nat(vcpu, 30, &gr30); |
|---|
| 38 | vcpu_get_gr_nat(vcpu, 31, &gr31); |
|---|
| 39 | |
|---|
| 40 | perfc_incr(vmx_pal_emul); |
|---|
| 41 | result = xen_pal_emulator(gr28, gr29, gr30, gr31); |
|---|
| 42 | |
|---|
| 43 | vcpu_set_gr(vcpu, 8, result.status, 0); |
|---|
| 44 | vcpu_set_gr(vcpu, 9, result.v0, 0); |
|---|
| 45 | vcpu_set_gr(vcpu, 10, result.v1, 0); |
|---|
| 46 | vcpu_set_gr(vcpu, 11, result.v2, 0); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | void |
|---|
| 50 | sal_emul(struct vcpu *v) |
|---|
| 51 | { |
|---|
| 52 | struct sal_ret_values result; |
|---|
| 53 | result = sal_emulator(vcpu_get_gr(v, 32), vcpu_get_gr(v, 33), |
|---|
| 54 | vcpu_get_gr(v, 34), vcpu_get_gr(v, 35), |
|---|
| 55 | vcpu_get_gr(v, 36), vcpu_get_gr(v, 37), |
|---|
| 56 | vcpu_get_gr(v, 38), vcpu_get_gr(v, 39)); |
|---|
| 57 | |
|---|
| 58 | vcpu_set_gr(v, 8, result.r8, 0); |
|---|
| 59 | vcpu_set_gr(v, 9, result.r9, 0); |
|---|
| 60 | vcpu_set_gr(v, 10, result.r10, 0); |
|---|
| 61 | vcpu_set_gr(v, 11, result.r11, 0); |
|---|
| 62 | } |
|---|