aboutsummaryrefslogtreecommitdiff
path: root/include/arch/vmem.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-08 17:43:59 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-08 18:04:03 +0300
commite134202611a50b358c147c92bfb8a7f443030b8b (patch)
treeac7c31824adcf41a63e4d2c5e141f5149cc55b1a /include/arch/vmem.h
parent7e828ec1e1479ff9a8afe845539d08ca0dfada5f (diff)
downloadkmi-e134202611a50b358c147c92bfb8a7f443030b8b.tar.gz
kmi-e134202611a50b358c147c92bfb8a7f443030b8b.zip
fix LLVM
+ Anything extern is right out as LLVM doesn't produce correct code for them. Maybe if I added some extra attributes but I'm skeptical. Replaced with static variables and getters/setters. + Inline ASM is apparently a bit buggy, so use an assembly stub when jumping to init. + Minimize work done in main() to minimize chance of LLVM doing something silly. Still not 100% certain that I shouldn't just write the main() as an assembly stub in arch/riscv64 to be absolutely sure everything works as intended. + Make .kernel.start section SHF_ALLOC, otherwise lld complains about pc-relative addressing Probably some other stuff as well that I'm forgetting right now. But at least with LLVM14 LTO seems to work, which is pretty cool?
Diffstat (limited to 'include/arch/vmem.h')
-rw-r--r--include/arch/vmem.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/arch/vmem.h b/include/arch/vmem.h
index e62c112..a19f555 100644
--- a/include/arch/vmem.h
+++ b/include/arch/vmem.h
@@ -148,10 +148,14 @@ vm_t setup_kernel_io(struct vmem *b, vm_t paddr);
* address space and the kernel address space in the other.
* Called at boot, not allowed to allocate memory.
*
+ * @param load_addr Where in physical memory kernel was loaded to. Could in
+ * theory be fetched from \ref get_load_addr(), but the fewer globals are
+ * touched during initialization the better.
+ *
* @return The vmem node used to build the address space. Probably statically
* allocated.
*/
-struct vmem *init_mapping();
+struct vmem *init_mapping(uintptr_t load_addr);
/**
* Create new virtual memory space.