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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
codyd51
Member
Member
Posts: 77
Joined: Fri May 20, 2016 2:29 pm
Location: London, UK
GitHub: https://github.com/codyd51
Contact:

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

Post 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.
Last edited by codyd51 on Wed Nov 10, 2021 4:43 pm, edited 1 time in total.
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: Serial port outputs garbage after jump to higher half

Post 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.
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Serial port outputs garbage after jump to higher half

Post 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.
codyd51
Member
Member
Posts: 77
Joined: Fri May 20, 2016 2:29 pm
Location: London, UK
GitHub: https://github.com/codyd51
Contact:

Re: Serial port outputs garbage after jump to higher half

Post 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.
codyd51
Member
Member
Posts: 77
Joined: Fri May 20, 2016 2:29 pm
Location: London, UK
GitHub: https://github.com/codyd51
Contact:

Re: Serial port outputs garbage after jump to higher half

Post by codyd51 »

Confirmed, fixed! I will mark this post as solved. Thanks again.
Post Reply