Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename divide_by_zero field of IDT to divide_error #108

Merged
merged 2 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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