AT&T Assembly - Setup all 256 entries in IDT
Posted: Fri Nov 23, 2012 9:31 pm
Hello,
is there a simple way of creating a IDT with 256 elements in AT&T assembly?
For example like this:
and then:
Well this not really good this leaves a empty space of 256x8 Bytes in my code?
Hm or perhaps I should push the addresses of the GDT and IDT to my kernel so I can use C language?
I want to avoid this:
Thank you
is there a simple way of creating a IDT with 256 elements in AT&T assembly?
For example like this:
Code: Select all
idt:
.fill 256, 8, 0 # IDT is uninitialized 256 x 8 Byte with 0
idt_end:
idtptr:
.word (idt_end - idt - 1)
.long (idt + 0x0500)
Code: Select all
SetupIdt:
lea idt, %edi # Load Effective Address of IDT
movw $256, %cx # Setup Counter
SetupNextIdtEntry:
lea DefIsr, %ax # Load Effective Address of Default ISR
movw %ax, (%di)
movw $0x0008, %ax
movw %ax, 2(%di)
movb $0x00, %al
movb %al, 4(%di)
movb $0xae, %al
movb %al, 5(%di)
movw $0x0000, %ax
movw %ax, 6(%di)
addw $8, %di
decw %cx
cmpw $0, %cx
jne SetupNextIdtEntry
lidt idtptr # Load Interrupt Descriptor Table
ret
DefIsr:
call kisr
iret
Hm or perhaps I should push the addresses of the GDT and IDT to my kernel so I can use C language?
I want to avoid this:
Code: Select all
idt:
# ISR 000
.word ISR000
.word 0x0008
.byte 0x00
.byte 0xae
.word 0x0000
.........
# ISR 255
.word ISR255
.word 0x0008
.byte 0x00
.byte 0xae
.word 0x0000
idt_end:
idtptr:
.word (idt_end - idt - 1)
.long (idt + 0x0500)