/rust/registry/src/index.crates.io-1949cf8c6b5b557f/x86-0.47.0/src/bits16/segmentation.rs
Line | Count | Source |
1 | | use crate::segmentation::{ |
2 | | DescriptorBuilder, DescriptorType, GateDescriptorBuilder, SegmentSelector, |
3 | | SystemDescriptorTypes32, |
4 | | }; |
5 | | |
6 | | impl GateDescriptorBuilder<u16> for DescriptorBuilder { |
7 | 0 | fn tss_descriptor(base: u64, limit: u64, available: bool) -> DescriptorBuilder { |
8 | 0 | let typ = match available { |
9 | 0 | true => DescriptorType::System32(SystemDescriptorTypes32::TSSAvailable16), |
10 | 0 | false => DescriptorType::System32(SystemDescriptorTypes32::TSSBusy16), |
11 | | }; |
12 | | |
13 | 0 | DescriptorBuilder::with_base_limit(base, limit).set_type(typ) |
14 | 0 | } |
15 | | |
16 | 0 | fn call_gate_descriptor(selector: SegmentSelector, offset: u16) -> DescriptorBuilder { |
17 | 0 | DescriptorBuilder::with_selector_offset(selector, offset.into()).set_type( |
18 | 0 | DescriptorType::System32(SystemDescriptorTypes32::CallGate16), |
19 | | ) |
20 | 0 | } |
21 | | |
22 | 0 | fn interrupt_descriptor(selector: SegmentSelector, offset: u16) -> DescriptorBuilder { |
23 | 0 | DescriptorBuilder::with_selector_offset(selector, offset.into()).set_type( |
24 | 0 | DescriptorType::System32(SystemDescriptorTypes32::InterruptGate16), |
25 | | ) |
26 | 0 | } |
27 | | |
28 | 0 | fn trap_gate_descriptor(selector: SegmentSelector, offset: u16) -> DescriptorBuilder { |
29 | 0 | DescriptorBuilder::with_selector_offset(selector, offset.into()).set_type( |
30 | 0 | DescriptorType::System32(SystemDescriptorTypes32::TrapGate16), |
31 | | ) |
32 | 0 | } |
33 | | } |