10000 rv32i: force semihosting insn sequence to be contained in single page by lschuermann · Pull Request #3364 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rv32i: force semihosting insn sequence to be contained in single page #3364

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

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

lschuermann
Copy link
Member
@lschuermann lschuermann commented Jan 2, 2023

Pull Request Overview

As specified in the RISC-V Semihosting discussion document1, the semihosting instruction sequence must be fully contained in a single memory page. This can be accomplished through 16-byte alignment of the instruction sequence. However, in contrast to the trap function example provided in the document, we need to perform the aligment before setting norvc. The preceding instruction may have been a compressed instruction and ended on a 2-byte boundary. In this case, a compressed nop instruction needs to be used to restore proper alignment, which would be forbidden by the use of norvc, generating an error such as the following:

LLVM ERROR: unable to write nop sequence of 2 bytes

Testing Strategy

This pull request was tested by running it with the QEMU RISC-V 32-bit virt target and forcing a panic.

TODO or Help Wanted

N/A

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

As specified in the RISC-V Semihosting discussion document[1], the
semihosting instruction sequence must be fully contained in a single
memory page. This can be accomplished through 16-byte alignment of the
instruction sequence. However, in contrast to the trap function
example provided in the document, we need to perform the aligment
before setting `norvc`. The preceding instruction may have been a
compressed instruction and ended on a 2-byte boundary. In this case, a
compressed nop instruction needs to be used to restore proper
alignment, which would be forbidden by the use of `norvc`, generating
an error such as the following:

    LLVM ERROR: unable to write nop sequence of 2 bytes

[1]: https://github.com/riscv-software-src/riscv-semihosting/blob/f2e0eaf46d34a54ebbc1799c9a8879c4cc544fe4/riscv-semihosting-spec.adoc
@github-actions github-actions bot added the risc-v RISC-V architecture label Jan 2, 2023
@hudson-ayers
Copy link
Contributor

bors r+

@bors
Copy link
Contributor
bors bot commented Jan 25, 2023

@bors bors bot merged commit 670ff1e into tock:master Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
risc-v RISC-V architecture
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0