Date: Fri, 1 Apr 2011 13:23:53 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r220244 - stable/8/sys/compat/freebsd32 Message-ID: <201104011323.p31DNru3046652@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Apr 1 13:23:53 2011 New Revision: 220244 URL: http://svn.freebsd.org/changeset/base/220244 Log: MFC r219989: Implement compat32 MEMRANGE_GET and MEMRANGE_SET. Modified: stable/8/sys/compat/freebsd32/freebsd32_ioctl.c stable/8/sys/compat/freebsd32/freebsd32_ioctl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/compat/freebsd32/freebsd32_ioctl.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_ioctl.c Fri Apr 1 13:20:39 2011 (r220243) +++ stable/8/sys/compat/freebsd32/freebsd32_ioctl.c Fri Apr 1 13:23:53 2011 (r220244) @@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$"); #include <sys/filio.h> #include <sys/file.h> #include <sys/ioccom.h> +#include <sys/malloc.h> #include <sys/mdioctl.h> +#include <sys/memrange.h> #include <sys/proc.h> #include <sys/syscall.h> #include <sys/syscallsubr.h> @@ -55,6 +57,7 @@ __FBSDID("$FreeBSD$"); CTASSERT((sizeof(struct md_ioctl32)+4) == 436); CTASSERT(sizeof(struct ioc_read_toc_entry32) == 8); CTASSERT(sizeof(struct ioc_toc_header32) == 4); +CTASSERT(sizeof(struct mem_range_op32) == 12); static int @@ -191,6 +194,49 @@ freebsd32_ioctl_fiodgname(struct thread return (error); } +static int +freebsd32_ioctl_memrange(struct thread *td, + struct freebsd32_ioctl_args *uap, struct file *fp) +{ + struct mem_range_op mro; + struct mem_range_op32 mro32; + int error; + u_long com; + + if ((error = copyin(uap->data, &mro32, sizeof(mro32))) != 0) + return (error); + + PTRIN_CP(mro32, mro, mo_desc); + CP(mro32, mro, mo_arg[0]); + CP(mro32, mro, mo_arg[1]); + + com = 0; + switch (uap->com) { + case MEMRANGE_GET32: + com = MEMRANGE_GET; + break; + + case MEMRANGE_SET32: + com = MEMRANGE_SET; + break; + + default: + panic("%s: unknown MEMRANGE %#x", __func__, uap->com); + } + + if ((error = fo_ioctl(fp, com, (caddr_t)&mro, td->td_ucred, td)) != 0) + return (error); + + if ( (com & IOC_OUT) ) { + CP(mro, mro32, mo_arg[0]); + CP(mro, mro32, mo_arg[1]); + + error = copyout(&mro32, uap->data, sizeof(mro32)); + } + + return (error); +} + int freebsd32_ioctl(struct thread *td, struct freebsd32_ioctl_args *uap) { @@ -229,6 +275,11 @@ freebsd32_ioctl(struct thread *td, struc error = freebsd32_ioctl_fiodgname(td, uap, fp); break; + case MEMRANGE_GET32: /* FALLTHROUGH */ + case MEMRANGE_SET32: + error = freebsd32_ioctl_memrange(td, uap, fp); + break; + default: fdrop(fp, td); ap.fd = uap->fd; Modified: stable/8/sys/compat/freebsd32/freebsd32_ioctl.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_ioctl.h Fri Apr 1 13:20:39 2011 (r220243) +++ stable/8/sys/compat/freebsd32/freebsd32_ioctl.h Fri Apr 1 13:23:53 2011 (r220244) @@ -67,6 +67,12 @@ struct fiodgname_arg32 { caddr_t32 buf; }; +struct mem_range_op32 +{ + caddr_t32 mo_desc; + int mo_arg[2]; +}; + #define CDIOREADTOCENTRYS_32 _IOWR('c', 5, struct ioc_read_toc_entry32) #define CDIOREADTOCHEADER_32 _IOR('c', 4, struct ioc_toc_header32) #define MDIOCATTACH_32 _IOC(IOC_INOUT, 'm', 0, sizeof(struct md_ioctl32) + 4) @@ -74,5 +80,7 @@ struct fiodgname_arg32 { #define MDIOCQUERY_32 _IOC(IOC_INOUT, 'm', 2, sizeof(struct md_ioctl32) + 4) #define MDIOCLIST_32 _IOC(IOC_INOUT, 'm', 3, sizeof(struct md_ioctl32) + 4) #define FIODGNAME_32 _IOW('f', 120, struct fiodgname_arg32) +#define MEMRANGE_GET32 _IOWR('m', 50, struct mem_range_op32) +#define MEMRANGE_SET32 _IOW('m', 51, struct mem_range_op32) #endif /* _COMPAT_FREEBSD32_IOCTL_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104011323.p31DNru3046652>