Page 1 of 1

[Fixed]Serial port outputs garbage after jump to higher half

Posted: Tue Nov 09, 2021 5:00 pm
by codyd51
Hi!

I'm working on porting my OS from GRUB/x86_32 to a custom UEFI bootloader/x86_64. This is all well and good in QEMU, but I'm now running into trouble on real hardware, and am wondering if anyone has seen similar behaviour.

I've connected a serial cable to the computer to see what my bootloader/kernel is outputting. I get valid logs from the bootloader, but as soon as it jumps to a higher half address (and exits boot services), the serial port outputs a few garbage bytes and nothing more. The monitor also appears stuck, with no visible activity after the log line indicating the jump to the kernel, but otherwise my debugging capabilities are limited outside an emulator.

Re: Serial port outputs garbage after jump to higher half

Posted: Tue Nov 09, 2021 5:08 pm
by zaval
after ExitBootServices(), all the UEFI protocols are unavailable and you should program UART by your OS. if you do this, then, obviously, you do this wrong. you know better what you do.

Re: Serial port outputs garbage after jump to higher half

Posted: Tue Nov 09, 2021 6:29 pm
by Octocontrabass
Some UEFI implementations have a wonderful bug where custom memory types cause ExitBootServices() to hang.

Perhaps you should try making your activity visible by drawing simple things to the framebuffer. For example, you could fill the whole screen with solid colors at different points to see how far you get before the hang.

Re: Serial port outputs garbage after jump to higher half

Posted: Wed Nov 10, 2021 7:29 am
by codyd51
Octocontrabass wrote:Some UEFI implementations have a wonderful bug where custom memory types cause ExitBootServices() to hang.
I am impressed by both the awareness of the bug and the tracking down of the affected code, considering this was in a feature branch! :D

Well spotted, I will give this a try when I'm next able to and will report back in this thread.

Re: Serial port outputs garbage after jump to higher half

Posted: Wed Nov 10, 2021 4:42 pm
by codyd51
Confirmed, fixed! I will mark this post as solved. Thanks again.