Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178182992
D62277.1796212345.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D62277.1796212345.diff
View Options
diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h
--- a/sys/compat/linux/linux_ioctl.h
+++ b/sys/compat/linux/linux_ioctl.h
@@ -698,6 +698,22 @@
unsigned char c_cc[LINUX_NCC];
};
+#ifdef __powerpc__
+/*
+ * PowerPC kept the BSD-derived layout: c_cc[] comes before c_line and the
+ * line speeds are part of the structure.
+ */
+struct linux_termios {
+ unsigned int c_iflag;
+ unsigned int c_oflag;
+ unsigned int c_cflag;
+ unsigned int c_lflag;
+ unsigned char c_cc[LINUX_NCCS];
+ unsigned char c_line;
+ unsigned int c_ispeed;
+ unsigned int c_ospeed;
+};
+#else
struct linux_termios {
unsigned int c_iflag;
unsigned int c_oflag;
@@ -706,6 +722,7 @@
unsigned char c_line;
unsigned char c_cc[LINUX_NCCS];
};
+#endif
struct linux_termios2 {
unsigned int c_iflag;
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -429,7 +429,7 @@
lios->c_oflag |= LINUX_XTABS;
lios->c_cflag = bsd_to_linux_speed(bios->c_ispeed, sptab);
- lios->c_cflag |= (bios->c_cflag & CSIZE) >> 4;
+ lios->c_cflag |= (bios->c_cflag & CSIZE) / (CSIZE / LINUX_CSIZE);
if (bios->c_cflag & CSTOPB)
lios->c_cflag |= LINUX_CSTOPB;
if (bios->c_cflag & CREAD)
@@ -502,6 +502,10 @@
lios->c_cc[i] = LINUX_POSIX_VDISABLE;
}
lios->c_line = 0;
+#ifdef __powerpc__
+ lios->c_ispeed = bios->c_ispeed;
+ lios->c_ospeed = bios->c_ospeed;
+#endif
}
static void
@@ -555,7 +559,7 @@
if (lios->c_oflag & LINUX_XTABS)
bios->c_oflag |= TAB3;
- bios->c_cflag = (lios->c_cflag & LINUX_CSIZE) << 4;
+ bios->c_cflag = (lios->c_cflag & LINUX_CSIZE) * (CSIZE / LINUX_CSIZE);
if (lios->c_cflag & LINUX_CSTOPB)
bios->c_cflag |= CSTOPB;
if (lios->c_cflag & LINUX_CREAD)
diff --git a/sys/powerpc/linux/linux.h b/sys/powerpc/linux/linux.h
--- a/sys/powerpc/linux/linux.h
+++ b/sys/powerpc/linux/linux.h
@@ -315,8 +315,12 @@
#define LINUX_TIOCSPGRP_PPC _IOW('t', 118, int)
#define LINUX_TIOCGPGRP_PPC _IOR('t', 119, int)
-#define LINUX_IOCTL_TERMIO_PPC_MIN LINUX_TCGETS_PPC
-#define LINUX_IOCTL_TERMIO_PPC_MAX LINUX_TIOCSPGRP_PPC
+/*
+ * linux_ioctl() matches handlers on the low 16 bits of the command. The
+ * range spans the 'f' and 't' groups, which PowerPC encodes the BSD way.
+ */
+#define LINUX_IOCTL_PPC_MIN (FIOCLEX & 0xffff)
+#define LINUX_IOCTL_PPC_MAX (LINUX_TIOCGPGRP_PPC & 0xffff)
struct l_func_desc {
unsigned long addr;
diff --git a/sys/powerpc/linux/linux_machdep.c b/sys/powerpc/linux/linux_machdep.c
--- a/sys/powerpc/linux/linux_machdep.c
+++ b/sys/powerpc/linux/linux_machdep.c
@@ -363,8 +363,8 @@
static struct linux_ioctl_handler linux_ioctls_ppc = {
.func = linux_ioctl_ppc_handler,
- .low = FIOCLEX,
- .high = LINUX_IOCTL_TERMIO_PPC_MAX
+ .low = LINUX_IOCTL_PPC_MIN,
+ .high = LINUX_IOCTL_PPC_MAX
};
DATA_SET(linux_ioctl_handler_set, linux_ioctls_ppc);
@@ -461,8 +461,6 @@
args->cmd = LINUX_FIONREAD;
return (linux_ioctl_termio(td, args));
default:
- return (ENOTTY);
+ return (ENOIOCTL);
}
-
- return (ENOTTY);
}
diff --git a/sys/powerpc/linux/linux_termbits.h b/sys/powerpc/linux/linux_termbits.h
--- a/sys/powerpc/linux/linux_termbits.h
+++ b/sys/powerpc/linux/linux_termbits.h
@@ -162,8 +162,8 @@
#define LINUX_EXTA LINUX_B19200
#define LINUX_EXTB LINUX_B38400
-#define LINUX_B57600 0x00001001
-#define LINUX_B115200 0x00001002
+#define LINUX_B57600 0x00000010
+#define LINUX_B115200 0x00000011
#define LINUX_CRTSCTS 0x80000000
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 2, 11:52 AM (19 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42141160
Default Alt Text
D62277.1796212345.diff (3 KB)
Attached To
Mode
D62277: linuxulator/powerpc: fix terminal ioctls
Attached
Detach File
Event Timeline