Hello.
Here is part of my boiler-plate:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:Text section
lidt [idt_pointer]
call main
jmp $
;My only ISR for now
isr:
pusha
push gs
push fs
push es
push ds
extern interrupt_service_routine
call interrupt_service_routine
pop ds
pop es
pop fs
pop gs
popa
iret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Data section
start_of_idt:
dw 0x0000
dw 0x10
dw 0x8E00
dw 0x20
dw 0x0000
dw 0x10
dw 0x8E00
dw 0x20
dw 0x0000
dw 0x10
dw 0xE00
dw 0x20
%rep 0xC
dw 0x0000
dw 0x10
dw 0x8E00
dw 0x20
%endrep
dw 0x0000
dw 0x10
dw 0xE00
dw 0x20
dw 0x0000
dw 0x10
dw 0x8E00
dw 0x20
end_of_idt:
idt_pointer:
dw end_of_idt - start_of_idt - 1
dd start_of_idt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I want to keep this as simple as I can.
The question is:
what do I have to change from IDT
dw 0x0000
dw 0x10
dw 0x8E00
dw 0x20
if I want it to jump to "isr" when the interrupt comes?
IDT in asm
Re:IDT in asm
This should be all in the intel manuals.
The best is IMO to write a setup function that shifts the address of the isr in the right way, and then inserts it in the idt-entries. Note that you most likely need a seperate ISR for every idt-entry since there is no other way to determine which interrupt actually fired the ISR.
cheers Joe
Code: Select all
dw 0x0000 << these are the lower 16 bits of 'isr'
dw 0x10
dw 0x8E00
dw 0x20 << these are the higher 16 bits of 'isr'
The best is IMO to write a setup function that shifts the address of the isr in the right way, and then inserts it in the idt-entries. Note that you most likely need a seperate ISR for every idt-entry since there is no other way to determine which interrupt actually fired the ISR.
cheers Joe
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:IDT in asm
Just like any other symbol ... tell the linker it's a global symbol, make sure your assembler code and C compiler follow the same mangling rules (e.g. that they both do/don't prepend a "_" character in front of global names) and you're done.
If you created the table dynamically in asm, just set its address to a global variable. That will work too
If you created the table dynamically in asm, just set its address to a global variable. That will work too