I have a strange problem when linking my kernel. Functions calls get screwed up. Here is the main kernel code
Code: Select all
void initialize() {
// loadGDT();
cli();
init_IDT();
init_interrupts();
init_pic(0x20, 0x28);
sti();
while(1) ;
}
The call to cli() works and returns fine. cli() is declared in an assembly file as global and as extern in a header file that this file includes.
Here is the code for init_IDT()
Code: Select all
void init_IDT() {
idtr.size = sizeof(IDT_entry) * MAX_INTERRUPTS;
idtr.offset = &idt;
load_IDT(&idtr);
}
It works up until the load_IDT call. Here is the bochs output when it reaches that point:
Code: Select all
Next at t=157124767
(0) [0xfffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
For some reason, its compiling that instruction as a jmp far instead of a call. load_IDT has been coded in assembly the same way as cli, but for some reason wont work while cli does.