Bugzilla – Attachment 398903 Details for
Bug 625041
KVM/Xorg/fbdev: X segfaults on logout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
0001-To-access-i-o-ports-above-0x3ff-we-need-to-be-in-iop.patch
0001-To-access-i-o-ports-above-0x3ff-we-need-to-be-in-iop.patch (text/plain), 2.13 KB, created by
Stefan Dirsch
on 2010-11-07 12:02:03 UTC
(
hide
)
Description:
0001-To-access-i-o-ports-above-0x3ff-we-need-to-be-in-iop.patch
Filename:
MIME Type:
Creator:
Stefan Dirsch
Created:
2010-11-07 12:02:03 UTC
Size:
2.13 KB
patch
obsolete
>From b40c6c46f0b56ab511c8ca3753e75c66cecd5006 Mon Sep 17 00:00:00 2001 >From: Stefan Dirsch <sndirsch@suse.de> >Date: Sun, 7 Nov 2010 12:54:17 +0100 >Subject: [PATCH] To access i/o ports above 0x3ff, we need to be in iopl(3). > >Switch to I/O privilege level 3 before accessing ports above 0x3ff. >Afterwards switch back to previous I/O privilege level. >--- > shared/vmmouse_proto.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 44 insertions(+), 0 deletions(-) > >diff --git a/shared/vmmouse_proto.c b/shared/vmmouse_proto.c >index b50e071..2708af3 100644 >--- a/shared/vmmouse_proto.c >+++ b/shared/vmmouse_proto.c >@@ -33,7 +33,9 @@ > */ > > >+#include <sys/io.h> > #include "vmmouse_proto.h" >+#include "vmmouse_client.h" > > > /* >@@ -119,6 +121,31 @@ VMMouseProtoInOut(VMMouseProtoCmd *cmd) // IN/OUT > #endif > } > >+/* >+ *----------------------------------------------------------------------------- >+ * >+ * VMMouseGetIOPL -- >+ * >+ * Helper to figure out the current I/O privilege level (idea by >+ * Jiri Kosina <jkosina@suse.cz>) >+ * >+ * Results: >+ * Returns I/O privilege level >+ * >+ * Side effects: >+ * None >+ * >+ *----------------------------------------------------------------------------- >+ */ >+ >+int >+VMMouseGetIOPL() >+{ >+ unsigned long eflags; >+ >+ asm ("pushf\n\tpop %0" : "=r" (eflags)); >+ return (eflags >> 12) & 3; >+} > > /* > *----------------------------------------------------------------------------- >@@ -140,8 +167,25 @@ VMMouseProtoInOut(VMMouseProtoCmd *cmd) // IN/OUT > void > VMMouseProto_SendCmd(VMMouseProtoCmd *cmd) // IN/OUT > { >+ int cpl; >+ > cmd->in.magic = VMMOUSE_PROTO_MAGIC; > cmd->in.port = VMMOUSE_PROTO_PORT; > >+#if defined __i386__ || defined __x86_64__ >+ cpl = VMMouseGetIOPL(); >+ VMwareLog(("Current I/O privilege level: %d", cpl)); >+ /* >+ * To access i/o ports above 0x3ff, we need to be in iopl(3). >+ */ >+ VMwareLog(("Switching to I/O privilege level 3.")); >+ iopl(3); >+#endif >+ > VMMouseProtoInOut(cmd); >+ >+#if defined __i386__ || defined __x86_64__ >+ VMwareLog(("Switching back to previous I/O privilege level %d.\n", cpl)); >+ iopl(cpl); >+#endif > } >-- >1.7.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 625041
:
378001
|
398872
|
398903
|
398904
|
398908
|
398913
|
398920
|
489411