Skip to content

Commit 6100b77

Browse files
strakephil-opp
authored andcommitted
impl Debug (#39)
1 parent 54d3fd0 commit 6100b77

File tree

10 files changed

+18
-4
lines changed

10 files changed

+18
-4
lines changed

src/instructions/port.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ impl PortReadWrite for u32 {
6363
}
6464

6565
/// An I/O port.
66+
#[derive(Debug)]
6667
pub struct Port<T: PortReadWrite> {
6768
port: u16,
6869
phantom: PhantomData<T>,

src/instructions/tables.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use structures::gdt::SegmentSelector;
44

55
/// A struct describing a pointer to a descriptor table (GDT / IDT).
66
/// This is in a format suitable for giving to 'lgdt' or 'lidt'.
7+
#[derive(Debug, Clone, Copy)]
78
#[repr(C, packed)]
89
pub struct DescriptorTablePointer {
910
/// Size of the DT.

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#![cfg_attr(feature = "deny-warnings", deny(missing_docs))]
1111
#![cfg_attr(not(feature = "deny-warnings"), warn(missing_docs))]
1212

13+
#![deny(missing_debug_implementations)]
14+
1315
#[cfg(test)]
1416
#[macro_use]
1517
extern crate std;

src/registers/control.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use structures::paging::PhysFrame;
66
use PhysAddr;
77

88
/// Various control flags modifying the basic operation of the CPU.
9+
#[derive(Debug)]
910
pub struct Cr0;
1011

1112
impl Cr0 {
@@ -91,6 +92,7 @@ bitflags! {
9192
}
9293

9394
/// Contains the physical address of the level 4 page table.
95+
#[derive(Debug)]
9496
pub struct Cr3;
9597

9698
impl Cr3 {

src/registers/model_specific.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Functions to read and write control registers.
22
33
/// A model specific register.
4+
#[derive(Debug)]
45
pub struct Msr(u32);
56

67
impl Msr {
@@ -25,6 +26,7 @@ impl Msr {
2526
}
2627

2728
/// The Extended Feature Enable Register.
29+
#[derive(Debug)]
2830
pub struct Efer;
2931

3032
impl Efer {

src/structures/gdt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +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)]
5354
pub struct GlobalDescriptorTable {
5455
table: [u64; 8],
5556
next_free: usize,
@@ -108,6 +109,7 @@ impl GlobalDescriptorTable {
108109
///
109110
/// Segmentation is no longer supported in 64-bit mode, so most of the descriptor
110111
/// contents are ignored.
112+
#[derive(Debug)]
111113
pub enum Descriptor {
112114
/// Descriptor for a code or data segment.
113115
///

src/structures/idt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use {PrivilegeLevel, VirtAddr};
3030
/// The field descriptions are taken from the
3131
/// [AMD64 manual volume 2](https://support.amd.com/TechDocs/24593.pdf)
3232
/// (with slight modifications).
33+
#[allow(missing_debug_implementations)]
3334
#[repr(C)]
3435
pub struct InterruptDescriptorTable {
3536
/// A divide by zero exception (`#DE`) occurs when the denominator of a DIV instruction or
@@ -505,7 +506,7 @@ impl IndexMut<usize> for InterruptDescriptorTable {
505506
///
506507
/// The generic parameter can either be `HandlerFunc` or `HandlerFuncWithErrCode`, depending
507508
/// on the interrupt vector.
508-
#[derive(Clone, Copy)]
509+
#[derive(Debug, Clone, Copy)]
509510
#[repr(C)]
510511
pub struct Entry<F> {
511512
pointer_low: u16,

src/structures/paging/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ pub trait PageSize: Copy + Eq + PartialOrd + Ord {
3131
pub trait NotGiantPageSize: PageSize {}
3232

3333
/// A standard 4KiB page.
34-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
34+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
3535
pub enum Size4KiB {}
3636

3737
/// A “huge” 2MiB page.
38-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
38+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
3939
pub enum Size2MiB {}
4040

4141
/// A “giant” 1GiB page.
4242
///
4343
/// (Only available on newer x86_64 CPUs.)
44-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
44+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
4545
pub enum Size1GiB {}
4646

4747
impl PageSize for Size4KiB {

src/structures/paging/recursive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use {PhysAddr, VirtAddr};
1515
/// The old mapping might be still cached in the translation lookaside buffer (TLB), so it needs
1616
/// to be flushed from the TLB before it's accessed. This type is returned from function that
1717
/// change the mapping of a page to ensure that the TLB flush is not forgotten.
18+
#[derive(Debug)]
1819
#[must_use = "Page Table changes must be flushed or ignored."]
1920
pub struct MapperFlush<S: PageSize>(Page<S>);
2021

@@ -94,6 +95,7 @@ pub trait Mapper<S: PageSize> {
9495
/// level 3 index, then the level 2 index.
9596
///
9697
/// This struct implements the `Mapper` trait.
98+
#[derive(Debug)]
9799
pub struct RecursivePageTable<'a> {
98100
p4: &'a mut PageTable,
99101
recursive_index: u9,

src/structures/tss.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use VirtAddr;
66
/// directly related to the task-switch mechanism,
77
/// but is used for finding kernel level stack
88
/// if interrupts arrive while in kernel mode.
9+
#[derive(Debug, Clone, Copy)]
910
#[repr(C, packed)]
1011
pub struct TaskStateSegment {
1112
reserved_1: u32,

0 commit comments

Comments
 (0)