questions about paging!
questions about paging!
should i map the whole memory from the location 0 to the last address available ? or i should map after the address 0x100000 ?
if i started to map should i map the whole memory or only what the current process need
i mean process1 is the current process then allocate 4 KB for it then map it after the end of the process deallocate the 4 KB and so on for every process
is it better to make one entry for each process ? or should i make one directory and one table for every process ?
if i started to map should i map the whole memory or only what the current process need
i mean process1 is the current process then allocate 4 KB for it then map it after the end of the process deallocate the 4 KB and so on for every process
is it better to make one entry for each process ? or should i make one directory and one table for every process ?
Hi...
First of all would you please read this
all memory addresses you'r working with are virtual,that also apply for your kernel addresses,
here you have to choices:
*Identity mapping
*loading your kernel as higher-half
for the first choice you map the first 4MB from 0 -> 0x400000,here you have to make
physical addresses equal to virtual addresses.
Second choice , the kernel is loaded at 1MB in the physical address space (0x00100000), but is mapped at 3GB + 1MB in the virtual address space (0xC0100000).
and there's an example about that here
its own 4Mb of virtual memory.
First of all would you please read this
Let's assume you loaded your kernel at 0x100000,and now you want to enable paging,once you didshould i map the whole memory from the location 0 to the last address available ? or i should map after the address 0x100000 ?
all memory addresses you'r working with are virtual,that also apply for your kernel addresses,
here you have to choices:
*Identity mapping
*loading your kernel as higher-half
for the first choice you map the first 4MB from 0 -> 0x400000,here you have to make
physical addresses equal to virtual addresses.
Second choice , the kernel is loaded at 1MB in the physical address space (0x00100000), but is mapped at 3GB + 1MB in the virtual address space (0xC0100000).
and there's an example about that here
You give each process page directory entry that means each process hasif i started to map should i map the whole memory or only what the current process need
i mean process1 is the current process then allocate 4 KB for it then map it after the end of the process deallocate the 4 KB and so on for every process
its own 4Mb of virtual memory.
And you still need to ask that question? There is no good solution only the solution that works for you. Keep in mind that trying and failing gives you more knowledge then obtaining a good solution.mohammed wrote:shokraan although i read them before !!
Author of COBOS
Basically the most common way of doing it is too use 1 page directory and at least 1 page directory for each process. Where you map the pages too is largely up to you. The kernel will end up being mapped into the address space of all processes (for efficiency) so keep that in mind when deciding where too map your kernel too. My kernel for example is a higher half kernel and starts at 0xC0000000. (Start of 3rd GB) My applications on the other hand can be mapped anywhere below 0x80000000.
- ManOfSteel
- Member
- Posts: 60
- Joined: Tue Feb 01, 2005 12:00 am
@abuashraf:
@frank:
What the advantage of 0xc0100000? Why not just 0xc0000000?Second choice , the kernel is loaded at 1MB in the physical address space (0x00100000), but is mapped at 3GB + 1MB in the virtual address space (0xC0100000).
You mean 4GB, don't you?You give each process page directory entry that means each process has its own 4Mb of virtual memory.
@frank:
You mean, you would use more than one page directory? What's the purpose of this since just one can reference the whole 4GB of virtual memory? Is it even possible? Or maybe you only meant page table instead of page directory?Basically the most common way of doing it is too use 1 page directory and at least 1 page directory for each process.
I use 1 page directory per process. That is the only way to insure that one process cannot corrupt the memory of another process.@frank:You mean, you would use more than one page directory? What's the purpose of this since just one can reference the whole 4GB of virtual memory? Is it even possible? Or maybe you only meant page table instead of page directory?Basically the most common way of doing it is too use 1 page directory and at least 1 page directory for each process.
Each individual process can have as many page tables as it needs.
well, it is possible to give each task multiple page directories -- in fact at least 2 of us do -- we give each thread its own page directory (actually, i currently just modify it, but that might change with my current rewrite...)
its also possible to give each thread its own page directory, but im not sure why you would... if you wanted to give more memory, then you could use banking to accomplish that in a simpler manor (which i support...)
its also possible to give each thread its own page directory, but im not sure why you would... if you wanted to give more memory, then you could use banking to accomplish that in a simpler manor (which i support...)
If the kernel loaded at 0x00010000 then it will appear at 0xC0010000ManOfSteel wrote:@abuashraf:What the advantage of 0xc0100000? Why not just 0xc0000000?Second choice , the kernel is loaded at 1MB in the physical address space (0x00100000), but is mapped at 3GB + 1MB in the virtual address space (0xC0100000).
Also if your kernel loaded at 0x00100000 then it will appear at 0xC0100000.
so if your kernel loaded at 0x0 the it will apear at 0xC0000000.
but please note if you loaded your kernel at 0x0 physical address you will crash alot of
reseved memory space under 1M such as text screen video memory which is located at 0xB800.
Thanx.