[mm_supv]: Move common x86 descriptor definitions to patina_internal_cpu

Open
#1,995 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start by comparing the descriptor and CPU helper definitions in patina_mm_supervisor's privilege_mgmt/call_gate.rs, mmcore/validation.rs, and intrinsics.rs with patina_internal_cpu's gdt.rs. Audit which definitions are architectural and reusable, then update the supervisor imports while keeping the named MM-specific items there. Done means duplicate architectural types have a single definition and the supervisor uses the shared definitions.

Written by the indexing model from the issue text.

Description

state:backlog state:needs-triage type:feature-request urgency:low
Feature Overview

patina_mm_supervisor defines its own x86-64 descriptor types and CPU helpers that are not specific to MM. Examples are TssDescriptor and CallGateDescriptor (privilege_mgmt/call_gate.rs), SegmentDescriptor (mmcore/validation.rs), and DescriptorTablePointer with the CR/MSR/GDTR/IDTR accessors (intrinsics.rs). Some already have a counterpart in patina_internal_cpu, for example DescriptorTablePointer and TaskStateSegment in gdt.rs. Raised in review of #1875.

https://github.com/OpenDevicePartnership/patina/pull/1875#discussion_r4555539682

Solution Overview

Audit the supervisor for architectural definitions and helpers that other crates can use, move them into patina_internal_cpu (gdt.rs, or a new module next to it), and have the supervisor import them. Where a type exists in both crates, keep one copy. MM-specific items stay in the supervisor, such as the call gate selector layout and the SmiGdtImage template check.

Alternatives Considered

No response

Urgency

Low

Are you going to implement the feature request?

I will implement the feature

Do you need maintainer feedback?

No maintainer feedback needed

Anything else?

No response

Dominant language
Rust
Stars
568
Forks
63
Avg merge
1d 16h
Merged PRs (30d)
60

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenDevicePartnership/patina

All issues in OpenDevicePartnership/patina

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.