Skip to content
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

risc-v Support #10

Closed
theduke opened this issue Jun 15, 2020 · 6 comments
Closed

risc-v Support #10

theduke opened this issue Jun 15, 2020 · 6 comments

Comments

@theduke
Copy link

theduke commented Jun 15, 2020

Stumbled over this crate while writing a toy OS.

Currently only x86 is supported (via x86_64::...::Port).

Would PR with RISC-V support be accepted?

@phil-opp
Copy link
Member

Does RISC-V also use an UART compatible to the 16550 UART? In that case, I would be happy to merge a PR for RISC-V support.

Otherwise, this crate doesn't seem like the right place for such an implementation since the crate name indicates that it is specific to 16550-compatible UARTs. But I'm open to creating a general UART crate that supports multiple architectures and device types, if that's easily possible. I don't have time to work on it personally, but you're welcome to create a new project under the rust-osdev organization if you want to implement something like that. Just let me know and I'll send you an invite.

@theduke
Copy link
Author

theduke commented Jun 16, 2020

Does RISC-V also use an UART compatible to the 16550 UART?

Sure, since UARTs are just IO devices many emalators (qemu et all) and some dev boards have (16550) UARTs.

RISC-V doesn't have custom io port instructions (in*, out*), the devices are just memory mapped.

Looking at the code, all that would really be needed for support is a cfg!ed alternative implemenation of x86_64::instructions::port::Port.

Maybe a platform-agnostic IoPort trait would make sense.

@phil-opp
Copy link
Member

Cool, I'd be happy to merge a PR for this then!

@josephlr
Copy link
Contributor

@theduke do you know what register width is used for MMIO access on RISC-V? Looking at the linux kernel documentation, it seems like the MMIO accesses can be either 1 byte, 2 byte, or 4 bytes.

@phil-opp
Copy link
Member

cc #15

@phil-opp
Copy link
Member

phil-opp commented Jun 6, 2021

Implemented in #15

@phil-opp phil-opp closed this as completed Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants