From b4237bb12e4910e73f5a2cc7f1c529010e88e1c0 Mon Sep 17 00:00:00 2001 From: vasilito Date: Sat, 20 Jun 2026 23:14:11 +0300 Subject: [PATCH] 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 --- .../qtbase/source/src/corelib/CMakeLists.txt | 28 +++++++++++++++++++ .../qtbase/source/src/corelib/global/qtypes.h | 2 ++ .../socket/qnativesocketengine_unix.cpp | 4 +++ .../source/src/network/socket/qnet_unix_p.h | 2 ++ .../qwaylandclientbufferintegration_p.h | 8 ++++++ .../recipes/tui/tlc/source/src/viewer/mod.rs | 24 +++++++++++++++- 6 files changed, 67 insertions(+), 1 deletion(-) diff --git a/local/recipes/qt/qtbase/source/src/corelib/CMakeLists.txt b/local/recipes/qt/qtbase/source/src/corelib/CMakeLists.txt index 6983e7e367..30e945917d 100644 --- a/local/recipes/qt/qtbase/source/src/corelib/CMakeLists.txt +++ b/local/recipes/qt/qtbase/source/src/corelib/CMakeLists.txt @@ -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 diff --git a/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h b/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h index 26d3a1114a..9c2aa74d24 100644 --- a/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h +++ b/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h @@ -211,6 +211,8 @@ static_assert(std::is_signed_v, #include #include #include +#include +#include #ifndef static_assert #define static_assert _Static_assert #endif diff --git a/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp b/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp index b238def903..0ca57be67f 100644 --- a/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp +++ b/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp @@ -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(CMSG_DATA(cmsgptr)); diff --git a/local/recipes/qt/qtbase/source/src/network/socket/qnet_unix_p.h b/local/recipes/qt/qtbase/source/src/network/socket/qnet_unix_p.h index a8dfe1dc79..6e734f2638 100644 --- a/local/recipes/qt/qtbase/source/src/network/socket/qnet_unix_p.h +++ b/local/recipes/qt/qtbase/source/src/network/socket/qnet_unix_p.h @@ -55,6 +55,8 @@ #include #include #include +#include +#include #include #if defined(Q_OS_VXWORKS) diff --git a/local/recipes/qt/qtbase/source/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/local/recipes/qt/qtbase/source/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 7fd87b6215..7c917d31fc 100644 --- a/local/recipes/qt/qtbase/source/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/local/recipes/qt/qtbase/source/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -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) */ }; } diff --git a/local/recipes/tui/tlc/source/src/viewer/mod.rs b/local/recipes/tui/tlc/source/src/viewer/mod.rs index ca2a72d26f..86602d5c5f 100644 --- a/local/recipes/tui/tlc/source/src/viewer/mod.rs +++ b/local/recipes/tui/tlc/source/src/viewer/mod.rs @@ -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, + /// 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 {