| 132 | #endif |
| 133 | |
| 134 | int |
| 135 | sysarch(struct thread *td, struct sysarch_args *uap) |
| 136 | { |
| 137 | int error; |
| 138 | union descriptor *lp; |
| 139 | union { |
| 140 | struct i386_ldt_args largs; |
| 141 | struct i386_ioperm_args iargs; |
| 142 | struct i386_get_xfpustate xfpu; |
| 143 | } kargs; |
| 144 | uint32_t base; |
| 145 | struct segment_descriptor *sdp; |
| 146 | |
| 147 | AUDIT_ARG_CMD(uap->op); |
| 148 | |
| 149 | #ifdef CAPABILITY_MODE |
| 150 | /* |
| 151 | * When adding new operations, add a new case statement here to |
| 152 | * explicitly indicate whether or not the operation is safe to |
| 153 | * perform in capability mode. |
| 154 | */ |
| 155 | if (IN_CAPABILITY_MODE(td)) { |
| 156 | switch (uap->op) { |
| 157 | case I386_GET_LDT: |
| 158 | case I386_SET_LDT: |
| 159 | case I386_GET_IOPERM: |
| 160 | case I386_GET_FSBASE: |
| 161 | case I386_SET_FSBASE: |
| 162 | case I386_GET_GSBASE: |
| 163 | case I386_SET_GSBASE: |
| 164 | case I386_GET_XFPUSTATE: |
| 165 | break; |
| 166 | |
| 167 | case I386_SET_IOPERM: |
| 168 | default: |
| 169 | #ifdef KTRACE |
| 170 | if (KTRPOINT(td, KTR_CAPFAIL)) |
| 171 | ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL); |
| 172 | #endif |
| 173 | return (ECAPMODE); |
| 174 | } |
| 175 | } |
| 176 | #endif |
| 177 | |
| 178 | switch (uap->op) { |
| 179 | case I386_GET_IOPERM: |
| 180 | case I386_SET_IOPERM: |
| 181 | if ((error = copyin(uap->parms, &kargs.iargs, |
| 182 | sizeof(struct i386_ioperm_args))) != 0) |
| 183 | return (error); |
| 184 | break; |
| 185 | case I386_GET_LDT: |
| 186 | case I386_SET_LDT: |
| 187 | if ((error = copyin(uap->parms, &kargs.largs, |
| 188 | sizeof(struct i386_ldt_args))) != 0) |
| 189 | return (error); |
| 190 | break; |
| 191 | case I386_GET_XFPUSTATE: |
nothing calls this directly
no test coverage detected