Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * This file contains the code to perform calls to the |
| 3 | * iSeries LPAR hypervisor |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version |
| 8 | * 2 of the License, or (at your option) any later version. |
| 9 | */ |
| 10 | |
| 11 | #include <asm/ppc_asm.h> |
| 12 | #include <asm/processor.h> |
Paul Mackerras | 76f9f87 | 2005-10-10 22:52:26 +1000 | [diff] [blame] | 13 | #include <asm/ptrace.h> /* XXX for STACK_FRAME_OVERHEAD */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
| 15 | .text |
| 16 | |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 17 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | * Hypervisor call |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 19 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | * Invoke the iSeries hypervisor via the System Call instruction |
| 21 | * Parameters are passed to this routine in registers r3 - r10 |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 22 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | * r3 contains the HV function to be called |
| 24 | * r4-r10 contain the operands to the hypervisor function |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | _GLOBAL(HvCall) |
| 29 | _GLOBAL(HvCall0) |
| 30 | _GLOBAL(HvCall1) |
| 31 | _GLOBAL(HvCall2) |
| 32 | _GLOBAL(HvCall3) |
| 33 | _GLOBAL(HvCall4) |
| 34 | _GLOBAL(HvCall5) |
| 35 | _GLOBAL(HvCall6) |
| 36 | _GLOBAL(HvCall7) |
| 37 | |
| 38 | |
| 39 | mfcr r0 |
| 40 | std r0,-8(r1) |
| 41 | stdu r1,-(STACK_FRAME_OVERHEAD+16)(r1) |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* r0 = 0xffffffffffffffff indicates a hypervisor call */ |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | li r0,-1 |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | /* Invoke the hypervisor */ |
| 48 | |
| 49 | sc |
| 50 | |
| 51 | ld r1,0(r1) |
| 52 | ld r0,-8(r1) |
| 53 | mtcrf 0xff,r0 |
| 54 | |
| 55 | /* return to caller, return value in r3 */ |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | blr |
| 58 | |
| 59 | _GLOBAL(HvCall0Ret16) |
| 60 | _GLOBAL(HvCall1Ret16) |
| 61 | _GLOBAL(HvCall2Ret16) |
| 62 | _GLOBAL(HvCall3Ret16) |
| 63 | _GLOBAL(HvCall4Ret16) |
| 64 | _GLOBAL(HvCall5Ret16) |
| 65 | _GLOBAL(HvCall6Ret16) |
| 66 | _GLOBAL(HvCall7Ret16) |
| 67 | |
| 68 | mfcr r0 |
| 69 | std r0,-8(r1) |
| 70 | std r31,-16(r1) |
| 71 | stdu r1,-(STACK_FRAME_OVERHEAD+32)(r1) |
| 72 | |
| 73 | mr r31,r4 |
| 74 | li r0,-1 |
| 75 | mr r4,r5 |
| 76 | mr r5,r6 |
| 77 | mr r6,r7 |
| 78 | mr r7,r8 |
| 79 | mr r8,r9 |
| 80 | mr r9,r10 |
| 81 | |
| 82 | sc |
| 83 | |
| 84 | std r3,0(r31) |
| 85 | std r4,8(r31) |
| 86 | |
| 87 | mr r3,r5 |
| 88 | |
| 89 | ld r1,0(r1) |
| 90 | ld r0,-8(r1) |
| 91 | mtcrf 0xff,r0 |
| 92 | ld r31,-16(r1) |
Stephen Rothwell | 99a2379 | 2005-09-28 00:17:40 +1000 | [diff] [blame] | 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | blr |