Interpreting addresses as signed and "negative half kernel". Is this already a thing?
Posted: Mon Oct 14, 2024 6:57 pm
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 ), 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?
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 ), 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?