Data types
Posted: Mon Apr 10, 2006 3:06 pm
I'm currently trying to implement the basic data types I need to build my OS and specifically my new physical memory manager. I have got the basic ideas and code for bitmaps, lists and multi-level tables.
Now, consider a large system running on an X86. Giving the kernel 1GB of virtual memory leaves 3GB for user processes, but means that with todays amounts of memory, it is very likely that not all memory can be mapped at once. Using simple pointers, I would be pretty limited in where I can store my kernel data structures (such as lists), since each element in the list would have to have a constant virtual address.
Say I map the first 512MB at 3GB to 3.5GB, leaving 512MB for dynamic kernel mappings. This seems quite reasonable, but does limit the area for which virtual addresses will be constant. I don't think it's sensible to map an element of a list in the dynamic area (above 3.5GB) since that will eat into virtual memory which may have better uses.
I'm trying to decide if I should convert my data structures to work with physical addresses, since the actual addressing will all be handled internally within the data structure methods. The problem is these physical addresses will have to be 36-bit to cope with PAE or whatever its called. I don't want to use 64-bit physical addresses when only 36-bits are in use, and my only other choice is to use an array of 5 chars, which destroys any hope of execution speed.
I'm a little confused at the moment and need to let these things sink in. I'm just looking around for any ideas or bits of advice, if anyone can tell me how they handled their data structures?
Thanks in advance,
Paul Barker
Now, consider a large system running on an X86. Giving the kernel 1GB of virtual memory leaves 3GB for user processes, but means that with todays amounts of memory, it is very likely that not all memory can be mapped at once. Using simple pointers, I would be pretty limited in where I can store my kernel data structures (such as lists), since each element in the list would have to have a constant virtual address.
Say I map the first 512MB at 3GB to 3.5GB, leaving 512MB for dynamic kernel mappings. This seems quite reasonable, but does limit the area for which virtual addresses will be constant. I don't think it's sensible to map an element of a list in the dynamic area (above 3.5GB) since that will eat into virtual memory which may have better uses.
I'm trying to decide if I should convert my data structures to work with physical addresses, since the actual addressing will all be handled internally within the data structure methods. The problem is these physical addresses will have to be 36-bit to cope with PAE or whatever its called. I don't want to use 64-bit physical addresses when only 36-bits are in use, and my only other choice is to use an array of 5 chars, which destroys any hope of execution speed.
I'm a little confused at the moment and need to let these things sink in. I'm just looking around for any ideas or bits of advice, if anyone can tell me how they handled their data structures?
Thanks in advance,
Paul Barker