Hi,
sawdust wrote:Thanks a lot for very thoughtful ideas. Since my OS is a single-task one, do you recommend that I should go with a 'bare minimum paging' ? I have no need for mallocs.
That depends - is there a reason you chose to not use paging to start with?
For example, I can imagine an RTOS for small/embedded systems where the unpredictability involved with TLB misses is undesirable (although to be honest, this doesn't seem like a good reason after you consider the unpredictability that SMM introduces on 80x86 systems).
sawdust wrote:My application does a lot of mempy, enabling back & forth of PAE mode seems less desirable.
Would enabling PAE and leaving it enabled remove the need for a lot of these memory copies? From a performance perspective, the overhead of paging (TLB misses, etc) may be much less than the overhead of segmentation (dealing with physical RAM fragmentation).
sawdust wrote:Currently the GDT is set for full 4GB segments, using 1:1 address and am afraid to change too much.
For a "64-bit memory copy" function, you wouldn't necessarily need to change anything - just allocate some pages (page directory pointer table, page directory, and at least one page table), identity map the page/s used by the "64-bit memory copy" function, map the source pages, map the destination pages, disable IRQs, enable paging/PAE, do the copy, then disable paging/PAE, enable IRQs and free any pages you allocated (unless they're permanently allocated to save allocation/deallocation time).
However, in this case you'd introduce extra IRQ latency, which can be bad for a RTOS. For example, if someone asks to copy a large amount of data then IRQs could be disabled for far too long. One way to avoid that would be to have IRQ handlers that work when paging/PAE is enabled, which could become considerably complicated as you'd need to worry about everything that any IRQ handler could rely on. An alternative way would be to limit the size of each memory copy (e.g. split a large memory copy into many small memory copies); or perhaps have some IRQ handlers that are used when paging is enabled that disable paging and call the real IRQ handlers and then enable paging again after the real IRQ handlers return.
Mostly, I need to know why you've made the design decisions you have. Without knowing why, my default opinions start taking over (e.g.
IMHO 80x86 is a bad architecture for "hard real time", and "soft real time" is mostly just a marketing term for any general purpose OS. Single-tasking is mostly pointless now ("OMG! I've got 16 CPUs and I can only run *one* task???") and "no paging" sounds like "masochist" to me/)...
Cheers,
Brendan