diff options
author | sobomax <sobomax@FreeBSD.org> | 2005-01-26 13:59:46 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2005-01-26 13:59:46 +0000 |
commit | ef410537709bade6c0f73294ab4c6702637c582c (patch) | |
tree | 1977517e0838d86134452dce17f9b9cf695ba1a4 /sys/i386/linux | |
parent | 3f0d8e467c82773cd96f4e8a6daed7e6cdf02c2c (diff) | |
download | FreeBSD-src-ef410537709bade6c0f73294ab4c6702637c582c.zip FreeBSD-src-ef410537709bade6c0f73294ab4c6702637c582c.tar.gz |
o Move copyin()/copyout() out of i386_{get,set}_ldt() and
i386_{get,set}_ioperm() and make those APIs visible in the kernel namespace;
o use i386_{get,set}_ldt() and i386_{get,set}_ioperm() instead of sysarch()
in the linuxlator, which allows to kill another two stackgaps.
MFC after: 2 weeks
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/linux_machdep.c | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index 4d334ba..2a825e8 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -581,18 +581,16 @@ linux_pipe(struct thread *td, struct linux_pipe_args *args) int linux_ioperm(struct thread *td, struct linux_ioperm_args *args) { - struct sysarch_args sa; - struct i386_ioperm_args *iia; - caddr_t sg; - - sg = stackgap_init(); - iia = stackgap_alloc(&sg, sizeof(struct i386_ioperm_args)); - iia->start = args->start; - iia->length = args->length; - iia->enable = args->enable; - sa.op = I386_SET_IOPERM; - sa.parms = (char *)iia; - return (sysarch(td, &sa)); + int error; + struct i386_ioperm_args iia; + + iia.start = args->start; + iia.length = args->length; + iia.enable = args->enable; + mtx_lock(&Giant); + error = i386_set_ioperm(td, &iia); + mtx_unlock(&Giant); + return (error); } int @@ -615,27 +613,22 @@ int linux_modify_ldt(struct thread *td, struct linux_modify_ldt_args *uap) { int error; - caddr_t sg; - struct sysarch_args args; - struct i386_ldt_args *ldt; + struct i386_ldt_args ldt; struct l_descriptor ld; - union descriptor *desc; - - sg = stackgap_init(); + union descriptor desc; if (uap->ptr == NULL) return (EINVAL); switch (uap->func) { case 0x00: /* read_ldt */ - ldt = stackgap_alloc(&sg, sizeof(*ldt)); - ldt->start = 0; - ldt->descs = uap->ptr; - ldt->num = uap->bytecount / sizeof(union descriptor); - args.op = I386_GET_LDT; - args.parms = (char*)ldt; - error = sysarch(td, &args); + ldt.start = 0; + ldt.descs = uap->ptr; + ldt.num = uap->bytecount / sizeof(union descriptor); + mtx_lock(&Giant); + error = i386_get_ldt(td, &ldt); td->td_retval[0] *= sizeof(union descriptor); + mtx_unlock(&Giant); break; case 0x01: /* write_ldt */ case 0x11: /* write_ldt */ @@ -646,25 +639,23 @@ linux_modify_ldt(struct thread *td, struct linux_modify_ldt_args *uap) if (error) return (error); - ldt = stackgap_alloc(&sg, sizeof(*ldt)); - desc = stackgap_alloc(&sg, sizeof(*desc)); - ldt->start = ld.entry_number; - ldt->descs = desc; - ldt->num = 1; - desc->sd.sd_lolimit = (ld.limit & 0x0000ffff); - desc->sd.sd_hilimit = (ld.limit & 0x000f0000) >> 16; - desc->sd.sd_lobase = (ld.base_addr & 0x00ffffff); - desc->sd.sd_hibase = (ld.base_addr & 0xff000000) >> 24; - desc->sd.sd_type = SDT_MEMRO | ((ld.read_exec_only ^ 1) << 1) | + ldt.start = ld.entry_number; + ldt.descs = &desc; + ldt.num = 1; + desc.sd.sd_lolimit = (ld.limit & 0x0000ffff); + desc.sd.sd_hilimit = (ld.limit & 0x000f0000) >> 16; + desc.sd.sd_lobase = (ld.base_addr & 0x00ffffff); + desc.sd.sd_hibase = (ld.base_addr & 0xff000000) >> 24; + desc.sd.sd_type = SDT_MEMRO | ((ld.read_exec_only ^ 1) << 1) | (ld.contents << 2); - desc->sd.sd_dpl = 3; - desc->sd.sd_p = (ld.seg_not_present ^ 1); - desc->sd.sd_xx = 0; - desc->sd.sd_def32 = ld.seg_32bit; - desc->sd.sd_gran = ld.limit_in_pages; - args.op = I386_SET_LDT; - args.parms = (char*)ldt; - error = sysarch(td, &args); + desc.sd.sd_dpl = 3; + desc.sd.sd_p = (ld.seg_not_present ^ 1); + desc.sd.sd_xx = 0; + desc.sd.sd_def32 = ld.seg_32bit; + desc.sd.sd_gran = ld.limit_in_pages; + mtx_lock(&Giant); + error = i386_set_ldt(td, &ldt, &desc); + mtx_unlock(&Giant); break; default: error = EINVAL; |