Memory Management and VGA\Vesa programming
-
- Posts: 10
- Joined: Mon Sep 28, 2009 11:06 am
Memory Management and VGA\Vesa programming
I've been looking for some good tutorials on programing a memory manager efficiently, but I'm finding it's rather hard to find any resources on O.S development. I'm also interested in using VGA display modes, and possibly vesa, but I am not yet experienced with VGA, and I don't feel comfortable moving to vesa. After studying windows for a while now, I think I have a good understanding how I can setup a multi-threading system, but I believe I could benefit with some review.
The current stage of my OS, is I have setup a GDT, IDT, and the ISRs numbered 0-31, remapped the interrupts used for IRQs by programming the PIC, I've also setup some IRQ routines for the keyboard and PIT.
I am currently using a segmentation memory model, but would prefer paging, but like said, I am having trouble locating some decent amount of information on these topics. Does anyone know where I can find information about these topics? I've been googling for a while now.
The current stage of my OS, is I have setup a GDT, IDT, and the ISRs numbered 0-31, remapped the interrupts used for IRQs by programming the PIC, I've also setup some IRQ routines for the keyboard and PIT.
I am currently using a segmentation memory model, but would prefer paging, but like said, I am having trouble locating some decent amount of information on these topics. Does anyone know where I can find information about these topics? I've been googling for a while now.
Re: Memory Management and VGA\Vesa programming
Hello,
There are alot of good resources on paging. Taking into account that they are in the Intel manuals, perhaps these can help:
Tutorial 1
Tutorial 2
Tutorial 3
Memory management is a very complex topic along with VBE ("Vesa") and VGA. I -highly- recommend working on one at a time. I also recommend having a physical frame allocator before a virtual memory allocator.
There are alot of good resources on paging. Taking into account that they are in the Intel manuals, perhaps these can help:
Tutorial 1
Tutorial 2
Tutorial 3
Memory management is a very complex topic along with VBE ("Vesa") and VGA. I -highly- recommend working on one at a time. I also recommend having a physical frame allocator before a virtual memory allocator.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
-
- Posts: 10
- Joined: Mon Sep 28, 2009 11:06 am
Re: Memory Management and VGA\Vesa programming
Thank you very much, that's exactly what I was looking for. I do intend to only work on one at a time. Thanks again.neon wrote:Hello,
There are alot of good resources on paging. Taking into account that they are in the Intel manuals, perhaps these can help:
Tutorial 1
Tutorial 2
Tutorial 3
Memory management is a very complex topic along with VBE ("Vesa") and VGA. I -highly- recommend working on one at a time. I also recommend having a physical frame allocator before a virtual memory allocator.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Memory Management and VGA\Vesa programming
Hi: I'm glad you found the information you were looking for. It is of some slight importance, though, that I mention that you probably aren't too good with google: Link. The first, 4th, and 5th results are pretty good: I didn't even bother to scroll; The 4th one seems especially good.
And those are excluding wikipedia. Maybe you could try the right keywords when searching next time? Paging is a general concept that applies to more than one processor architecture. Searching for "Paging" is about as ambiguous as searching for "toes", and expecting to find information on a specific species' toes only.
x86 is the most prominent architecture to those who use the internet on PC, so its results are more numerous, but paging itself is not limited to the x86.
And those are excluding wikipedia. Maybe you could try the right keywords when searching next time? Paging is a general concept that applies to more than one processor architecture. Searching for "Paging" is about as ambiguous as searching for "toes", and expecting to find information on a specific species' toes only.
x86 is the most prominent architecture to those who use the internet on PC, so its results are more numerous, but paging itself is not limited to the x86.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: Memory Management and VGA\Vesa programming
This is a good over view for paging http://www.rohitab.com/discuss/index.ph ... opic=31139
-
- Posts: 10
- Joined: Mon Sep 28, 2009 11:06 am
Re: Memory Management and VGA\Vesa programming
Just because I can't locate information on a topic I've never worked with before doesn't mean I am no good at googling. I admit I should've been more descriptive in my searches(although you have no idea what it was I was searching with..). And I assure you, for a beginner knowing the keywords on the topic I do, I was using all that I knew(However, using keywords in subject you haven't yet studied is a bit difficult) I don't believe it can be summed up with "You're horrible using google.".gravaera wrote:Hi: I'm glad you found the information you were looking for. It is of some slight importance, though, that I mention that you probably aren't too good with google: Link. The first, 4th, and 5th results are pretty good: I didn't even bother to scroll; The 4th one seems especially good.
And those are excluding wikipedia. Maybe you could try the right keywords when searching next time? Paging is a general concept that applies to more than one processor architecture. Searching for "Paging" is about as ambiguous as searching for "toes", and expecting to find information on a specific species' toes only.
x86 is the most prominent architecture to those who use the internet on PC, so its results are more numerous, but paging itself is not limited to the x86.
Anyways, I have another quick question, I've implemented a physical and virtual memory manager, and I noticed when I increase the amount of memory the system has, I get a system reset, after a bit of debugging I noticed my PMM's bitmap was overwriting some important memory as it grew with the system memory. I was wondering where I can safely place the bitmap, as I have no way of allocating memory without my PMM, which isn't inited until I pass it a bitmap. I was thinking of moving the base address of where my kernel is loaded up, and place the bitmap where the bootsector was loaded, overwriting the bootsector, but being inexperienced in this subject, I was wonder what you've done, because I think my choice could effect the stability of my operating system. As far as I've read the tutorial suggest I place it at 0x0, however that's where it was when the crash occurred.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Memory Management and VGA\Vesa programming
Hi:jeremy6996 wrote:...gravaera wrote:...
Anyways, I have another quick question, I've implemented a physical and virtual memory manager, and I noticed when I increase the amount of memory the system has, I get a system reset, after a bit of debugging I noticed my PMM's bitmap was overwriting some important memory as it grew with the system memory. I was wondering where I can safely place the bitmap, as I have no way of allocating memory without my PMM, which isn't inited until I pass it a bitmap. I was thinking of moving the base address of where my kernel is loaded up, and place the bitmap where the bootsector was loaded, overwriting the bootsector, but being inexperienced in this subject, I was wonder what you've done, because I think my choice could effect the stability of my operating system. As far as I've read the tutorial suggest I place it at 0x0, however that's where it was when the crash occurred.
If the tutorial you're using really implied that, it may need a review. Maybe you should email the writer and inform them of their mistake?
The BDA and IVT are stored in the range 0x0 through 0x4FF. I'm not sure whether or not you're using ELF, but if you are, you can generate symbols to indicate the end of your kernel's image in memory via LD Linker Scripts. From there, you can place the Bitmap / stack at the end of your kernel. There are one or two possible complications, but I assume you have it covered.
You may use the Wiki's Memory Map, which is a general map; However the best solution is to query the BIOS for an E820 map.
-All the best
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
-
- Member
- Posts: 153
- Joined: Sun Jan 07, 2007 9:40 am
- Contact:
Re: Memory Management and VGA\Vesa programming
The memory manager also comes into play when doing a GUI (and other memory mapped devices) so it's worth researching before going too far into the MM. Bank switching possibilities are available in several modes and memory mapped IO in fixed areas. These address ranges should be excluded from the available ranges that a memory manager issues out except to those device drivers which interact with the device like the VESA drivers.jeremy6996 wrote:I'm also interested in using VGA display modes, and possibly vesa, but I am not yet experienced with VGA, and I don't feel comfortable moving to vesa.
Re: Memory Management and VGA\Vesa programming
Hello,
Actually iit implies just that. Usually if I am uncertain of what search terms to use, I look up my topic on Wikipedia first and go from there.Just because I can't locate information on a topic I've never worked with before doesn't mean I am no good at googling.
All that you need to do is reserve an area in physical memory thats always guaranteed to be there, and allocate that memory later after initializing the PMM. (That is, mark the area where the bitmap is at as reserved so allocations do not occure there.) It does not matter where in physical memory so long as its guaranteed and unused RAM, and is mapped somewhere in kernel space.where I can safely place the bitmap
Never, ever touch anything at physical address 0. Doing so will overwrite your IVT which will defeat any possibility of your system supporting v86 tasks.As far as I've read the tutorial suggest I place it at 0x0, however that's where it was when the crash occurred.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
-
- Posts: 10
- Joined: Mon Sep 28, 2009 11:06 am
Re: Memory Management and VGA\Vesa programming
Alright, thanks again, I really appreciate it.