Skip to content

Commit 9de5326

Browse files
strakephil-opp
authored andcommitted
impl Clone for various types, impl Eq for Port (#43)
1 parent 3ee1498 commit 9de5326

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/instructions/port.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl PortReadWrite for u32 {
6363
}
6464

6565
/// An I/O port.
66-
#[derive(Debug)]
66+
#[derive(Debug, Clone, PartialEq, Eq)]
6767
pub struct Port<T: PortReadWrite> {
6868
port: u16,
6969
phantom: PhantomData<T>,

src/structures/gdt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl fmt::Debug for SegmentSelector {
5050
/// switching between user and kernel mode or for loading a TSS.
5151
///
5252
/// The GDT has a fixed size of 8 entries, trying to add more entries will panic.
53-
#[derive(Debug)]
53+
#[derive(Debug, Clone)]
5454
pub struct GlobalDescriptorTable {
5555
table: [u64; 8],
5656
next_free: usize,
@@ -109,7 +109,7 @@ impl GlobalDescriptorTable {
109109
///
110110
/// Segmentation is no longer supported in 64-bit mode, so most of the descriptor
111111
/// contents are ignored.
112-
#[derive(Debug)]
112+
#[derive(Debug, Clone)]
113113
pub enum Descriptor {
114114
/// Descriptor for a code or data segment.
115115
///

src/structures/idt.rs

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use {PrivilegeLevel, VirtAddr};
3131
/// [AMD64 manual volume 2](https://support.amd.com/TechDocs/24593.pdf)
3232
/// (with slight modifications).
3333
#[allow(missing_debug_implementations)]
34+
#[derive(Clone)]
3435
#[repr(C)]
3536
pub struct InterruptDescriptorTable {
3637
/// A divide by zero exception (`#DE`) occurs when the denominator of a DIV instruction or
@@ -637,6 +638,7 @@ impl EntryOptions {
637638
}
638639

639640
/// Represents the exception stack frame pushed by the CPU on exception entry.
641+
#[derive(Clone)]
640642
#[repr(C)]
641643
pub struct ExceptionStackFrame {
642644
/// This value points to the instruction that should be executed when the interrupt

0 commit comments

Comments
 (0)