Skip to content

Commit

Permalink
Merge pull request #108 from rust-osdev/divide-error
Browse files Browse the repository at this point in the history
Rename divide_by_zero field of IDT to divide_error
  • Loading branch information
phil-opp committed Dec 10, 2019
2 parents 3299189 + 08ec6cb commit c82c7c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changelog.md
@@ -1,5 +1,6 @@
- **Breaking:** Replace `ux` dependency with custom wrapper structs ([#91](https://github.com/rust-osdev/x86_64/pull/91))
- **Breaking:** Add new UnsafePhysFrame type and use it in Mapper::map_to ([#89](https://github.com/rust-osdev/x86_64/pull/89))
- **Breaking:** Rename divide_by_zero field of interrupt descriptor table to divide_error ([#108](https://github.com/rust-osdev/x86_64/pull/108))
- _Possibly Breaking:_ Make Mapper trait object safe by adding `Self: Sized` bounds on generic functions ([#84](https://github.com/rust-osdev/x86_64/pull/84))


Expand Down
14 changes: 7 additions & 7 deletions src/structures/idt.rs
Expand Up @@ -21,7 +21,7 @@ use core::ops::{Deref, Index, IndexMut, RangeBounds};
///
/// The first 32 entries are used for CPU exceptions. These entries can be either accessed through
/// fields on this struct or through an index operation, e.g. `idt[0]` returns the
/// first entry, the entry for the `divide_by_zero` exception. Note that the index access is
/// first entry, the entry for the `divide_error` exception. Note that the index access is
/// not possible for entries for which an error code is pushed.
///
/// The remaining entries are used for interrupts. They can be accesed through index
Expand All @@ -37,14 +37,14 @@ use core::ops::{Deref, Index, IndexMut, RangeBounds};
#[repr(C)]
#[repr(align(16))]
pub struct InterruptDescriptorTable {
/// A divide by zero exception (`#DE`) occurs when the denominator of a DIV instruction or
/// A divide error (`#DE`) occurs when the denominator of a DIV instruction or
/// an IDIV instruction is 0. A `#DE` also occurs if the result is too large to be
/// represented in the destination.
///
/// The saved instruction pointer points to the instruction that caused the `#DE`.
///
/// The vector number of the `#DE` exception is 0.
pub divide_by_zero: Entry<HandlerFunc>,
pub divide_error: Entry<HandlerFunc>,

/// When the debug-exception mechanism is enabled, a `#DB` exception can occur under any
/// of the following circumstances:
Expand Down Expand Up @@ -373,7 +373,7 @@ impl InterruptDescriptorTable {
/// Creates a new IDT filled with non-present entries.
pub const fn new() -> InterruptDescriptorTable {
InterruptDescriptorTable {
divide_by_zero: Entry::missing(),
divide_error: Entry::missing(),
debug: Entry::missing(),
non_maskable_interrupt: Entry::missing(),
breakpoint: Entry::missing(),
Expand Down Expand Up @@ -403,7 +403,7 @@ impl InterruptDescriptorTable {

/// Resets all entries of this IDT in place.
pub fn reset(&mut self) {
self.divide_by_zero = Entry::missing();
self.divide_error = Entry::missing();
self.debug = Entry::missing();
self.non_maskable_interrupt = Entry::missing();
self.breakpoint = Entry::missing();
Expand Down Expand Up @@ -497,7 +497,7 @@ impl Index<usize> for InterruptDescriptorTable {
/// exception that pushes an error code (use the struct fields for accessing these entries).
fn index(&self, index: usize) -> &Self::Output {
match index {
0 => &self.divide_by_zero,
0 => &self.divide_error,
1 => &self.debug,
2 => &self.non_maskable_interrupt,
3 => &self.breakpoint,
Expand Down Expand Up @@ -527,7 +527,7 @@ impl IndexMut<usize> for InterruptDescriptorTable {
/// exception that pushes an error code (use the struct fields for accessing these entries).
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
match index {
0 => &mut self.divide_by_zero,
0 => &mut self.divide_error,
1 => &mut self.debug,
2 => &mut self.non_maskable_interrupt,
3 => &mut self.breakpoint,
Expand Down

0 comments on commit c82c7c4

Please sign in to comment.