How to setup the interupt vector table in asm

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
NANOSAURUS

How to setup the interupt vector table in asm

Post by NANOSAURUS »

Hey...
I have completed writing a kernel for my OS. How do
I set up the Interupt Vector/Descriptor Table(s) so
I can use my own interups, if anyone has a tut or can
just tell me how to do it. Any help is GREATLY Appreciated
thanks in advance
j.weeks

RE:How to setup the interupt vector table in asm

Post by j.weeks »

>On 2001-09-17 00:03:44, NANOSAURUS wrote:
>Hey...
>I have completed writing a kernel for my OS. How do
>I set up the Interupt Vector/Descriptor Table(s) so
>I can use my own interups, if anyone has a tut or can
>just tell me how to do it. Any help is GREATLY Appreciated
>thanks in advance

Same as in C, really. Just create an array of
structures of an IDT entry and fill 'em in.

I actually just hard code most of my idt values,
and have a couple c routines to read/write to the
idt as needed.

j.weeks
NANOSAURUS

Im in real mode......

Post by NANOSAURUS »

>On 2001-09-17 14:14:59, j.weeks wrote:
>>On 2001-09-17 00:03:44, NANOSAURUS wrote:
>>Hey...
>>I have completed writing a kernel for my OS. How do
>>I set up the Interupt Vector/Descriptor Table(s) so
>>I can use my own interups, if anyone has a tut or can
>>just tell me how to do it. Any help is GREATLY Appreciated
>>thanks in advance
>
>Same as in C, really. Just create an array of
>structures of an IDT entry and fill 'em in.
>
>I actually just hard code most of my idt values,
>and have a couple c routines to read/write to the
>idt as needed.
>
>j.weeks

I found out where its at in memory, I just cant seem to
set it up properly. my code to initialize my interupt follows:

mov AX, 1500h ; Segment to kernel = 1500h
xor BX, BX
mov FS, BX
cli
mov [FS:21h*4],ax
sti

im using NASM and yes I know int 21h is an MSDOS interupt
but im using it for now. It compiles fine and when i run
the program it just keeps restarting my system. If you
could answer why its doing this so i can better understand
the IVT a bit more i would greatly appreciate it.
Thanks in advance...NANOSAURUS
NANOSAURUS

Im in real mode......

Post by NANOSAURUS »

>On 2001-09-17 14:14:59, j.weeks wrote:
>>On 2001-09-17 00:03:44, NANOSAURUS wrote:
>>Hey...
>>I have completed writing a kernel for my OS. How do
>>I set up the Interupt Vector/Descriptor Table(s) so
>>I can use my own interups, if anyone has a tut or can
>>just tell me how to do it. Any help is GREATLY Appreciated
>>thanks in advance
>
>Same as in C, really. Just create an array of
>structures of an IDT entry and fill 'em in.
>
>I actually just hard code most of my idt values,
>and have a couple c routines to read/write to the
>idt as needed.
>
>j.weeks

I found out where its at in memory, I just cant seem to
set it up properly. my code to initialize my interupt follows:

mov AX, 1500h ; Segment to kernel = 1500h
xor BX, BX
mov FS, BX
cli
mov [FS:21h*4],ax
sti

im using NASM and yes I know int 21h is an MSDOS interupt
but im using it for now. It compiles fine and when i run
the program it just keeps restarting my system. If you
could answer why its doing this so i can better understand
the IVT a bit more i would greatly appreciate it.
Thanks in advance...NANOSAURUS
NANOSAURUS

Im in real mode......

Post by NANOSAURUS »

>On 2001-09-17 14:14:59, j.weeks wrote:
>>On 2001-09-17 00:03:44, NANOSAURUS wrote:
>>Hey...
>>I have completed writing a kernel for my OS. How do
>>I set up the Interupt Vector/Descriptor Table(s) so
>>I can use my own interups, if anyone has a tut or can
>>just tell me how to do it. Any help is GREATLY Appreciated
>>thanks in advance
>
>Same as in C, really. Just create an array of
>structures of an IDT entry and fill 'em in.
>
>I actually just hard code most of my idt values,
>and have a couple c routines to read/write to the
>idt as needed.
>
>j.weeks

I found out where its at in memory, I just cant seem to
set it up properly. my code to initialize my interupt follows:

mov AX, 1500h ; Segment to kernel = 1500h
xor BX, BX
mov FS, BX
cli
mov [FS:21h*4],ax
sti

im using NASM and yes I know int 21h is an MSDOS interupt
but im using it for now. It compiles fine and when i run
the program it just keeps restarting my system. If you
could answer why its doing this so i can better understand
the IVT a bit more i would greatly appreciate it.
Thanks in advance...NANOSAURUS
Iwabee

RE:Im in real mode......

Post by Iwabee »

Actually, you need more than that. That's how it
must look like:

xor bx, bx
mov fs, bx
cli
mov ax, my_21h_int
mov [fs:0x21 * 4], ax
mov ax, 0x1500
mov [fs:0x21 * 4 + 2], ax
sti
Post Reply