flat assembler
Message board for the users of flat assembler.

Index > OS Construction > where shold i put my IDT? HELP!?

Author
Thread Post new topic Reply to topic
archie



Joined: 08 Dec 2005
Posts: 4
archie
i am newbie in OS construction and trying some changes on FritzOS, first FritzOS does not have IDT and i want to put my IDT.. the GDTR is defined:

Code:
GDTR
        dw gdt_end - gdt - 1
        dd gdt+0x20000
gdt
        nullsel equ $-gdt
gdt0
        dd 0
        dd 0
CodeSel equ $-gdt
        dw 0ffffh
        dw 0
        db 2
        db 09ah
        db 0cfh
        db 0h
DataSel equ $-gdt
        dw 0ffffh
        dw 0h
        db 2h
        db 092h
        db 0cfh
        db 0
gdt_end    


and this GDT is working fine but i want to put an IDT and a keyboard interrupt handler but how must i put IDT??
Code:
IDTR
     dw  0x800 ; 256 interrupts and 8bytes each
     dd <what must be the address????>
    


if you can help i will be very happy..
Post 08 Dec 2005, 16:13
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
The place and location of the IDT in memory is of no importance whatsoever. ANY 16bytes aligned address will do. After that "dd" you must place "offset my_own_idt_table".

Of course depending on the OS memory layout, the loading sequence and author personal preferences combined with the "phases of the moon at Edora" and the number of hair pulled divided by "something" ... THIS value might be anything Wink.

Changing somebody else's OS source without understanding is the correct path to FRUSTRATION. It works ok just until you hit some conceptual barrier; after that you will need more hair to pull off.

Seriousely without knowing the way that FritzOS is loaded into memory (see that 0x20000 added to GDT?) and the original author's preferences and understanding the sources --> there is no way of telling Wink

The basic concept / ideea is that the IDT can be placed anywhere.
If you want to return to BIOS real mode you should avoid the original realmode IDT location (aka 0).

Depending on OS specifics...
Post 08 Dec 2005, 18:04
View user's profile Send private message Visit poster's website Reply with quote
archie



Joined: 08 Dec 2005
Posts: 4
archie
thanks i give the address like you said and made a little more organization and now my interrupts are working
Post 08 Dec 2005, 18:58
View user's profile Send private message Reply with quote
darius



Joined: 02 Dec 2005
Posts: 2
darius
hello I need an simiar help Smile

I have similar problems about GDT from fritzOS and I am also an newbie in os development subjects..

I have an GDT set up definition in an kernel.asm
but I used some different codes from internet.
in my original kernel.asm, the GDT is like that :
I have this GDT:
--------------------------------------------------
; GDTR


; Make a new GDT for the IDT
; Global Descriptor Table: This tells the computer where all the
segments ( now selectors ) are.
GDTR
dw gdt_end-1
dd gdt+0x20000
gdt
nullsel equ $-gdt
gdt0
dd 0
dd 0
CodeSel equ $-gdt
dw 0ffffh
dw 0
db 2
db 09ah
db 0cfh
db 0h
DataSel equ $-gdt
dw 0ffffh
dw 0h
db 2h
db 092h
db 0cfh
db 0
gdt_end


; End of GDTR


---------------------------------------------------------------------------­­--------------------------------------------------------------------------­-­--------------------


but in this code that I used ,the GDT set up like that so the IDT and LDT definition based on this definitions:


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;­­;;;


gdt:
; NULL descriptor
dw 0 ; limit 15:0
dw 0 ; base 15:0
db 0 ; base 23:16
db 0 ; type
db 0 ; limit 19:16, flags
db 0 ; base 31:24


; unused descriptor
dw 0
dw 0
db 0
db 0
db 0
db 0


LINEAR_DATA_SEL equ $-gdt
dw 0FFFFh
dw 0
db 0
db 92h ; present, ring 0, data, expand-up, writable
db 0CFh ; page-granular (4 gig limit), 32-bit
db 0


LINEAR_CODE_SEL equ $-gdt
dw 0FFFFh
dw 0
db 0
db 9Ah ; present,ring 0,code,non-conforming,readable
db 0CFh ; page-granular (4 gig limit), 32-bit
db 0
gdt_end:


gdt_ptr:
dw gdt_end - gdt - 1
dd gdt


---------------------------------------------------------------------------­­--------------------------------------------------------------------------­-­---------


SO first I tried simply changing the first GDT definition to second
one.But this does not work.
I looked up the loader.asm of my code.And there is some operation on
GDT in loader.asm too.
So my question is : how can I change my first GDT definition to second
one..is there any special method??
first as I sad,i simply copied +pasted last one; but then cpu loop
forever.
what should I consider for changing???
thank you very much for all help....
Post 08 Dec 2005, 19:36
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.