svn commit: r219989 - head/sys/compat/freebsd32
Konstantin Belousov
kib at FreeBSD.org
Fri Mar 25 11:52:31 UTC 2011
Author: kib
Date: Fri Mar 25 11:52:31 2011
New Revision: 219989
URL: http://svn.freebsd.org/changeset/base/219989
Log:
Implement compat32 MEMRANGE_GET and MEMRANGE_SET. This is needed to
run 32bit Xorg server with VESA driver.
Submitted by: John Wehle <john feith com>
MFC after: 1 week
Modified:
head/sys/compat/freebsd32/freebsd32_ioctl.c
head/sys/compat/freebsd32/freebsd32_ioctl.h
Modified: head/sys/compat/freebsd32/freebsd32_ioctl.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_ioctl.c Fri Mar 25 11:43:49 2011 (r219988)
+++ head/sys/compat/freebsd32/freebsd32_ioctl.c Fri Mar 25 11:52:31 2011 (r219989)
@@ -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: head/sys/compat/freebsd32/freebsd32_ioctl.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_ioctl.h Fri Mar 25 11:43:49 2011 (r219988)
+++ head/sys/compat/freebsd32/freebsd32_ioctl.h Fri Mar 25 11:52:31 2011 (r219989)
@@ -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_ */
More information about the svn-src-head
mailing list