As pointed out by Ben Kimock in issue #22, NULL carries no provenance, and attempting to forge a dereferenceable pointer from NULL is UB.
Remove that paradigm from phbl by applying different techniques:
Where we just need a pointer to get its address and nothing else, core::ptr::invalid serves nicely.
When we want to get a pointer from a freshly-mapped address, as when loading the kernel, ask the page table to use its provenance to create the pointer. Indeed, the page table can even validate that it properly maps the given address.
For early UART initialization, introduce an MMIO_BASE symbol in assembly language that we can leverage to get a provenance-providing pointer.
I believe these changes together address address the UB issue, but would appreciate @saethlin's input. Thank you again!
As pointed out by Ben Kimock in issue #22, NULL carries no provenance, and attempting to forge a dereferenceable pointer from NULL is UB.
Remove that paradigm from
phbl
by applying different techniques:core::ptr::invalid
serves nicely.MMIO_BASE
symbol in assembly language that we can leverage to get a provenance-providing pointer.I believe these changes together address address the UB issue, but would appreciate @saethlin's input. Thank you again!
Fixes: #22 Signed-off-by: Dan Cross cross@oxidecomputer.com