1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/xorg-server/hotfix-ioperm.patch
3 # Copyright (C) 2024 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 --- b/hw/xfree86/os-support/linux/lnx_video.c
15 +++ a/hw/xfree86/os-support/linux/lnx_video.c
20 + if (ioperm(0, 1024, 1) || iopl(3)) {
21 + ErrorF("xf86EnableIOPorts: failed to set IOPL for I/O (%s)\n",
25 - char *buf=NULL, target[5];
28 - if (ioperm(0, 1024, 1)) {
29 - ErrorF("xf86EnableIO: failed to enable I/O ports 0000-03ff (%s)\n",
34 #if !defined(__alpha__)
35 + /* XXX: this is actually not trapping anything because of iopl(3)
37 + ioperm(0x40, 4, 0); /* trap access to the timer chip */
38 + ioperm(0x60, 4, 0); /* trap access to the keyboard controller */
41 - /* trap access to the keyboard controller(s) and timer chip(s) */
42 - fp = fopen("/proc/ioports", "r");
43 - while (getline(&buf, &n, fp) != -1) {
44 - if ((strstr(buf, "keyboard") != NULL) || (strstr(buf, "timer") != NULL)) {
46 - target[i] = buf[i+2];
47 - begin = atoi(target);
50 - target[i] = buf[i+7];
53 - ioperm(begin, end-begin+1, 0);