valid idt
Posted: Tue Oct 14, 2008 1:25 pm
hi, why this is not a valid idt?
Thanks
Thanks
Can you rephrase this? I dont understand what you are referring to here.i like this way! hear...
now serius what is the other way, give me some example...
thanks!
Personally I would enter 32-bit protected mode and set up the IDT afterwards (and maybe code it in C). It makes it easier to handle things like 32-bit pointers. Just remember to disable interrupts until the IDT is setup.mobruan wrote:i like this way! hear...
now serius what is the other way, give me some example...
thanks!
Code: Select all
SECTION .text ; Code section
BITS 32 ; We entered protected mode
...
setup_idt:
; Setup IDT entry 1 pointing to 'isr'.
mov eax, isr ; Load the ISR offset in EAX
mov [idt_entry_1 + 0], ax ; Store the offset bits 0..15
shr eax, 16
mov [idt_entry_1 + 6], ax ; Store the offset bits 16..31
; Load IDT.
lidt [idt]
...
SECTION .data ; Data section
idt:
dw idt_table_end - idt_table_begin - 1 ; Limit (automatically calculated)
dd idt_table_begin ; Base address
idt_table_begin:
; The following really should be replaced by some macro... google!
idt_entry_0:
dw 0 ; Offset bits 0..15
dw 0x8 ; Code segment selector
db 0, 10001110b ; Type and attributes
dw 0 ; Offset bits 16..31
idt_entry_1:
dw 0 ; Offset bits 0..15
dw 0x8 ; Code segment selector
db 0, 10001110b ; Type and attributes
dw 0 ; Offset bits 16..31
...
idt_table_end:
Code: Select all
lidt [IDTR]
...
align 2
IDTR:
dw IDT_SIZE-1 ; 256*8-1
dd IDT
align 8
IDT:
desc KCODE, ehandler_0, DF_INT32 ; or DF_TRAP32
desc KCODE, ehandler_1, DF_INT32 ; or DF_TRAP32
...
IDT_SIZE = $-IDT
You can find a lot of information about linking object files or using inline asm in C on the wiki and the web. Have you read the forum rules, and have you searched for the knowledge yourself?mobruan wrote:it´s me again, i dont know how to use assembly together with c.
Anyone has a good tutorial?