aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Gerd Zellweger <mail@gerdzellweger.com> 2016-05-28 00:19:18 +0200
committerGravatar Gerd Zellweger <mail@gerdzellweger.com> 2016-05-28 00:19:18 +0200
commit32257991aaa3700620f1d6c180cfec3e2d65a360 (patch)
treebe1faf1986b0f0651e09fe8f643901483112aff0
parent32dbae106654aa89a4aca8ab92fae13b668121f2 (diff)
parent30b3409c75dfce783b430e3bf50fa5b1f6e344d8 (diff)
downloadrust-x86-32257991aaa3700620f1d6c180cfec3e2d65a360.tar.gz
rust-x86-32257991aaa3700620f1d6c180cfec3e2d65a360.tar.zst
rust-x86-32257991aaa3700620f1d6c180cfec3e2d65a360.zip
Merge pull request #14 from dschatzberg/change_interrupt_gate
Modify irq::interrupt_gate() signature
-rw-r--r--src/irq.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/irq.rs b/src/irq.rs
index 046fce9..10be7fa 100644
--- a/src/irq.rs
+++ b/src/irq.rs
@@ -1,6 +1,7 @@
//! Interrupt description and set-up code.
use core::fmt;
+use paging::VAddr;
/// x86 Exception description (see also Intel Vol. 3a Chapter 6).
#[derive(Debug)]
@@ -250,15 +251,15 @@ impl IdtEntry {
/// Create an interrupt gate with the "Present" flag set, which is the
/// most common case. If you need something else, you can construct it
/// manually.
- pub fn interrupt_gate(gdt_code_selector: u16, handler: *const u8) -> IdtEntry {
+ pub const fn interrupt_gate(gdt_code_selector: u16, handler: VAddr) -> IdtEntry {
IdtEntry {
- base_lo: ((handler as u64) & 0xFFFF) as u16,
+ base_lo: ((handler.as_usize() as u64) & 0xFFFF) as u16,
sel: gdt_code_selector,
res0: 0,
// Bit 7: "Present" flag set.
// Bits 0-4: This is an interrupt gate.
flags: 0b1000_1110,
- base_hi: (handler as u64) >> 16,
+ base_hi: handler.as_usize() as u64 >> 16,
res1: 0,
}
}