Can user mode access high memory?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Can user mode access high memory?

Post by nexos »

Hello,
While I was working on shared memory, it appears that user mode can't access memory above 0xFFFFFFFFFFF in long mode. It page faults when I do so. Is that so?
Thanks,
nexos
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Can user mode access high memory?

Post by iansjack »

That's determined by your page table. You are trying to access a canonical address?
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: Can user mode access high memory?

Post by nullplan »

No, that does work. Linux maps stack and VDSO and VVAR to very high addresses, usually just below the canonical end at 0x7fff_ffff_ffff. In case you mistyped and meant that address: Yes, under normal circumstances there is no way to map the memory between 0x8000_0000_0000 and 0xffff_7fff_ffff_ffff. Therefore this is called the canonical memory hole. Usually accessing that area should net you a general protection fault, not a page fault. I don't know what is going on with that problem for you.
Carpe diem!
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Can user mode access high memory?

Post by nexos »

nullplan, you were right. I was actually assuming it was a PF as the exception occurred in user mode. After digging a little deeper, it was a GPF and the problem is fixed now.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply