Commit | Line | Data |
---|---|---|
2a342ed5 AG |
1 | /* |
2 | * Copyright (C) 2010 SUSE Linux Products GmbH. All rights reserved. | |
3 | * | |
4 | * Authors: | |
5 | * Alexander Graf <agraf@suse.de> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License, version 2, as | |
9 | * published by the Free Software Foundation. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | */ | |
20 | ||
21 | #include <linux/kvm_host.h> | |
22 | #include <linux/init.h> | |
23 | #include <linux/kvm_para.h> | |
24 | #include <linux/slab.h> | |
25 | #include <linux/of.h> | |
26 | ||
27 | #include <asm/reg.h> | |
28 | #include <asm/kvm_ppc.h> | |
29 | #include <asm/sections.h> | |
30 | #include <asm/cacheflush.h> | |
31 | #include <asm/disassemble.h> | |
32 | ||
33 | unsigned long kvm_hypercall(unsigned long *in, | |
34 | unsigned long *out, | |
35 | unsigned long nr) | |
36 | { | |
37 | unsigned long register r0 asm("r0"); | |
38 | unsigned long register r3 asm("r3") = in[0]; | |
39 | unsigned long register r4 asm("r4") = in[1]; | |
40 | unsigned long register r5 asm("r5") = in[2]; | |
41 | unsigned long register r6 asm("r6") = in[3]; | |
42 | unsigned long register r7 asm("r7") = in[4]; | |
43 | unsigned long register r8 asm("r8") = in[5]; | |
44 | unsigned long register r9 asm("r9") = in[6]; | |
45 | unsigned long register r10 asm("r10") = in[7]; | |
46 | unsigned long register r11 asm("r11") = nr; | |
47 | unsigned long register r12 asm("r12"); | |
48 | ||
49 | asm volatile("bl kvm_hypercall_start" | |
50 | : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6), | |
51 | "=r"(r7), "=r"(r8), "=r"(r9), "=r"(r10), "=r"(r11), | |
52 | "=r"(r12) | |
53 | : "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "r"(r8), | |
54 | "r"(r9), "r"(r10), "r"(r11) | |
55 | : "memory", "cc", "xer", "ctr", "lr"); | |
56 | ||
57 | out[0] = r4; | |
58 | out[1] = r5; | |
59 | out[2] = r6; | |
60 | out[3] = r7; | |
61 | out[4] = r8; | |
62 | out[5] = r9; | |
63 | out[6] = r10; | |
64 | out[7] = r11; | |
65 | ||
66 | return r3; | |
67 | } | |
68 | EXPORT_SYMBOL_GPL(kvm_hypercall); |