My Haiku RISC-V port progress

I managed to get KDL and basic stack trace working:

+vm_allocate_early
PANIC: not implemented: status_t arch_vm_translation_map_early_map(kernel_args*, addr_t, phys_addr_t, uint8, phys_addr_t (*)(kernel_args*))

Welcome to Kernel Debugging Land...
Thread 0 "" running on CPU 0
arch_debug_stack_trace()
Stack:
FP: 0x80be9a50, PC: 0x8030a4d9
FP: 0x80be9ac0, PC: 0x8030a765
FP: 0x80be9b00, PC: 0x8030aa71
FP: 0x80be9b50, PC: 0x8037ca61
FP: 0x80be9bb0, PC: 0x803666dd
FP: 0x80be9c00, PC: 0x80358ac1
FP: 0x80be9cc0, PC: 0x8035a10b
FP: 0x80be9d70, PC: 0x8035a2ad
FP: 0x80be9da0, PC: 0x80356e0d
FP: 0x80be9e20, PC: 0x8035d2dd
FP: 0x80be9e70, PC: 0x8035c815
FP: 0x80be9f00, PC: 0x80356ed9
FP: 0x80be9fe0, PC: 0x8036985d
FP: 0x80bea000, PC: 0x802d3e23
FP: 0x80144f10, PC: 0x8000019f
FP: 0x80144f70, PC: 0x800261a7
FP: 0x80145000, PC: 0x800002d3
FP: 0x0, PC: 0x8000000d

The problem was absolute addresses in vtable that was not included to relocation table for some reason. Kernel is currently loaded at dynamically defined address that don’t math address in linker script (0x80000000 currently used for haiku_loader). Using -fpic and -shared compiler flags fixed issue. Additional relocation types were needed to be implemented (jump slot).

No luck in getting built-in symbol lookup working because it use heap that not yet working. Lets port my mini OS stack tracer…

Also I introduced virtual memory to my mini OS, now it is possible to map virtual memory and catch page fault traps.

11 Likes