gpoulios opened a new pull request, #15901:
URL: https://github.com/apache/nuttx/pull/15901

   ## Summary
   
   `boot_stage_puts` used by early assembly head, calls `arm64_lowputc()` for 
each character of the string to be printed in a loop. During that loop it uses 
`x1` as the pointer to the next character to be printed. However, `x1` is 
clobbered<sup>[1]</sup> by `arm64_lowputc()`, resulting in undefined behaviour 
(only the first character of the string is guaranteed to be printed).
   
   Fix this by using `x9` instead. Despite `x9` not currently being used by any 
other instruction in arm64_head.S, save it on entry, and restore it on exit.
   
   [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
   
   - Toolchain: `arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64`
   - Target: `imx93evk:nsh`
   - Extra config: `CONFIG_ARCH_EARLY_PRINT=y`
   
   WIthout the change, early boot stage messages would appear as:
   ```
   ---[other messages here]
   ```
   
   With the change, early boot stage messages are:
   ```
   - Boot from EL2
   - Boot from EL1
   - Boot to C runtime for OS Initialize
   [other messages here]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to