x86 0.52.0

Library to program x86 (amd64) hardware. Contains x86 specific data structure descriptions, data-tables, as well as convenience function to call assembly instructions typically not exposed in higher level languages.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[allow(unused_imports)]
use crate::segmentation::SegmentSelector;

#[cfg(target_arch = "x86")]
use core::arch::asm;

/// Reload code segment register.
/// Note this is special since we can not directly move
/// to %cs. Instead we push the new segment selector
/// and return value on the stack and use lretl
/// to reload cs and continue at 1:.
#[cfg(target_arch = "x86")]
pub unsafe fn load_cs(sel: SegmentSelector) {
    asm!("pushl {0}; \
          pushl $1f; \
          lretl; \
          1:", in(reg) sel.bits() as u32, options(att_syntax));
}