UEFI bootloader "err: integer overflow"

Hello all,

here I am again, and after some weeks I finally got the bootloader compiling and I uploaded it to codeberg.
The only thing that fails is running. When I run it in QEMU, the program loaded by UEFI just exits with err: integer overflow and UEFI searches for other media or does whatever.
Using my debug information I implemented in the bootloader, I found the position of the error: src/bootloader/elf.zig:240.
But what could be the cause of an integer overflow there?

Looking forwards,
Samuel Fiedler

Is that error a Zig panic? If so, I don’t see any way line 240 could cause it. Based on your debug prints, are you sure it is not line 247 or 250? Perhaps your ELF header structures are not quite aligned with your kernel image, and e_phnum is some very large int.

That’s a very good point! Will look at it…

Looked into Ghidra and indeed, it seems like line 247 and 250 are marked with Zig panics.
But how could I fix that?

Found the error: In line 247 and 250 there should have been *% instead of *.
What a SINGLE character can do. And how zig translate-c can help…