| Crates.io | polished_x86_commands |
| lib.rs | polished_x86_commands |
| version | 0.1.2 |
| created_at | 2025-06-11 01:23:01.545194+00 |
| updated_at | 2025-06-13 03:20:46.450516+00 |
| description | Low-level x86 instructions and utilities for Polished OS. |
| homepage | |
| repository | https://codeberg.org/ofluffydev/polished |
| max_upload_size | |
| id | 1707937 |
| size | 8,440 |
x86_commands is a low-level Rust library providing direct access to x86 and x86_64 CPU instructions and hardware operations, specifically designed for use in operating system kernels, bootloaders, and other bare-metal environments. This crate is part of the Polished OS project, but is modular and can be reused in other OS development efforts.
This crate aims to offer a minimal, well-documented, and safe (where possible) set of helpers for interacting with x86-family CPUs. It currently provides only a handful of helpers, but is intended to grow into a comprehensive alternative to crates like x86_64 or x86, tailored for the needs of Polished OS and similar projects.
Key goals:
disable_pic(): Masks all interrupts from the legacy PIC (8259), a common step before enabling APIC in modern kernels.core::arch::asm! for direct hardware access.Note: The crate currently only contains a few helpers, but is designed to expand as Polished OS evolves. Planned features include port I/O, CPU feature detection, MSR access, and more.
use x86_commands::disable_pic;
disable_pic(); // Masks all legacy PIC interrupts (required before enabling APIC)
All functions are no_std and require a privileged (kernel or bootloader) context. They are not safe for use in userspace or general application code.
This crate is intended for use in the earliest stages of OS development, where direct hardware access is required and no standard library is available. It is especially useful for:
Why not use x86_64 or x86 crates?
x86_commands is designed to be minimal, with only the features needed for Polished OSunsafe or require unsafe blocks, as they interact directly with hardwareAs Polished OS matures, this crate may:
hlt, cli, sti, cpuid, etc.)inb, outb, etc.)x86_64 in Polished OSContributions are welcome! If you have suggestions, bug reports, or want to add new helpers, please open an issue or pull request.
This crate is licensed under the zlib License. See the LICENSE file for details.
This crate is under active development as part of the Polished OS project. Its API and features may change as the OS evolves.