Newbie needing clarification.
Posted: Tue Aug 28, 2007 4:23 pm
Up until now i'd been building a 16bit realmode OS which was nice and simple and didn't really pose a challenge at all, just make a simple command parser for a shell and let BIOS interrupts do all the work. I've now decided to get into the *good* stuff and do something that isn't so monotanous. So I've been trying to get into 32bit programming and leave those nice easy BIOS interrupts behind and do something relatively challenging .
But alas it's too challenging and i need some help getting a understanding of how this mess of gdt's, idt's, isr's and irqs work. I'd appreciate it if you could maybe scan through my questions and perhaps shed some light on my confusion.
GDT - okay all i know is that it has something to do with paging (one of the bits enables it, or at least allows it) and you need one for protected mode. I'm guessing from this i can create new entries and each entry would be protected from the next? can someone give a blunt explanation of it's uses?
ISR's - Interrupt service routines are the routines that get called when someone tries to divide by 0 or something else wrong right? and you need to make loads of structures of idt entries to map them to an ISR routine right? I really could do with some examples.
IRQS - from what i've read these are channels you can use to interact with hardware where most of them are reserved and isn't really necessary but somehow better than just using "out" instructions, right? I've been trying to make a 32bit routine for getting input via the keyboard and apparently this is the best (or only) way to go about it, as apparently channel 1 (the keyboard channel) fires an interrupt whenever a key is pressed and is my cue to read from from port 64 (or 60??) to fetch the letter. Have i got the idea? does someone have any examples?
64bit mode - other than having 64bit registers and some extra instructions apparently you can only use paging and you can't use "hardware multitasking", is hardware mulitasking the tss? (whats the tss btw? something to do with gdt?) and how would i go about making software mulititasking? obviously i'd do everything in 32bit first and then possibly port it to 64bit, i'd just dont want to build a hardware task switcher and then spend weeks rebuilding a software one if you get my drift. I've yet to read through AMD's docs though, although i'd appreciate it if you could shed some light as intels and amd's docs aren't that good at explaining things.
Stack - i've spent the last 2 hours constantly changing where and how big my stack is, i don't know how big a stack can get (i'd imagine about 200 bytes tops right?) but i've currently got it situated under my kernel at 0x7E00 and the kernel starts at 0x10000, i should think thats enough room? and is under the kernel a good idea? I'm very fussy and don't like wasting memory or being inefficient (done everything in assembly so far, i'd hate to use C :p).
I'd very much appreciate some guidance from you no matter how short or small, feel free to bombard me with links to random pages and as i really am struggling to find out how these things work.
But alas it's too challenging and i need some help getting a understanding of how this mess of gdt's, idt's, isr's and irqs work. I'd appreciate it if you could maybe scan through my questions and perhaps shed some light on my confusion.
GDT - okay all i know is that it has something to do with paging (one of the bits enables it, or at least allows it) and you need one for protected mode. I'm guessing from this i can create new entries and each entry would be protected from the next? can someone give a blunt explanation of it's uses?
ISR's - Interrupt service routines are the routines that get called when someone tries to divide by 0 or something else wrong right? and you need to make loads of structures of idt entries to map them to an ISR routine right? I really could do with some examples.
IRQS - from what i've read these are channels you can use to interact with hardware where most of them are reserved and isn't really necessary but somehow better than just using "out" instructions, right? I've been trying to make a 32bit routine for getting input via the keyboard and apparently this is the best (or only) way to go about it, as apparently channel 1 (the keyboard channel) fires an interrupt whenever a key is pressed and is my cue to read from from port 64 (or 60??) to fetch the letter. Have i got the idea? does someone have any examples?
64bit mode - other than having 64bit registers and some extra instructions apparently you can only use paging and you can't use "hardware multitasking", is hardware mulitasking the tss? (whats the tss btw? something to do with gdt?) and how would i go about making software mulititasking? obviously i'd do everything in 32bit first and then possibly port it to 64bit, i'd just dont want to build a hardware task switcher and then spend weeks rebuilding a software one if you get my drift. I've yet to read through AMD's docs though, although i'd appreciate it if you could shed some light as intels and amd's docs aren't that good at explaining things.
Stack - i've spent the last 2 hours constantly changing where and how big my stack is, i don't know how big a stack can get (i'd imagine about 200 bytes tops right?) but i've currently got it situated under my kernel at 0x7E00 and the kernel starts at 0x10000, i should think thats enough room? and is under the kernel a good idea? I'm very fussy and don't like wasting memory or being inefficient (done everything in assembly so far, i'd hate to use C :p).
I'd very much appreciate some guidance from you no matter how short or small, feel free to bombard me with links to random pages and as i really am struggling to find out how these things work.