| ▲ | convolvatron 3 days ago | |||||||||||||||||||||||||
its entirely possible to implement segments on top of paging. what you need to do is add the kernel abstractions for implementing call gates that change segment visibility, and write some infrastructure to manage unions-of-a-bunch-of-little-regions. I haven't implemented this myself, but a friend did on a project we were working on together and as a mechanism it works perfectly well. getting userspace to do the right thing without upending everything is what killed that project | ||||||||||||||||||||||||||
| ▲ | Joker_vD 3 days ago | parent | next [-] | |||||||||||||||||||||||||
There is also a problem of nested virtualization. If the VM has its own "imaginary" page tables on top of the hypervisor's page tables, then the number of actual physical memory reads goes from 4–6 to 16–36. | ||||||||||||||||||||||||||
| ▲ | aforwardslash 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
If I understood correctly, you'te talking about using descriptors to map segments; the issue with this approach is two-fold: it is slow (as each descriptor needs to be created for each segment - and sometimes more than one, if you need write-execute permissions), and there is a practical limit on the number of descriptors you can have - 8192 total, including call gates and whatnot. To extend this, you need to use LDTs, that - again - also require a descriptor in the GDT and are limited to 8192 entries. In a modern desktop system, 67 million segments would be both quite slow and at the same time quite limited. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | tliltocatl 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
But that wouldn't protect against out-of boundary access (which is the whole point of segments), would it? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | nine_k 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
Indeed. Also, TLB as it exists on x64 is not free, nor is very large. A multi-level "TLB", such that a process might pick an upper level of a large stretch of lower-level pages and e.g. allocate a disjoint micro-page for each stack frame, would be cool. But it takes a rather different CPU design. | ||||||||||||||||||||||||||
| ▲ | formerly_proven 3 days ago | parent | prev [-] | |||||||||||||||||||||||||
"Please give me a segmented memory model on top of paged memory" - words which have never been uttered | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||