Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
I know my idt and idt_pointer are valid, because they work. but they're defined in asm.
Rust code:
extern {
static idt: u64;
static idt_pointer: IdtPointer;
}
#[derive(Debug)]
#[repr(packed,C)]
pub struct IdtPointer {
limit: u16,
base: u64,
}
assembly:
global idt
global idt_pointer
idt:
%assign i 0
%rep 256
IDT_ENTRY i
%assign i i+1
%endrep
idt_pointer:
dw 4095 ; limit
dq idt
This then prints false.
kprintln!("IDT INFO");
kprintln!("--------");
kprintln!("idt: {:?}", idt);
kprintln!("idt_pointer: {:#?}", idt_pointer);
kprintln!("equal: {}", idt_pointer.base == idt);
why?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment