Hello everyone,
How would one implement a segment-based Memory Management Unit ? I know that some of you guys are paging lovers , but i just wanted to know how to implement the MMU in segments.
I was thinking about few solutions.. one of them is:
1) Create a descriptor for the GDT table itself. So i can access the REAL structure of the GDT and modify it on-the-fly with quick MOVes.
2) When a process asks for memory, create a descriptor on-the-fly with its specific info.
3) When the process end, delete its descriptor.
Looks pretty much logical and easy for me!
Please let me hear your comments and ideas ..
--devr
MMU Implementation Question
Re:MMU Implementation Question
Are there any better ideas ?? Because i am not 100% sure about this !! There must be someone before me who had implemented a segmented MMU !! ;D
--devr
--devr
Re:MMU Implementation Question
There's probably a lot of scope to do interesting things with segments -- look at Windows 3.x or OS/2 for examples. However, the main drawback is that most compilers don't know about segmentation (Open Watcom 1.0 being an exception to this). I can't think of any current OS that uses segmentation, so you're more or less on your own here.
Re:MMU Implementation Question
Win 3.x !!! is segment-based MMU really that bad ??? ! i thought that segmentation would be faster, although not flexible as paging, since paging require extra delay, thats why i decided to do it in a segmented way !! :-\ But since the size of the memory are increasing nowadays, but not at the same rate for the speed of the chips, i thought i'd better to consentrate on the speed; because it isn't as rapidly evolving as the size.
I still need comments from you guys !
Thanks ..
--devr
I still need comments from you guys !
Thanks ..
--devr
Re:MMU Implementation Question
No, segmentation is quite a bit slower. The main source of slowdown is segment register reloads (and hence far calls), because of the extra checking performed by the CPU. Another slowdown is the overhead of processing segment override prefixes on instructions.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:MMU Implementation Question
i confirm Tim for the slowness... moreover, it wouldn't be fine to use a new segment everytime a program requests memory (for instance using malloc()) , because you only have up to 8192 entries in a LDT (which is the best place to hold process-specific resources), and you can't restrict the user to only 8192 memory chunks.
What you could do, however, is using call gates and protected segments when an untrusted program wants to have access to a trusted library, using the MMU like a sandbox-helper
What you could do, however, is using call gates and protected segments when an untrusted program wants to have access to a trusted library, using the MMU like a sandbox-helper