paging poc
-
- Posts: 15
- Joined: Sat May 01, 2021 8:47 pm
paging poc
any poc of x64 paging? im struggling
Re: paging poc
Hi,
You might get faster responses if you gave us an idea of what you were not sure about with respect to paging. It may also be helpful for you to describe how you believe paging works so that we can discuss any potential issues with respect to understanding. We can probably make some guesses, however am sure many people here will be willing to help clarify any doubts on the subject matter. Paging is one topic where understanding how it works is critical to being able to successful implement and work with it: if you are trying to copy from a tutorial here, dont: know how it works before writing any code.
You might get lucky with getting a poc, not sure -- but a lot of folks here are happy to provide help if you provide us some details to work with.
You might get faster responses if you gave us an idea of what you were not sure about with respect to paging. It may also be helpful for you to describe how you believe paging works so that we can discuss any potential issues with respect to understanding. We can probably make some guesses, however am sure many people here will be willing to help clarify any doubts on the subject matter. Paging is one topic where understanding how it works is critical to being able to successful implement and work with it: if you are trying to copy from a tutorial here, dont: know how it works before writing any code.
You might get lucky with getting a poc, not sure -- but a lot of folks here are happy to provide help if you provide us some details to work with.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: paging poc
I'm also unsure how paging works.
Re: paging poc
Again, this is way too open-ended a question to be answered in any meaningful way. I could read the manual to you, but you could also just do that on your own time. What specific thing are you having a problem with? Because as it stands now it looks like you didn't even try to read the documentation.Skyz wrote:I'm also unsure how paging works.
Carpe diem!
-
- Posts: 15
- Joined: Sat May 01, 2021 8:47 pm
Re: paging poc
I read SDM, but I'd use SDM and a POC better to understand..nullplan wrote:Again, this is way too open-ended a question to be answered in any meaningful way. I could read the manual to you, but you could also just do that on your own time. What specific thing are you having a problem with? Because as it stands now it looks like you didn't even try to read the documentation.Skyz wrote:I'm also unsure how paging works.
Do I have to make a frame for everything or just what i wanna page, is there any alternative to paging?
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: paging poc
What do you mean? In long mode, all physical memory is divided into frames. If you want to access one of those frames, you have to map it to a page to give it a virtual address.newosdeveloper2021 wrote:Do I have to make a frame for everything or just what i wanna page,
No. Paging is mandatory in long mode.newosdeveloper2021 wrote:is there any alternative to paging?
Re: paging poc
Can you just make a new mode like short mode and avoid paging?Octocontrabass wrote:What do you mean? In long mode, all physical memory is divided into frames. If you want to access one of those frames, you have to map it to a page to give it a virtual address.newosdeveloper2021 wrote:Do I have to make a frame for everything or just what i wanna page,
No. Paging is mandatory in long mode.newosdeveloper2021 wrote:is there any alternative to paging?
Last edited by Skyz on Mon Jun 07, 2021 12:25 pm, edited 1 time in total.
-
- Member
- Posts: 426
- Joined: Tue Apr 03, 2018 2:44 am
Re: paging poc
x86 protected mode doesn't use paging until it is explicitly enabled, so basic real mode and protected mode can both be used without paging.Skyz wrote:Is there a mode that it can be avoided, what's the benefit of running paging. I don't see any os using applications.
But paging brings massive benefits:
- Simplifies process separation. With a page table per isolated address space, it is easy to control what memory is exclusively or shared mapped at a per-page per process level.
- Simplifies memory allocation. For a process logical address space, the allocated physical memory can be anywhere, it need not be contiguous. This is the basis of virtual memory, and is very difficult to do with segmentation, because contiguous virtual memory also has to be contiguous in physical memory using base/limit segmentation.
- Reduces memory usage. Because virtual memory pages can be unmapped, and mapped in on demand, not all memory a process needs has to be actually resident. Demand paging allocates memory to address spaces as it's needed, and a process rarely needs all its memory all of the time, so some can be discarded when not in use and (re-)read from disk as required.
Personally, I see paging and virtual memory management as considerably more useful and fundamental for operating systems than, for example, file systems. A minimal kernel needs to implement, if it is providing protected address spaces at all, a paging mechanism. The only systems that don't are simple embedded kernels, which provide essentially a threaded runtime to some dedicated application, which might not even have a MMU. Think IoT.
Otherwise, for a general purpose kernel, paging is fundamental, and no general purpose CPUs in common use (except x86) provide anything other than a page based MMU. Even single address space kernels benefit from paging if the CPU provides it.
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: paging poc
You can't make a new mode. You can use real mode or protected mode if you want to avoid paging. Why do you want to avoid paging?Skyz wrote:Can you just make a new mode like short mode and avoid paging?