-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arch/arm64: fix boot stage prints with CONFIG_ARCH_EARLY_PRINT=y #15901
base: master
Are you sure you want to change the base?
Conversation
`boot_stage_puts` used by early asm calls arm64_lowputc() for each character in a loop. During that loop it uses x1 as the pointer to the next character to be printed. However, x1 is clobbered by arm64_lowputc(), resulting in undefined behaviour (only the first character of the string is guaranteed to be printed). Fix this by using x19 instead. Signed-off-by: George Poulios <[email protected]>
@nuttxpr test qemu-armv8a:netnsh |
[Experimental Bot, please feedback here] Build and Test Successful (qemu-armv8a:netnsh)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested OK with OSTest on Arm64 QEMU. Thanks :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice catch
Patched block gets compiled out without ostest result
|
Summary
boot_stage_puts
used by early assembly head, callsarm64_lowputc()
for each character of the string to be printed in a loop. During that loop it usesx1
as the pointer to the next character to be printed. However,x1
is clobbered[1] byarm64_lowputc()
, resulting in undefined behaviour (only the first character of the string is guaranteed to be printed).Fix this by using
x19
instead.[1] Observed clobbering behaviour with
arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64
.Impact
The change does not affect users, build processes, hardware, documentation or security compatibility.
The only notable effect should be the early console messages in arm64 builds being fully (and more reliably) visible when configured with
CONFIG_ARCH_EARLY_PRINT=y
.Testing
arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64
imx93evk:nsh
CONFIG_ARCH_EARLY_PRINT=y
WIthout the change, early boot stage messages would appear as:
With the change, early boot stage messages are: