← Back to Pull requests

Fix PSHUFLW instruction feature gate #843

Closed
unknown closed this pull request without merging on Aug 28, 2026 05:50 UTC
View on GitHub
unknown unknown commented on Aug 28, 2026 04:02 UTC
Author

Problem

Legacy PSHUFLW is an SSE2 instruction whose availability is indicated
by CPUID.01H:EDX.SSE2[26].

Its opcode declaration currently uses BX_ISA_SSE as the feature guard.
As a result, decoder initialization enables PSHUFLW on processors that
support SSE but not SSE2.

The built-in Pentium III Katmai model demonstrates this feature
combination. It enables BX_ISA_SSE, does not enable BX_ISA_SSE2, and
reports SSE=1 and SSE2=0 through CPUID. Before this fix, it nevertheless
executes PSHUFLW instead of raising #UD.

For example:

CPU model:    p3_katmai
CPUID.1:EDX:  0x0387f9ff
SSE:          1
SSE2:         0
bytes:        f2 0f 70 c0 00
instruction:  pshuflw xmm0, xmm0, 0
expected:     #UD
before fix:   executes

Fix

Use BX_ISA_SSE2 as the feature guard for the legacy PSHUFLW opcode
declaration.

This makes instruction decoding agree with the SSE2 feature reported by
the selected CPU model.

Architectural reference

The Intel® 64 and IA-32 Architectures Software Developer’s Manual,
Volume 2B, section “PSHUFLW—Shuffle Packed Low Words,” identifies
F2 0F 70 /r ib as an SSE2 instruction and specifies #UD when
CPUID.01H:EDX.SSE2[26] is clear.

  • Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 2B

  • Intel® Software Developer Manuals download page
  • Validation

    Bochs was rebuilt successfully after rebuilding the affected decoder
    object:

    make -C bochs/cpu -B decoder/fetchdecode32.o
    make -C bochs -j2
    

    A temporary real-mode boot probe selected p3_katmai, confirmed
    CPUID.01H:EDX.SSE=1 and SSE2=0, enabled SSE state use, and executed
    F2 0F 70 C0 00.

    Before the fix:

    SSE=1 SSE2=0 PSHUFLW=EXECUTED
    

    After the fix:

    SSE=1 SSE2=0 PSHUFLW=#UD
    

    Diff: 247 lines (+185 / -62) across 3 files Reviewer: stlintel Review duration: 107m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 247 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #843"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 38.9% (MEDIUM) · Higher = larger blast radius
    38.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.8% · Safe to merge
    16.8%