Interpreting addresses as signed and "negative half kernel". Is this already a thing?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
ktsnowy
Posts: 1
Joined: Mon Oct 14, 2024 5:46 pm

Interpreting addresses as signed and "negative half kernel". Is this already a thing?

Post by ktsnowy »

I've been reading about the advantages of higher half kernels and the disadvantages of lower half kernels. How higher half makes it more convenient for userspace by allowing the usage of more addresses closer to zero, and lower half makes it more convenient for the kernel (for the same reason) while potentially causing problems for userspace.

However, isn't the notion that "closer to zero" must also mean "above zero" a side effect of interpreting addresses as unsigned? There's no hardware requirement for this to be the case, right? It's simply a convention, the hardware is perfectly capable of jumping to any negative addresses close to zero via sign-extended immediates and may even treat addresses as signed already. As evidenced by x86 having 48-bit sign-extended addresses, which leaves a memory hole between userspace and kernel addresses when interpreted as unsigned.

So if instead we interpreted addresses as signed we could place the kernel immediately below zero and have all the advantages of a higher half kernel (because it is one) while also having the advantages of a lower half kernel (being close to zero). Userspace would grow upwards from zero and the kernel would grow downwards from zero (in stack-like fashion 8)), both starting close to zero.

This fixes the conceptual memory hole caused by interpreting addresses as unsigned, has all the advantages of a higher half kernel and all the advantages of a lower half kernel.

So why is it that I never hear about this specific layout being used? Are there any issues caused by doing this?
Octocontrabass
Member
Member
Posts: 5501
Joined: Mon Mar 25, 2013 7:01 pm

Re: Interpreting addresses as signed and "negative half kernel". Is this already a thing?

Post by Octocontrabass »

I'm not sure why you haven't heard of it before, but it's the recommended memory layout for x86-64 kernels.
Post Reply