mikaku / Fiwix

A UNIX-like kernel for the i386 architecture
https://www.fiwix.org
Other
407 stars 32 forks source link

Multiboot not working due to kernel stack being overwritten #38

Closed rick-masters closed 1 year ago

rick-masters commented 1 year ago

Using qemu to boot Fiwix (using multiboot) does not currently work for me. There is no output from the kernel.

The change https://github.com/mikaku/Fiwix/commit/d164d400272cd92f129d0dc153a757ad8c630c39 moved the kernel stack after _end but get_last_boot_addr is still using _end to calculate the start of available kernel memory. It should use _kstack now or it will cause the kernel stack to be overwritten.

To reproduce, I've built fiwix in the fiwix-issues subdirectory and run qemu like this:

qemu-system-i386 \ -nographic \ -drive file=FiwixOS-3.2-i386.raw,format=raw,if=ide,cache=writeback,index=0 \ -machine pc \ -cpu 486 \ -enable-kvm \ -kernel fiwix-issues/fiwix \ -append "console=/dev/ttyS0 root=/dev/hda2" \ -m size=4G

With the forthcoming PR the kernel boots properly.

mikaku commented 1 year ago

I confirm the bug. Thank you very much!