diff options
author | luoqi <luoqi@FreeBSD.org> | 1999-09-02 20:59:50 +0000 |
---|---|---|
committer | luoqi <luoqi@FreeBSD.org> | 1999-09-02 20:59:50 +0000 |
commit | ed22cebc5fb59a4f9d771db8dbb3db36cf23d484 (patch) | |
tree | c624b9e1201ebf0c623b641876b81293fa919fe2 /sys | |
parent | f037ce228f961f3d4703a9e7c2aa5f6f63a2aed8 (diff) | |
download | FreeBSD-src-ed22cebc5fb59a4f9d771db8dbb3db36cf23d484.zip FreeBSD-src-ed22cebc5fb59a4f9d771db8dbb3db36cf23d484.tar.gz |
Some reorganization of sysarch() interface:
1. Move definitions of struct i386_*_args to the header file sysarch.h,
since they are part of the sysarch API. struct i386_get_ldt_args and
i386_set_ldt_args were identical, therefore make them into one
struct i386_ldt_args. Libc should use these definitions as well.
2. Return a more sensible EOPNOTSUPP for unknown operations.
Reviewed by: marcel
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/sys_machdep.c | 41 | ||||
-rw-r--r-- | sys/amd64/include/sysarch.h | 17 | ||||
-rw-r--r-- | sys/i386/i386/sys_machdep.c | 41 | ||||
-rw-r--r-- | sys/i386/i386/vm86.c | 1 | ||||
-rw-r--r-- | sys/i386/include/sysarch.h | 17 | ||||
-rw-r--r-- | sys/i386/include/vm86.h | 5 |
6 files changed, 55 insertions, 67 deletions
diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c index 0f5930c..54f63ca 100644 --- a/sys/amd64/amd64/sys_machdep.c +++ b/sys/amd64/amd64/sys_machdep.c @@ -108,7 +108,7 @@ sysarch(p, uap) error = vm86_sysarch(p, uap->parms); break; default: - error = EINVAL; + error = EOPNOTSUPP; break; } return (error); @@ -163,12 +163,6 @@ i386_extend_pcb(struct proc *p) return 0; } -struct i386_ioperm_args { - u_int start; - u_int length; - int enable; -}; - static int i386_set_ioperm(p, args) struct proc *p; @@ -265,12 +259,6 @@ set_user_ldt(struct pcb *pcb) currentldt = GSEL(GUSERLDT_SEL, SEL_KPL); } -struct i386_get_ldt_args { - int start; - union descriptor *desc; - int num; -}; - static int i386_get_ldt(p, args) struct proc *p; @@ -281,15 +269,14 @@ i386_get_ldt(p, args) int nldt, num; union descriptor *lp; int s; - struct i386_get_ldt_args ua; - struct i386_get_ldt_args *uap = &ua; + struct i386_ldt_args ua, *uap = &ua; - if ((error = copyin(args, uap, sizeof(struct i386_get_ldt_args))) < 0) + if ((error = copyin(args, uap, sizeof(struct i386_ldt_args))) < 0) return(error); #ifdef DEBUG printf("i386_get_ldt: start=%d num=%d descs=%p\n", - uap->start, uap->num, (void *)uap->desc); + uap->start, uap->num, (void *)uap->descs); #endif /* verify range of LDTs exist */ @@ -312,7 +299,7 @@ i386_get_ldt(p, args) return(EINVAL); } - error = copyout(lp, uap->desc, num * sizeof(union descriptor)); + error = copyout(lp, uap->descs, num * sizeof(union descriptor)); if (!error) p->p_retval[0] = num; @@ -320,12 +307,6 @@ i386_get_ldt(p, args) return(error); } -struct i386_set_ldt_args { - int start; - union descriptor *desc; - int num; -}; - static int i386_set_ldt(p, args) struct proc *p; @@ -335,16 +316,14 @@ i386_set_ldt(p, args) int largest_ld; struct pcb *pcb = &p->p_addr->u_pcb; int s; - struct i386_set_ldt_args ua, *uap; + struct i386_ldt_args ua, *uap = &ua; - if ((error = copyin(args, &ua, sizeof(struct i386_set_ldt_args))) < 0) + if ((error = copyin(args, uap, sizeof(struct i386_ldt_args))) < 0) return(error); - uap = &ua; - #ifdef DEBUG printf("i386_set_ldt: start=%d num=%d descs=%p\n", - uap->start, uap->num, (void *)uap->desc); + uap->start, uap->num, (void *)uap->descs); #endif /* verify range of descriptors to modify */ @@ -381,7 +360,7 @@ i386_set_ldt(p, args) /* Check descriptors for access violations */ for (i = 0, n = uap->start; i < uap->num; i++, n++) { union descriptor desc, *dp; - dp = &uap->desc[i]; + dp = &uap->descs[i]; error = copyin(dp, &desc, sizeof(union descriptor)); if (error) return(error); @@ -446,7 +425,7 @@ i386_set_ldt(p, args) s = splhigh(); /* Fill in range */ - error = copyin(uap->desc, + error = copyin(uap->descs, &((union descriptor *)(pcb->pcb_ldt))[uap->start], uap->num * sizeof(union descriptor)); if (!error) diff --git a/sys/amd64/include/sysarch.h b/sys/amd64/include/sysarch.h index 009c781..5ea3ee6 100644 --- a/sys/amd64/include/sysarch.h +++ b/sys/amd64/include/sysarch.h @@ -47,6 +47,23 @@ /* xxxxx */ #define I386_VM86 6 +struct i386_ldt_args { + int start; + union descriptor *descs; + int num; +}; + +struct i386_ioperm_args { + unsigned int start; + unsigned int length; + int enable; +}; + +struct i386_vm86_args { + int sub_op; /* sub-operation to perform */ + char *sub_args; /* args */ +}; + #ifndef KERNEL #include <sys/cdefs.h> diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 0f5930c..54f63ca 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -108,7 +108,7 @@ sysarch(p, uap) error = vm86_sysarch(p, uap->parms); break; default: - error = EINVAL; + error = EOPNOTSUPP; break; } return (error); @@ -163,12 +163,6 @@ i386_extend_pcb(struct proc *p) return 0; } -struct i386_ioperm_args { - u_int start; - u_int length; - int enable; -}; - static int i386_set_ioperm(p, args) struct proc *p; @@ -265,12 +259,6 @@ set_user_ldt(struct pcb *pcb) currentldt = GSEL(GUSERLDT_SEL, SEL_KPL); } -struct i386_get_ldt_args { - int start; - union descriptor *desc; - int num; -}; - static int i386_get_ldt(p, args) struct proc *p; @@ -281,15 +269,14 @@ i386_get_ldt(p, args) int nldt, num; union descriptor *lp; int s; - struct i386_get_ldt_args ua; - struct i386_get_ldt_args *uap = &ua; + struct i386_ldt_args ua, *uap = &ua; - if ((error = copyin(args, uap, sizeof(struct i386_get_ldt_args))) < 0) + if ((error = copyin(args, uap, sizeof(struct i386_ldt_args))) < 0) return(error); #ifdef DEBUG printf("i386_get_ldt: start=%d num=%d descs=%p\n", - uap->start, uap->num, (void *)uap->desc); + uap->start, uap->num, (void *)uap->descs); #endif /* verify range of LDTs exist */ @@ -312,7 +299,7 @@ i386_get_ldt(p, args) return(EINVAL); } - error = copyout(lp, uap->desc, num * sizeof(union descriptor)); + error = copyout(lp, uap->descs, num * sizeof(union descriptor)); if (!error) p->p_retval[0] = num; @@ -320,12 +307,6 @@ i386_get_ldt(p, args) return(error); } -struct i386_set_ldt_args { - int start; - union descriptor *desc; - int num; -}; - static int i386_set_ldt(p, args) struct proc *p; @@ -335,16 +316,14 @@ i386_set_ldt(p, args) int largest_ld; struct pcb *pcb = &p->p_addr->u_pcb; int s; - struct i386_set_ldt_args ua, *uap; + struct i386_ldt_args ua, *uap = &ua; - if ((error = copyin(args, &ua, sizeof(struct i386_set_ldt_args))) < 0) + if ((error = copyin(args, uap, sizeof(struct i386_ldt_args))) < 0) return(error); - uap = &ua; - #ifdef DEBUG printf("i386_set_ldt: start=%d num=%d descs=%p\n", - uap->start, uap->num, (void *)uap->desc); + uap->start, uap->num, (void *)uap->descs); #endif /* verify range of descriptors to modify */ @@ -381,7 +360,7 @@ i386_set_ldt(p, args) /* Check descriptors for access violations */ for (i = 0, n = uap->start; i < uap->num; i++, n++) { union descriptor desc, *dp; - dp = &uap->desc[i]; + dp = &uap->descs[i]; error = copyin(dp, &desc, sizeof(union descriptor)); if (error) return(error); @@ -446,7 +425,7 @@ i386_set_ldt(p, args) s = splhigh(); /* Fill in range */ - error = copyin(uap->desc, + error = copyin(uap->descs, &((union descriptor *)(pcb->pcb_ldt))[uap->start], uap->num * sizeof(union descriptor)); if (!error) diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c index b50b6f1..c041d3b 100644 --- a/sys/i386/i386/vm86.c +++ b/sys/i386/i386/vm86.c @@ -46,6 +46,7 @@ #include <machine/pcb_ext.h> /* pcb.h included via sys/user.h */ #include <machine/psl.h> #include <machine/specialreg.h> +#include <machine/sysarch.h> extern int i386_extend_pcb __P((struct proc *)); extern int vm86pa; diff --git a/sys/i386/include/sysarch.h b/sys/i386/include/sysarch.h index 009c781..5ea3ee6 100644 --- a/sys/i386/include/sysarch.h +++ b/sys/i386/include/sysarch.h @@ -47,6 +47,23 @@ /* xxxxx */ #define I386_VM86 6 +struct i386_ldt_args { + int start; + union descriptor *descs; + int num; +}; + +struct i386_ioperm_args { + unsigned int start; + unsigned int length; + int enable; +}; + +struct i386_vm86_args { + int sub_op; /* sub-operation to perform */ + char *sub_args; /* args */ +}; + #ifndef KERNEL #include <sys/cdefs.h> diff --git a/sys/i386/include/vm86.h b/sys/i386/include/vm86.h index 1231bb2..60c5615 100644 --- a/sys/i386/include/vm86.h +++ b/sys/i386/include/vm86.h @@ -124,11 +124,6 @@ struct vm86_kernel { caddr_t vm86_sproc; /* address of sproc */ }; -struct i386_vm86_args { - int sub_op; /* sub-operation to perform */ - char *sub_args; /* args */ -}; - #define VM86_INIT 1 #define VM86_SET_VME 2 #define VM86_GET_VME 3 |