1 ============================================== 2 Power Architecture 64-bit Linux system call AB 3 ============================================== 4 5 syscall 6 ======= 7 8 Invocation 9 ---------- 10 The syscall is made with the sc instruction, a 11 continuing at the instruction following the sc 12 13 If PPC_FEATURE2_SCV appears in the AT_HWCAP2 E 14 scv 0 instruction is an alternative that may p 15 with some differences to calling sequence. 16 17 syscall calling sequence\ [1]_ matches the Pow 18 specification C function calling sequence, inc 19 rules, with the following differences. 20 21 .. [1] Some syscalls (typically low-level mana 22 different calling sequences (e.g., rt_s 23 24 Parameters 25 ---------- 26 The system call number is specified in r0. 27 28 There is a maximum of 6 integer parameters to 29 30 Return value 31 ------------ 32 - For the sc instruction, both a value and an 33 cr0.SO is the error condition, and r3 is the 34 clear, the syscall succeeded and r3 is the r 35 the syscall failed and r3 is the error value 36 errno). 37 38 - For the scv 0 instruction, the return value 39 -4095..-1 (i.e., it is >= -MAX_ERRNO (-4095) 40 in which case the error value is the negated 41 42 Stack 43 ----- 44 System calls do not modify the caller's stack 45 stack frame LR and CR save fields are not used 46 47 Register preservation rules 48 --------------------------- 49 Register preservation rules match the ELF ABI 50 differences. 51 52 For the sc instruction, the differences from t 53 54 +--------------+--------------------+--------- 55 | Register | Preservation Rules | Purpose 56 +==============+====================+========= 57 | r0 | Volatile | (System 58 +--------------+--------------------+--------- 59 | r3 | Volatile | (Paramet 60 +--------------+--------------------+--------- 61 | r4-r8 | Volatile | (Paramet 62 +--------------+--------------------+--------- 63 | cr0 | Volatile | (cr0.SO 64 +--------------+--------------------+--------- 65 | cr1, cr5-7 | Nonvolatile | 66 +--------------+--------------------+--------- 67 | lr | Nonvolatile | 68 +--------------+--------------------+--------- 69 70 For the scv 0 instruction, the differences fro 71 72 +--------------+--------------------+--------- 73 | Register | Preservation Rules | Purpose 74 +==============+====================+========= 75 | r0 | Volatile | (System 76 +--------------+--------------------+--------- 77 | r3 | Volatile | (Paramet 78 +--------------+--------------------+--------- 79 | r4-r8 | Volatile | (Paramet 80 +--------------+--------------------+--------- 81 82 All floating point and vector data registers a 83 registers are nonvolatile. 84 85 Transactional Memory 86 -------------------- 87 Syscall behavior can change if the processor i 88 transaction state, and the syscall can affect 89 90 If the processor is in suspended state when a 91 will be performed as normal, and will return a 92 performed in suspended state, so its side effe 93 to the usual transactional memory semantics. A 94 in the transaction being doomed by hardware. 95 96 If the processor is in transactional state whe 97 behavior depends on the presence of PPC_FEATUR 98 auxiliary vector. 99 100 - If present, which is the case for newer kern 101 be performed and the transaction will be doo 102 failure code TM_CAUSE_SYSCALL | TM_CAUSE_PER 103 104 - If not present (older kernels), then the ker 105 transactional state and the syscall will pro 106 suspended state syscall, and will resume the 107 returning to the caller. This case is not we 108 behavior should not be relied upon. 109 110 scv 0 syscalls will always behave as PPC_FEATU 111 112 ptrace 113 ------ 114 When ptracing system calls (PTRACE_SYSCALL), t 115 the system call type that can be used to disti 116 system calls, and the different register conve 117 118 If the value of (pt_regs.trap & 0xfff0) is 0xc 119 performed with the sc instruction, if it is 0x 120 performed with the scv 0 instruction. 121 122 vsyscall 123 ======== 124 125 vsyscall calling sequence matches the syscall 126 following differences. Some vsyscalls may have 127 128 Parameters and return value 129 --------------------------- 130 r0 is not used as an input. The vsyscall is se 131 132 Stack 133 ----- 134 The vsyscall may or may not use the caller's s 135 136 Register preservation rules 137 --------------------------- 138 139 =========== ======== 140 r0 Volatile 141 cr1, cr5-7 Volatile 142 lr Volatile 143 =========== ======== 144 145 Invocation 146 ---------- 147 The vsyscall is performed with a branch-with-l 148 function address. 149 150 Transactional Memory 151 -------------------- 152 vsyscalls will run in the same transactional s 153 may or may not result in the transaction being
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.