Page 1 of 1

How to implement system services?

Posted: Thu Jul 19, 2007 7:22 am
by SolidSnake
I have followed simple tutorial in creating OS..

I learned how to implement GDT dan IDT, then switch to protected mode.. But I still don't fully understand how IRQs work and implementation of TSS..

I want to know how can I create system services to be called by applications in the OS. In the tutorial, there are a function to write to display buffer.. Is that what we call system services? If so, then I must write call-gate so application in PL 3 can call the function in PL 0, right? But how applications know to locate the call-gate? Are all system services located in one "kernel.bin" file too?

Can I just use the IDT to provide call to system services? Why Windows don't do like that such as in DOS before?

Btw, can I still use BIOS interrupt to communicate with motherboard? I mean by preserving and adjusting the address in real-mode interrupt vector table to p-mode IDT? Is it useful or there are new way?

Sorry for too many questions, I'm just curious about a lot of thing and don't know how to learn them by myself.

Posted: Thu Jul 19, 2007 1:04 pm
by Pyrofan1
Can I just use the IDT to provide call to system services?
yes you can, just create an interrupt that calls a system function that checks the value of eax and then does something.
But I still don't fully understand how IRQs work
IRQs are just interrupts made by hardware
and implementation of TSS..
in TSS you have a segment in the GDT that points to the tss and then you load the TSS with

Code: Select all

ltr $tss_selector
Are all system services located in one "kernel.bin" file too?
if you have a monolithic kernel
Btw, can I still use BIOS interrupt to communicate with motherboard?
not unless you're in VM86 or real mode
I'm just curious about a lot of thing and don't know how to learn them by myself.
the wiki and the intel manuals are great resources

Posted: Thu Jul 19, 2007 1:27 pm
by Dex
Btw, can I still use BIOS interrupt to communicate with motherboard?
If you make addressing identical in real mode and protected mode, by setting the base of the code and data descriptors to DS * 16, then you can write a simple function to go to and from realmode to do BIOS int's or you can use a "BIOS32".