sys_machdep.c (4013) | sys_machdep.c (6874) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * |
5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * | |
8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. --- 13 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 | 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 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. --- 13 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 |
37 * $Id: sys_machdep.c,v 1.5 1994/08/13 03:49:46 wollman Exp $ | 34 * $Id: sys_machdep.c,v 1.6 1994/10/30 20:23:23 bde Exp $ 35 * |
38 */ 39 40#include <sys/param.h> 41#include <sys/systm.h> | 36 */ 37 38#include <sys/param.h> 39#include <sys/systm.h> |
42#include <sys/ioctl.h> 43#include <sys/file.h> 44#include <sys/time.h> | |
45#include <sys/proc.h> | 40#include <sys/proc.h> |
46#include <sys/uio.h> 47#include <sys/kernel.h> 48#include <sys/mtio.h> 49#include <sys/buf.h> 50#include <sys/trace.h> 51 52#ifdef USER_LDT | |
53#include <sys/user.h> | 41#include <sys/user.h> |
42 |
|
54#include <machine/cpu.h> 55#include <machine/sysarch.h> | 43#include <machine/cpu.h> 44#include <machine/sysarch.h> |
45 |
|
56#include <vm/vm_kern.h> /* for kernel_map */ | 46#include <vm/vm_kern.h> /* for kernel_map */ |
57#endif | |
58 | 47 |
59#ifdef TRACE 60int nvualarm; | 48void set_user_ldt __P((struct pcb *pcb)); 49int i386_get_ldt __P((struct proc *, char *, int *)); 50int i386_set_ldt __P((struct proc *, char *, int *)); |
61 | 51 |
62struct vtrace_args { 63 int request; 64 int value; | 52struct sysarch_args { 53 int op; 54 char *parms; |
65}; 66 | 55}; 56 |
67vtrace(p, uap, retval) | 57int 58sysarch(p, uap, retval) |
68 struct proc *p; | 59 struct proc *p; |
69 register struct vtrace_args *uap; | 60 register struct sysarch_args *uap; |
70 int *retval; 71{ | 61 int *retval; 62{ |
72 int vdoualarm(); | 63 int error = 0; |
73 | 64 |
74 switch (uap->request) { 75 76 case VTR_DISABLE: /* disable a trace point */ 77 case VTR_ENABLE: /* enable a trace point */ 78 if (uap->value < 0 || uap->value >= TR_NFLAGS) 79 return (EINVAL); 80 *retval = traceflags[uap->value]; 81 traceflags[uap->value] = uap->request; | 65 switch(uap->op) { 66#ifdef USER_LDT 67 case I386_GET_LDT: 68 error = i386_get_ldt(p, uap->parms, retval); |
82 break; 83 | 69 break; 70 |
84 case VTR_VALUE: /* return a trace point setting */ 85 if (uap->value < 0 || uap->value >= TR_NFLAGS) 86 return (EINVAL); 87 *retval = traceflags[uap->value]; | 71 case I386_SET_LDT: 72 error = i386_set_ldt(p, uap->parms, retval); |
88 break; | 73 break; |
89 90 case VTR_UALARM: /* set a real-time ualarm, less than 1 min */ 91 if (uap->value <= 0 || uap->value > 60 * hz || nvualarm > 5) 92 return (EINVAL); 93 nvualarm++; 94 timeout(vdoualarm, (caddr_t)p->p_pid, uap->value); | 74#endif 75 default: 76 error = EINVAL; |
95 break; | 77 break; |
96 97 case VTR_STAMP: 98 trace(TR_STAMP, uap->value, p->p_pid); 99 break; | |
100 } | 78 } |
101 return (0); | 79 return(error); |
102} 103 | 80} 81 |
104vdoualarm(arg) 105 int arg; 106{ 107 register struct proc *p; 108 109 p = pfind(arg); 110 if (p) 111 psignal(p, 16); 112 nvualarm--; 113} 114#endif 115 | |
116#ifdef USER_LDT 117void 118set_user_ldt(struct pcb *pcb) 119{ 120 gdt_segs[GUSERLDT_SEL].ssd_base = (unsigned)pcb->pcb_ldt; 121 gdt_segs[GUSERLDT_SEL].ssd_limit = (pcb->pcb_ldt_len * sizeof(union descriptor)) - 1; 122 ssdtosd(&gdt_segs[GUSERLDT_SEL], &gdt[GUSERLDT_SEL].sd); 123 lldt(GSEL(GUSERLDT_SEL, SEL_KPL)); --- 167 unchanged lines hidden (view full) --- 291 *retval = uap->start; 292/* need_resched(); */ 293 } 294 295 splx(s); 296 return(error); 297} 298#endif /* USER_LDT */ | 82#ifdef USER_LDT 83void 84set_user_ldt(struct pcb *pcb) 85{ 86 gdt_segs[GUSERLDT_SEL].ssd_base = (unsigned)pcb->pcb_ldt; 87 gdt_segs[GUSERLDT_SEL].ssd_limit = (pcb->pcb_ldt_len * sizeof(union descriptor)) - 1; 88 ssdtosd(&gdt_segs[GUSERLDT_SEL], &gdt[GUSERLDT_SEL].sd); 89 lldt(GSEL(GUSERLDT_SEL, SEL_KPL)); --- 167 unchanged lines hidden (view full) --- 257 *retval = uap->start; 258/* need_resched(); */ 259 } 260 261 splx(s); 262 return(error); 263} 264#endif /* USER_LDT */ |
299 300struct sysarch_args { 301 int op; 302 char *parms; 303}; 304 305int 306sysarch(p, uap, retval) 307 struct proc *p; 308 register struct sysarch_args *uap; 309 int *retval; 310{ 311 int error = 0; 312 313 switch(uap->op) { 314#ifdef USER_LDT 315 case I386_GET_LDT: 316 error = i386_get_ldt(p, uap->parms, retval); 317 break; 318 319 case I386_SET_LDT: 320 error = i386_set_ldt(p, uap->parms, retval); 321 break; 322#endif 323 default: 324 error = EINVAL; 325 break; 326 } 327 return(error); 328} | |