How Much Memory Linux Kernel Needs To Run ?


hlidegp2x

Member
Joined
Sep 8, 2007
Messages
302
I have several questions :

1) does Cortex-A8 can map the same physical page at different virtual addresses or is it impossible due to hardware design for mmu ?

2) Can linux mmap stuff be able to track if a swapped page should be recovered at all virtual addresses where the physical page were the same ?

Why I ask those questions ?

I would like, say, to mmap a virtual 1GB block, where I would have approximatively 69 MB of true ram pages, scattered and mirrored in the block. Basically mirrored in a cached segment and a uncached segment.

1) if it is not possible because of hardware design of MMU, I guess i have no choice.

2) if it is not possible to share a physical page between different virtual addresses without a loss of coherency if page is swapped, can Linux be confortable if we lock those 69MB pages in the block (that is a fix mapping without swapping or paging out) ?
 
Multiple virtual addresses can indeed point to the same physical addresses, but why would you want to allocate 1GB of virtual memory but only use 69MB of it? Is this for some kind of emulation?

Linux will normally be happy unless you overwrite it's normal mappings.
 
Squidge said:
Multiple virtual addresses can indeed point to the same physical addresses, but why would you want to allocate 1GB of virtual memory but only use 69MB of it? Is this for some kind of emulation?

Linux will normally be happy unless you overwrite it's normal mappings.
in fact, it is 2GB :/. Yes, it's for an emulator. in user mode, 99,9% of memory accesses should happen in RAM but they are scattered around lower 2 GB (but i don't need to allocate all teh 2 GB indeed). First GB is cached segment and second GB is uncached segment. I thought about having a base register pointing on it this way :

CODE

only big emulator class
+-------------------------------------------+ -YYYY
| |
| emulator data member |
| |
+-------------------------------------------+ -XXXX
| register context |
+-------------------------------------------+ +0 <--- base register
| |\
| scratchpad | | I need to remap some area
| vram | | as a mirror between cached
| main ram | | and uncached version
| (cached and uncached) | |
| |/
+-------------------------------------------+ +ZZZZ



this base register would have two puroposes :
- reading/writing the emulated registers with negative offset
- directly reading/writing in emulated memory through the operand mode with a simple addition of the base register and an offset register in RAM load/store instructions.

base register would be a dedicated register.
 
Last edited by a moderator:
I've done something very similar to that before, but I tossed out Linux before I did so and wrote my own mmu table. I then made selected pages no-access, so I could trap access to them and process accordingly in my data abort handler.

You might get away with it, but I believe linux uses up two "chunks", so ensure these chunks are not in the middle of the vmem you need.
 
Back
Top