Hi,
I already experimenting different methods of paging.
I tried GDT Trick of Tim Robinson, I have some issues with it, if I include some of my code the , PC resets.
I tried Higher Half kernel without the GDT Trick, I was stucked in the same problem like the first method.
But when I tried the Identity mapping, it works fine.
My kernel is loaded at physical address 100000h, and I identity mapped starting from address 0 up to the available memory.
My question, is Identity mapping technique logically good that I can produce a Windows-like OS? Or will I suffer some technical problem in the long run and fail on this project?
What method do you use in your OS?
Thanks,
Sheena
What paging method do you use?
-
- Posts: 16
- Joined: Wed Jan 02, 2008 10:44 pm
- Location: USA
What paging method do you use?
BY THE TIME YOU FINISH YOUR OS, OS IS ALREADY OBSOLETE
Hi,
The time you will hit problems is once you start multitaskng. The reasons for this are twofold:
1) You may want to link process A at 0x100000 and also link process B at 0x100000. If you have separate memory spaces per-process, this is entirely possible. If not, you either have to ensure that each binary is run from a different location in memory (every app designer needs to know where every other app designer has linked their applications!) or use position independent code for each binary. If you do this, you are limited to one memory space containing the heap, stack and binary data for every application.
2) Memory protection. Eventually, you will probably want a separate PD (in 32 bit mode) or PML4 (in 64 bit mode) for each task. This means that any process can only see its own data, protecting the other processes from erroneous / malicious memory accesses.
My suggestion would be to place your kernel at around the 3GB mark in virtual RAM (if you are in 32 bit PMode) and for now, do not use the space under this. Space up to 3GB will eventually be your 'application space' and space above 3GB will be kernel space. You will probably then want separate paging structures for each process.
Cheers,
Adam
The time you will hit problems is once you start multitaskng. The reasons for this are twofold:
1) You may want to link process A at 0x100000 and also link process B at 0x100000. If you have separate memory spaces per-process, this is entirely possible. If not, you either have to ensure that each binary is run from a different location in memory (every app designer needs to know where every other app designer has linked their applications!) or use position independent code for each binary. If you do this, you are limited to one memory space containing the heap, stack and binary data for every application.
2) Memory protection. Eventually, you will probably want a separate PD (in 32 bit mode) or PML4 (in 64 bit mode) for each task. This means that any process can only see its own data, protecting the other processes from erroneous / malicious memory accesses.
My suggestion would be to place your kernel at around the 3GB mark in virtual RAM (if you are in 32 bit PMode) and for now, do not use the space under this. Space up to 3GB will eventually be your 'application space' and space above 3GB will be kernel space. You will probably then want separate paging structures for each process.
Cheers,
Adam
Hi AJ,
I've seen mention somewhere else that many kernels locate themselves in the upper end of virtual memory, just as you've suggested above.
What is the reason for this?
If the kernel is loaded into physical memory at 0x100000, why not just identity map that part of it and leave the higher memory for applications?
Cheers,
Lee
I've seen mention somewhere else that many kernels locate themselves in the upper end of virtual memory, just as you've suggested above.
What is the reason for this?
If the kernel is loaded into physical memory at 0x100000, why not just identity map that part of it and leave the higher memory for applications?
Cheers,
Lee
Hi,
Absolutely no reason why you can't do that. However, if your OS gets to the point where others are creating apps for it, they will all need to know that they should link their apps at a high address (no so conventional).
Linking kernels at a high address is perhaps just a psychological way of getting the kernel 'out of the way' of user apps. In much the same way, you could say that all user apps will start at 0x00000000, but this would mean that you have no 'NULL pointer trap' - for this reason, some OS's seem to get user apps to start at 0x100000, for example.
Cheers,
Adam
Absolutely no reason why you can't do that. However, if your OS gets to the point where others are creating apps for it, they will all need to know that they should link their apps at a high address (no so conventional).
Linking kernels at a high address is perhaps just a psychological way of getting the kernel 'out of the way' of user apps. In much the same way, you could say that all user apps will start at 0x00000000, but this would mean that you have no 'NULL pointer trap' - for this reason, some OS's seem to get user apps to start at 0x100000, for example.
Cheers,
Adam
-
- Posts: 16
- Joined: Wed Jan 02, 2008 10:44 pm
- Location: USA