sys_machdep.c (246e7a2b6494cd991b08ac669ed761ecea0cc98c) sys_machdep.c (824fc46089a4b86003cef4fcbfa8493591e87719)
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 91 unchanged lines hidden (view full) ---

100 struct thread *td;
101 register struct sysarch_args *uap;
102{
103 int error;
104 union descriptor *lp;
105 union {
106 struct i386_ldt_args largs;
107 struct i386_ioperm_args iargs;
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 91 unchanged lines hidden (view full) ---

100 struct thread *td;
101 register struct sysarch_args *uap;
102{
103 int error;
104 union descriptor *lp;
105 union {
106 struct i386_ldt_args largs;
107 struct i386_ioperm_args iargs;
108 struct i386_get_xfpustate xfpu;
108 } kargs;
109 uint32_t base;
110 struct segment_descriptor sd, *sdp;
111
112 AUDIT_ARG_CMD(uap->op);
113
114#ifdef CAPABILITY_MODE
115 /*

--- 5 unchanged lines hidden (view full) ---

121 switch (uap->op) {
122 case I386_GET_LDT:
123 case I386_SET_LDT:
124 case I386_GET_IOPERM:
125 case I386_GET_FSBASE:
126 case I386_SET_FSBASE:
127 case I386_GET_GSBASE:
128 case I386_SET_GSBASE:
109 } kargs;
110 uint32_t base;
111 struct segment_descriptor sd, *sdp;
112
113 AUDIT_ARG_CMD(uap->op);
114
115#ifdef CAPABILITY_MODE
116 /*

--- 5 unchanged lines hidden (view full) ---

122 switch (uap->op) {
123 case I386_GET_LDT:
124 case I386_SET_LDT:
125 case I386_GET_IOPERM:
126 case I386_GET_FSBASE:
127 case I386_SET_FSBASE:
128 case I386_GET_GSBASE:
129 case I386_SET_GSBASE:
130 case I386_GET_XFPUSTATE:
129 break;
130
131 case I386_SET_IOPERM:
132 default:
133#ifdef KTRACE
134 if (KTRPOINT(td, KTR_CAPFAIL))
135 ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
136#endif

--- 12 unchanged lines hidden (view full) ---

149 case I386_GET_LDT:
150 case I386_SET_LDT:
151 if ((error = copyin(uap->parms, &kargs.largs,
152 sizeof(struct i386_ldt_args))) != 0)
153 return (error);
154 if (kargs.largs.num > MAX_LD || kargs.largs.num <= 0)
155 return (EINVAL);
156 break;
131 break;
132
133 case I386_SET_IOPERM:
134 default:
135#ifdef KTRACE
136 if (KTRPOINT(td, KTR_CAPFAIL))
137 ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
138#endif

--- 12 unchanged lines hidden (view full) ---

151 case I386_GET_LDT:
152 case I386_SET_LDT:
153 if ((error = copyin(uap->parms, &kargs.largs,
154 sizeof(struct i386_ldt_args))) != 0)
155 return (error);
156 if (kargs.largs.num > MAX_LD || kargs.largs.num <= 0)
157 return (EINVAL);
158 break;
159 case I386_GET_XFPUSTATE:
160 if ((error = copyin(uap->parms, &kargs.xfpu,
161 sizeof(struct i386_get_xfpustate))) != 0)
162 return (error);
163 break;
157 default:
158 break;
159 }
160
161 switch(uap->op) {
162 case I386_GET_LDT:
163 error = i386_get_ldt(td, &kargs.largs);
164 break;

--- 100 unchanged lines hidden (view full) ---

265 *(uint64_t *)&sd);
266#else
267 PCPU_GET(fsgs_gdt)[1] = sd;
268#endif
269 critical_exit();
270 load_gs(GSEL(GUGS_SEL, SEL_UPL));
271 }
272 break;
164 default:
165 break;
166 }
167
168 switch(uap->op) {
169 case I386_GET_LDT:
170 error = i386_get_ldt(td, &kargs.largs);
171 break;

--- 100 unchanged lines hidden (view full) ---

272 *(uint64_t *)&sd);
273#else
274 PCPU_GET(fsgs_gdt)[1] = sd;
275#endif
276 critical_exit();
277 load_gs(GSEL(GUGS_SEL, SEL_UPL));
278 }
279 break;
280 case I386_GET_XFPUSTATE:
281 if (kargs.xfpu.len > cpu_max_ext_state_size -
282 sizeof(union savefpu))
283 return (EINVAL);
284 npxgetregs(td);
285 error = copyout((char *)(get_pcb_user_save_td(td) + 1),
286 kargs.xfpu.addr, kargs.xfpu.len);
287 break;
273 default:
274 error = EINVAL;
275 break;
276 }
277 return (error);
278}
279
280int

--- 601 unchanged lines hidden ---
288 default:
289 error = EINVAL;
290 break;
291 }
292 return (error);
293}
294
295int

--- 601 unchanged lines hidden ---