redox-driver-sys: fix kernel GPF by acquiring IOPL before PCI I/O port access

Root cause: PciDevice::open_io_ports never called acquire_iopl(),
so the first outl to 0xCF8 triggered #GP(0) when redox-drm tried
to scan virtio-gpu PCI capabilities.

- Add ensure_iopl_acquired() helper (thread-local Once)
- Call it in PciDevice::open_io_ports before any I/O
- Add P1-pci-open-io-ports-iopl.patch to recipe
- Mirror patch to local/patches/ for durability
This commit is contained in:
2026-06-20 23:14:11 +03:00
parent d55bef9a2d
commit b4237bb12e
6 changed files with 67 additions and 1 deletions
@@ -1439,6 +1439,20 @@ qt_internal_extend_target(Core CONDITION REDOX
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
qt_internal_extend_target(Core CONDITION QT_FEATURE_cpp_winrt
SOURCES
platform/windows/qfactorycacheregistration_p.h
@@ -1705,6 +1719,20 @@ qt_internal_extend_target(Core CONDITION REDOX
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
qt_internal_extend_target(Core CONDITION QT_FEATURE_itemmodel
SOURCES
itemmodels/qabstractitemmodel.cpp itemmodels/qabstractitemmodel.h itemmodels/qabstractitemmodel_p.h
@@ -211,6 +211,8 @@ static_assert(std::is_signed_v<qint128>,
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#ifndef static_assert
#define static_assert _Static_assert
#endif
@@ -1155,6 +1155,8 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
if (header.hopLimit != -1) {
msg.msg_controllen += CMSG_SPACE(sizeof(int));
@@ -1197,6 +1199,8 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
#endif
#endif
#endif
#endif
#endif
#endif
if (header.ifindex != 0 || !header.senderAddress.isNull()) {
struct in6_pktinfo *data = reinterpret_cast<in6_pktinfo *>(CMSG_DATA(cmsgptr));
@@ -55,6 +55,8 @@
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#if defined(Q_OS_VXWORKS)
@@ -85,6 +85,8 @@ public:
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0;
#endif /* QT_CONFIG(opengl) */
@@ -120,6 +122,8 @@ public:
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
virtual bool canCreatePlatformOffscreenSurface() const { return false; }
#if QT_CONFIG(opengl)
@@ -166,6 +170,8 @@ public:
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return nullptr; }
#endif /* QT_CONFIG(opengl) */
@@ -202,6 +208,8 @@ public:
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
};
}
+23 -1
View File
@@ -37,8 +37,12 @@ pub enum ViewMode {
/// Plain text rendering.
#[default]
Text,
/// Hex rendering (byte + ASCII column).
/// Hex rendering (byte + ASCII column), read-only.
Hex,
/// Hex rendering with byte-level edit cursor. Bytes at the
/// cursor position can be modified nibble-by-nibble; F10/Esc
/// on a dirty buffer opens a save-before-quit prompt.
HexEdit,
}
/// Active prompt kind at the bottom of the viewer. Opened by `/`
@@ -53,6 +57,10 @@ pub enum ViewerPrompt {
SearchBackward,
/// `g` — goto-line prompt.
GotoLine,
/// "Save before quit?" — opened by F10/Esc/Ctrl-Q on a dirty
/// hex-edit buffer. Y/Enter saves, N discards, Esc cancels
/// the quit (returns to the viewer).
SaveBeforeQuit,
}
/// Top-level Viewer struct. Built incrementally as Phase 3
@@ -111,6 +119,20 @@ pub struct Viewer {
/// from scratch so its parser state matches reality.
#[cfg(feature = "syntect")]
last_render_top: u64,
/// Active nibble in hex-edit mode. `0` = high nibble (first
/// hex digit), `1` = low nibble (second hex digit). Toggles
/// each time the user types a hex digit; full-byte commit
/// advances the cursor by one byte.
hex_edit_nibble: u8,
/// The high nibble awaiting its low-nibble pair. `None`
/// means we are at a fresh byte (about to type the high
/// nibble). `Some(n)` means the user has typed the high
/// nibble and the next keystroke completes the byte.
hex_edit_pending_high: Option<u8>,
/// Dirty flag. Set on every byte mutation in hex-edit mode.
/// Cleared after a successful save-to-disk. Triggers the
/// "Save before quit?" prompt on F10/Esc/Ctrl-Q.
hex_edit_modified: bool,
}
impl Viewer {