riscv-software-src / riscv-pk

RISC-V Proxy Kernel
Other
593 stars 308 forks source link

Fixes for booting with code above 2^32 #167

Closed kprovost closed 5 years ago

kprovost commented 5 years ago

I ran into two problems trying to boot on a system where memory is mapped above 0x100000000. This exposed bugs in the trap handler and illegal_inst_trap() when they compute the location of the handler function.

aswaterman commented 5 years ago

Thanks for the bug fixes. Unfortunately, these slow things down when the trap table is below 2^32 (and the performance of this code does matter to some extent..). Let me see if I can find a way to preserve both your bug fix and the performance.

kprovost commented 5 years ago

Thanks for the quick response. Let me know if there's anything I can do to help. I can reproduce the problem easily in qemu.

aswaterman commented 5 years ago

Thanks. I'll get you to test a patch in a sec. I'm just going to convert these tables to use pointer-sized entries. The extra data memory footprint shouldn't affect performance in practice, since there's usually huge temporal locality in accessing these tables.

aswaterman commented 5 years ago

@kprovost Can you give this a shot? https://github.com/riscv/riscv-pk/pull/168

kprovost commented 5 years ago

With #168 I can also boot my system, so yes, that's good too.

(And booting means that traps work, because there are ecalls for UART, and trap handling for 'rdtime').

aswaterman commented 5 years ago

Cool. I'm going to merge that one. Thanks for raising this issue.