Page 1 of 1

How to setup the interupt vector table in asm

Posted: Sun Sep 16, 2001 11:00 pm
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

RE:How to setup the interupt vector table in asm

Posted: Sun Sep 16, 2001 11:00 pm
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

Im in real mode......

Posted: Thu Sep 20, 2001 11:00 pm
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

Im in real mode......

Posted: Thu Sep 20, 2001 11:00 pm
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

Im in real mode......

Posted: Thu Sep 20, 2001 11:00 pm
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

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

Posted: Mon Sep 24, 2001 11:00 pm
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